1Z0-804 | The Secret of Oracle 1Z0-804 braindumps


Q21. Given: 

What is the result? 

A. Nice to see you,be fine 

B. Nice,see you,be fine 

C. Nice,see you, to, be fine 

D. Nice, see you, be fine 

E. Nice to see y, u, be fine 

Answer:

Explanation: 

The text ",to," is replaced by the "," 

Q22. Select four examples that initialize a NumberFormat reference using a factory. 

A. NumberFormat nf1 = new DecimalFormat(); 

B. NumberFormat nf2 = new DecimalFormat("0.00") ; C. NumberFormat nf3 = NumberFormat.getInstance(); 

D. NumberFormat nf4 = NumberFormat.getIntegerInstance(); 

E. NumberFormat nf5 = DecimalFormat.getNumberInstance (); 

F. NumberFormat nf6 = NumberFormat.getCurrencyInstance () ; 

Answer: C,D,E,F 

Explanation: 

getInstance 

public static finalNumberFormatgetInstance() 

Returns the default number format for the current default locale. The default format is one 

of the styles 

provided by the other factory methods: getNumberInstance(E), getIntegerInstance(D), 

getCurrencyInstance(F) 

or getPercentInstance. Exactly which one is locale dependant. 

C: To obtain a NumberFormat for a specific locale, including the default locale, call one of NumberFormat'sfactory methods, such as getInstance(). E:To obtain standard formats for a given locale, use the factory methods on NumberFormat such asgetNumberInstance. These factories will return the most appropriate sub-class of NumberFormat for a givenlocale. F:To obtain standard formats for a given locale, use the factory methods on NumberFormat such asgetInstance or getCurrencyInstance. 

Reference:java.textClass NumberFormat 

Q23. When using the default file system provider with a JVM running on a DOS-based file system, which statementis true? 

A. DOS file attributes can be read as a set in a single method call. 

B. DOS file attributes can be changed as a set in a single method call. 

C. DOS file attributes can be modified for symbolic links and regular files. 

D. DOS file attributes can be modified in the same method that creates the file. 

Answer:

Explanation: 

File attributes associated with a file in a file system that supports legacy "DOS" attributes. 

Usage Example: 

Path file = ... 

DosFileAttributes attrs = Files.readAttributes(file, DosFileAttributes.class); 

Note: 

The methodreadAttributes() reads a file's attributes as a bulk operation. 

Q24. Given: What is the result? 

A. Null 

B. class java.lang.ArraylndexOutOfBoundsException 

C. class java.lang.NullPointerException 

D. class java.lang.Exception 

E. Compilation fails. 

Answer:

Explanation: 

error: incompatible types e = new Exception(); required: RuntimeException found: Exception 

Q25. Given the directory structure that contains three directories: company, Salesdat, and Finance: 

Company 

-Salesdat 

* Target.dat 

-Finance 

Salary.dat 

Annual.dat 

And the code fragment: If Company is the current directory, what is the result? 

A. Prints only Annual.dat 

B. Prints only Salesdat, Annual.dat 

C. Prints only Annual.dat, Salary.dat, Target.dat 

D. Prints at least Salesdat, Annual.dat, Salary.dat, Target.dat 

Answer:

Explanation: 

IF !! return FileVisitResult.CONTINUE; 

The pattern *dat will match the directory name Salesdat and it will also match the file 

Annual.dat. 

It will not be matched to Target.dat which is in a subdirectory. 

Q26. Given the code fragment: What is the result? 

A. Null B D 

B. Null B null D 

C. B D 

D. D 

E. An exception is thrown at runtime 

Answer:

Q27. Which code fragment is required to load a JDBC 3.0 driver? 

A. DriverManager.loadDriver ("org.xyzdata.jdbc.NetworkDriver"); 

B. Class.forName("org.xyzdata.jdbc-NetworkDriver"); 

C. Connection con = Connection.getDriver ("jdbc:xyzdata://localhost:3306/EmployeeDB"); 

D. Connection con = DriverManager.getConnection ("jdbc:xyzdata://localhost:3306/EmployeeDB"); 

Answer:

Explanation: 

In previous versions (prior to 4.0) of JDBC, to obtain a connection, you first had to initialize 

your JDBCdriver by calling the method Class.forName. This methods required an object of 

type java.sql.Driver. 

Note: 

DriverManager: This fully implemented class connects an application to a data source, 

which is specified by adatabase URL. When this class first attempts to establish a 

connection, it automatically loads any JDBC 4.0drivers found within the class path. Note 

that your application must manually load any JDBC drivers prior toversion 4.0. 

Q28. Given: 

What is the result? 

A. false salesquarter . . qtrlreport.txt 

B. false quarter . . qtrlreport.txt 

C. true . . . . . . annualreport.txt 

D. true . . . . annualreport.txt 

Answer:

Explanation: 

( richtig !! import java.nio.file.Path; import java.nio.file.Paths; ) original-Aufgabe war ( falsch >> import java.io.file.Path; import java.io.file.Paths; ) The relativize method that can be used to construct a relative path between two paths. relativize Path relativize(Path other) Constructs a relative path between this path and a given path. Parameters:other - the path to relativize against this path Returns:the resulting relative path, or an empty path if both paths are equal Note: Relativization is the inverse of resolution. This method attempts to construct a relative path that when resolvedagainst this path, yields a path that locates the same file as the given path. For18example, on UNIX, if this path is "/a/b" and the given path is "/a/b/c/d" then the resulting relative path would be"c/d". Where this path and the given path do not have a root component, then a relative path can beconstructed. A relative path cannot be constructed if only one of the paths have a root component. Where bothpaths have a root component then it is implementation dependent if a relative path can be constructed. If thispath and the given path are equal then an empty path is returned. For any two normalized paths p and q, where q does not have a root component,p.relativize(p.resolve(q)).equals(q) When symbolic links are supported, then whether the resulting path, when resolved against this path, yields apath that can be used to locate the same file as other is implementation dependent. For example, if this path is"/a/b" and the given path is "/a/x" then the resulting relative path may be "../x". If "b" is a symbolic link then isimplementation dependent if "a/b/../x" would locate the same file as "/a/x". 

Q29. Given the incomplete pseudo-code for a fork/join framework application: 

And given the missing methods: Process, submit, and splitInHalf Which three insertions properly complete the pseudo-code? 

A. Insert submit at line X. 

B. Insert splitInHalf at line X. 

C. Insert process at line X. 

D. Insert process at line Y. 

E. Insert splitInHalf at line Y. 

F. Insert process at line Z. 

G. Insert submit at line Z. 

Answer: C,E,G 

Explanation: 

C: If data is small enough then process it. Line X 

E: If data is not small enough then split it half. Line Y 

G: After the data has been split (line Y) then recursively submit the splitted data (Line z). 

Q30. Given the code fragment: 

What is the result when the result.txt file already exists in c:student? 

A. The program replaces the file contents and the file's attributes and prints Equal. 

B. The program replaces the file contents as well as the file attributes and prints Not equal. 

C. An UnsupportedOperationException is thrown at runtime. 

D. The program replaces only the file attributes and prints Not equal. 

Answer:

Explanation: 

Assuming there is a file D:\faculty\report.txt then this file will be copied and will be replacing C:\student\report.txt.