Exam Code: 1Z0-804 (Practice Exam Latest Test Questions VCE PDF)
Exam Name: Java SE 7 Programmer II Exam
Certification Provider: Oracle
Free Today! Guaranteed Training- Pass 1Z0-804 Exam.

2016 Nov 1z0-804 guide:

Q71. Given: 

What is the result? 

A. An exception is thrown at runtime on line 9. 

B. An exception is thrown at runtime on line 12 

C. onetwonull 

D. onetwothree 

E. twoonenull 

F. threetwoone 

Answer:

Explanation: 

addFirst void addFirst(E e) Inserts the specified element at the front of this deque if it is possible to do so immediately without violating capacity restrictions. When using a capacity-restricted deque, it is generally preferable to 

use method offerFirst 

(E). 

pollLast 

E pollLast() 

Retrieves and removes the last element of this deque, or returns null if this deque is empty. 

Returns: 

the tail of this deque, or null if this deque is empty 


Q72. Which method would you supply to a class implementing the Callable interface? 

A. callable () 

B. executable () 

C. call () 

D. run () 

E. start () 

Answer:

Explanation: 

public interface Callable<V> 

A task that returns a result and may throw an exception. Implementors define a single 

method with noarguments called call. 

Note: 

Interface Callable<V> 

Type Parameters: 

V - the result type of method call 

The Callable interface is similar to Runnable, in that both are designed for classes whose 

instances arepotentially executed by another thread. A Runnable, however, does not return 

a result and cannot throw achecked exception. 

The Executors class contains utility methods to convert from other common forms to 

Callable classes. 

Reference:java.util.concurrent 


Q73. Given: What is the result? 

A. 1 1 1 1 1 

B. 1 2 3 4 5 

C. 0 1 2 3 4 

D. 0 1 4 3 4 

Answer:

Explanation: 

first for-loop set 0 0 0 0 0 second for-loop increments each to 1 1 1 1 1 if condition is not given 


Q74. Given: 

Which two are true? 

A. Thread is printed 

B. Runnable is printed 

C. No output is produced 

D. No new threads of execution are started within the main method 

E. One new thread of execution is started within the main method 

F. Two new threads of exclusion are started within the main method 

Answer: C,D 


Q75. Given two classes in separate files: 

Which two import statements can make the a.b.parent class compliable? 

A. import a.b.c.Parent; 

B. import a.b.c.Child; 

C. import a.b.c.*; 

D. import a.b.*; 

E. import a.*; 

Answer: B,C 

Explanation: 

To import a specific member into the current file, put an import statement at the beginning of thefile before any type definitions but after the package statement, if there is one.C:To import all the types contained in a particular package, use the import statement with the asterisk (*)wildcard character. 

Reference: The Java Tutorials,Using Package Members 


Updated 1z0-804 book:

Q76. Given: 

What is the result? 

A. riding riding tolting 

B. riding riding cantering 

C. tolting cantering tolting 

D. tolting cantering cantering 

E. Compilation fails. 

F. An exception is thrown at runtime. 

Answer:

Explanation: 

The compilation fails at: 

interface Rideable { 

public String ride() { return "riding ";} 

Error due to: interface methods cannot have body. 


Q77. Given: What is the result? 

A. tolting cantering tolting 

B. cantering cantering cantering 

C. compilation fails 

D. an exception is thrown at runtime 

Answer:

Explanation: 

Compiler says: Cannot reduce the visibility of the inherited method from Rideable. müssen 

PUBLIC sein 

public String ride() { return "cantering "; } 

public String ride() { return "tolting "; } 

if this is given then the result would be: 

A : tolting cantering tolting 


Q78. Which two codes correctly represent a standard language locale code? 

A. ES 

B. FR 

C. U8 

D. Es 

E. fr 

F. u8 

Answer: A,B 

Explanation: 

Language codes are defined by ISO 639, an international standard that assigns two- and three-letter codes tomost languages of the world. Locale uses the two-letter codes to identify the target language. 


Q79. 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:


Q80. Given the code fragment: 

Which two try statements, when inserted at line ***, enable the code to successfully move the file info.txt to thedestination directory, even if a file by the same name already exists in the destination directory? 

A. try (FileChannel in = new FileInputStream (source). getChannel(); FileChannel out = 

new FileOutputStream 

(dest).getChannel()) { in.transferTo(0, in.size(), out); 

B. try ( Files.copy(Paths.get(source),Paths.get(dest)); 

Files.delete (Paths.get(source)); 

C. try ( Files.copy(Paths.get(source), 

Paths.get(dest),StandardCopyOption.REPLACE_EXISTING); Files.delete 

(Paths.get(source)); 

D. try (Files.move(Paths.get(source),Paths.get(dest)); 

E. try(BufferedReader br = Files.newBufferedReader(Paths.get(source), 

Charset.forName("UTF- 8")); 

BufferedWriter bw = Files.newBufferedWriter(Paths.get(dest), Charset.forName("UTF-8")); 

String record = 

""; 

while ((record = br.readLine()) ! = null) { 

bw.write(record); 

bw.newLine(); 

Files.delete(Paths.get(source)); 

Answer: C,E 

Explanation: 

A: copies only, don’t move operation 

B,C,D (no try-with-resource !) syntax change to: try { … 

B: throws FileAlreadyExistsException 

C: correct if syntax change to : StandardCopyOption.REPLACE_EXISTING (before 

REPLACE_Existing) 

D: throws FileAlreadyExistsException 

E: works properly if the sourcefile has the correct format, utf-8 here (else throws 

MalformedInputException) 

AND syntax is corrected to: 

try ( BufferedReader br = Files.newBufferedReader(Paths.get(source), 

Charset.forName(“UTF-8)); 

BufferedWriter bw = Files.newBufferedWriter(Paths.get(dest), Charset.forName(“UTF-8)); 

){ 

String record = “”; 

…..