Our Oracle 1Z0-805 exam demos are generally presented as Pdf and Check ENGINE. Your Pdf files are printable along with portable; and the Check ENGINE can be downloadable. Both of which will be offered after anyone pay for your Oracle 1Z0-805 products. It is possible to carry your tests along with prepare pertaining to them in your study as well as in a class by means of self-training. The examination engine could create a true test-taking environment in your case. In a term, our Oracle 1Z0-805 exam braindumps expense little span of your time and a tiny amount of income. Guaranteed results are generally waiting in your case.

2021 Sep 1Z0-805 free practice test

Q41. Given: 

public class DataCache { 

private static final DataCache instance = new DataCache (); 

public static DataCache getInstance () { 

return instance; 

Which design pattern best describes the class? 

A. Singleton 


C. Abstract Factory 

D. Composition 

Answer: A 

Explanation: Java has several design patterns Singleton Pattern being the most commonly used. Java Singleton pattern belongs to the family of design patterns, that govern the instantiation process. This design pattern proposes that at any time there can only be one instance of a singleton (object) created by the JVM. The class’s default constructor is made private, which prevents the direct instantiation of the object by others (Other Classes). A static modifier is applied to the instance method that returns the object as it then makes this method a class level method that can be accessed without creating an object. 

Q42. Given the code fragment: 

Locale loc1 = Locale.getDefault (); 

ResourceBundle messages = ResourceBundle.getBundle("MessageBundle", loc1); 

Which two statements are a valid way to re-assign a resource bundle to a different Locale? 

A. loc1 = ResourceBundle.getBundle ("MessageBundle", Locale.CHINA); 

B. loc1 = ResourceBundle.getBundle ("MessageBundle", new Locale ("es", "ES")); 

C. messages = ResourceBundle.getBundle ("messageBundle", new Locale ("es", "ES")); 

D. messages = ResourceBundle.getBundle ("MessageBundle", Locale.CHINA); 

Answer: C,D 

Q43. View the Exhibit: 

Given the following code fragment: 

class Finder extends SimpleFileVisitor<Path> { 

private final PathMatcher matcher; 

private static int numMatches = 0; 

Finder() { 

matcher = FileSystems.getDefault().getPathMatcher("glob:*java"); 

void find(Path file) { 

Path Name = file.getFileName(); 

if (name != null && matcher.matches(name)) { 


void report() 

System.out.println("Matched: " + numMatches); 


public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { 


return CONTINUE; 

public class Visitor { 

public static void main(String[] args) throws IOException { 

Finder finder = new Finder(); 

Files.walkFileTree(Paths.get("d:\Project"), finder); 


What is the result? 

A. Compilation fails 

B. 6 

C. 4 

D. 1 

E. 3 

Answer: B 

Explanation: The program will compile and run. 

Referring to the exhibit there will be six nodes that matches glob:*java. 

Q44. Which three enum constants are defined in FilevisitResult? 







Answer: A,B,D 

Explanation: The FileVisitor methods return a FileVisitResult value. You can abort the file walking process or control whether a directory is visited by the values you return in the FileVisitor methods: 

* CONTINUE – Indicates that the file walking should continue. If the preVisitDirectory method returns CONTINUE, the directory is visited. 

* SKIP_SIBLINGS – When preVisitDirectory returns this value, the specified directory is not visited, postVisitDirectory is not invoked, and no further unvisited siblings are visited. If 

returned from the postVisitDirectory method, no further siblings are visited. Essentially, nothing further happens in the specified directory. 

* TERMINATE – Immediately aborts the file walking. No further file walking methods are invoked after this value is returned. 

* SKIP_SUBTREE – When preVisitDirectory returns this value, the specified directory and its subdirectories are skipped. This branch is "pruned out" of the tree. 

Note: To walk a file tree, you first need to implement a FileVisitor. A FileVisitor specifies the required behavior at key points in the traversal process: when a file is visited, before a directory is accessed, after a directory is accessed, or when a failure occurs. 

Reference: The Java Tutorials, Walking the File Tree 

Q45. Which two Capabilities does Java.util.concurcent.BlockingQueue provide to handle operation that cannot be handled immediately? 

A. Automatically retry access to the queue with a given periodicity. 

B. Wait for the queue to contain elements before retrieving an element. 

C. Increase the queue's capacity based on the rate of blocked access attempts. 

D. Wait for space to become available in the queue before inserting an element. 

Answer: B,D 

Explanation: A blocking queue is a Queue that additionally supports operations that wait for the queue to become non-empty when retrieving an element, and wait for space to become available in the queue when storing an element. 

Note: The BlockingQueue interface in the java.util.concurrent class represents a queue which is thread safe to put into, and take instances from. 

The producing thread will keep producing new objects and insert them into the queue, until the queue reaches some upper bound on what it can contain. It's limit, in other words. If the blocking queue reaches its upper limit, the producing thread is blocked while trying to insert the new object. It remains blocked until a consuming thread takes an object out of the queue. 

The consuming thread keeps taking objects out of the blocking queue, and processes them. If the consuming thread tries to take an object out of an empty queue, the consuming thread is blocked until a producing thread puts an object into the queue. 

Reference: Java.util.concurcent.BlockingQueue 


Abreast of the times 1Z0-805 rapidshare:

Q46. What design pattern does the Drivermanager.getconnection () method characterize? 


B. Factory 

C. Singleton 

D. composition 

Answer: B 

Explanation: DriverManager has a factory method getConnection() that returns a 

Connection object. 

Note 1: A factory method is a method that creates and returns new objects. 

The factory pattern (also known as the factory method pattern) is a creational design 

pattern. A factory is a Java class that is used to encapsulate object creation code. A factory 

class instantiates and returns a particular type of object based on data passed to the 

factory. The different types of objects that are returned from a factory typically are 

subclasses of a common parent class. 

Note 2: 

The method DriverManager.getConnection establishes a database connection. This 

method requires a database URL, which varies depending on your DBMS. The following 

are some examples of database URLs: MySQL, Java DB. 

Q47. Given: 

private static void copyContents() { 

try ( 

InputStream fis = new FileInputStream("report1.txt"); 

OutputStream fos = new FileOutputStream("consolidate.txt"); 

) { 

byte[] buf = new byte[8192]; 

int i; 

while ((i = fis.read(buf)) != -1) { 

fos.write(buf, 0, i); 


fis = new FileInputStream("report2.txt"); 

while ((i = fis.read(buf)) != -1) { 

fos.write(buf, 0, i); 

What is the result? 

A. Compilation fails due to an error at line 28 

B. Compilation fails due to error at line 15 and 16 

C. The contents of report1.txt are copied to consolidate.txt. The contents of report2.txt are appended to consolidate.txt, after a new line 

D. The contents of report1.txt are copied to consolidate.txt. The contents of report2.txt are appended to consolidate.txt, without a break in the flow. 

Answer: A 

Explanation: The auto-closable resource fis may not be assigned. 

Note: The try-with-resources statement is a try statement that declares one or more resources. A resource is an object that must be closed after the program is finished with it. The try-with-resources statement ensures that each resource is closed at the end of the statement. Any object that implements java.lang.AutoCloseable, which includes all objects which implement java.io.Closeable, can be used as a resource. 

Reference: The Java Tutorials,The try-with-resources Statement 

Q48. Given the code fragment: String query = "SELECT ID FROM Employee"; \ Line 1 

try (Statement stmt = conn.CreateStatement()) { \ Line 2 

ResultSet rs = stmt.executeQuery(query); \ Line 3 

stmt.executeQuery ("SELECT ID FROM Customer"); \ Line 4 

while (rs.next()) { 

\process the results 

System.out.println ("Employee ID: " + rs.getInt("ID") ); 

} catch (Exception e) { 

system.out.println ("Error"); 

Assume that the SQL queries return records. What is the result of compiling and executing this code fragment? 

A. The program prints employees IDs. 

B. The program prints customer IDs. 

C. The program prints Error. 

D. Compilation fails on line 13. 

Answer: A 

Explanation: Line 3 sets the resultset rs. rs will contain IDs from the employee table. 

Line 4 does not affect the resultset rs. It just returns a resultset (which is not used). 


A ResultSet object is a table of data representing a database result set, which is usually generated by executing a statement that queries the database. 

You access the data in a ResultSet object through a cursor. Note that this cursor is not a database cursor. This cursor is a pointer that points to one row of data in the ResultSet. 

Initially, the cursor is positioned before the first row. The method ResultSet.next moves the cursor to the next row. This method returns false if the cursor is positioned after the last row. This method repeatedly calls the ResultSet.next method with a while loop to iterate through all the data in the ResultSet. 

Reference: The Java Tutorials,Retrieving and Modifying Values from Result Sets 

Q49. Given: 

ConcurrentMap<String, String> partList = new ConcurrentHashMap<> (); 

Which fragment puts a key/value pair in partList without the possibility of overwriting an existing key? 

A. partList.put (key, "Blue Shirt"); 

B. partList.putAbsent(key, "Blu Shirt") 

C. partList.putIfNotLocked (key, "Blue Shirt"); 

D. partList.putAtomic (key, "Blue Shirt"); 

E. if (!partlist.containsKey(key)) partList.put(key, "Blue Shirt"); 

Answer: E 

Explanation: The containsKey method returns true if this map maps one or more keys to 

the specified value. 

So this statement adds a new key if they key is not present. 

Reference: Class ConcurrentHashMap<K,V> 

Q50. Which two statements are true? 

A. Implementing a DAO often includes the use of factory. 

B. To be implemented properly, factories rely on the private keyword. 

C. Factories are an example of the OO principle "program to an interface." 

D. Using factory prevents your replication from being tightly coupled with a specific Singleton 

E. One step in implementing a factory is to add references from all the classes that the factory will merge. 

Answer: A,C 

Explanation: A: The DAO design pattern completely hides the data access implementation from its clients. The interfaces given to client does not changes when the underlying data source mechanism changes. this is the capability which allows the DAO to adopt different access scheme without affecting to business logic or its clients. generally it acts as a adapter between its components and database. The DAO design pattern consists of some factory classes, DAO interfaces and some DAO classes to implement those interfaces. 

C: The essence of the Factory method Pattern is to "Define an interface for creating an object, but let the classes which implement the interface decide which class to instantiate. The Factory method lets a class defer instantiation to subclasses." 

Note: The factory method pattern is an object-oriented design pattern to implement the concept of factories. Like other creational patterns, it deals with the problem of creating objects (products) without specifying the exact class of object that will be created. The creation of an object often requires complex processes not appropriate to include within a composing object. The object's creation may lead to a significant duplication of code, may require information not accessible to the composing object, may not provide a sufficient level of abstraction, or may otherwise not be part of the composing object's concerns. The factory method design pattern handles these problems by defining a separate method for creating the objects, whichsubclasses can then override to specify the derived type of product that will be created. Some of the processes required in the creation of an object include determining which object to create, managing the lifetime of the object, and managing specialized build-up and tear-down concerns of the object.