aiotestking uk

1Z0-809 Exam Questions - Online Test


1Z0-809 Premium VCE File

Learn More 100% Pass Guarantee - Dumps Verified - Instant Download
150 Lectures, 20 Hours

Q1. Given the code fragment: 

List<String> codes = Arrays.asList (“DOC”, “MPEG”, “JPEG”); 

codes.forEach (c -> System.out.print(c + “ “)); 

String fmt = codes.stream() 

.filter (s-> s.contains (“PEG”)) 

.reduce((s, t) -> s + t).get(); 

System.out.println(“\n” + fmt); 

What is the result? 

A. DOC MPEG JPEG MPEGJPEG 

B. DOC MPEG MPEGJPEG MPEGMPEGJPEG 

C. MPEGJPEG MPEGJPEG 

D. The order of the output is unpredictable. 

Answer:

Q2. Given the code fragment: 

public void recDelete (String dirName) throws IOException { 

File [ ] listOfFiles = new File (dirName) .listFiles(); 

if (listOfFiles ! = null && listOfFiles.length >0) { 

for (File aFile : listOfFiles) { 

if (aFile.isDirectory ()) { 

recDelete (aFile.getAbsolutePath ()); 

} else { if (aFile.getName ().endsWith (“.class”)) aFile.delete (); } } } } 

Assume that Projects contains subdirectories that contain .class files and is passed as an argument to the recDelete () method when it is invoked. 

What is the result? 

A. The method deletes all the .class files in the Projects directory and its subdirectories. 

B. The method deletes the .class files of the Projects directory only. 

C. The method executes and does not make any changes to the Projects directory. 

D. The method throws an IOException. 

Answer:

Q3. Given: 

What is the result? 

A. Null 

B. Compilation fails 

C. An exception is thrown at runtime 

D. 0 

Answer:

Q4. Which two statements are true about localizing an application? 

A. Support for new regional languages does not require recompilation of the code. 

B. Textual elements (messages and GUI labels) are hard-coded in the code. 

C. Language and region-specific programs are created using localized data. 

D. Resource bundle files include data and currency information. 

E. Language codes use lowercase letters and region codes use uppercase letters. 

Answer: A,E 

Reference: http://docs.oracle.com/javase/7/docs/technotes/guides/intl/ 

Q5. Given the code fragments: 

What is the result? 

A. Super Sub Sub 

B. Contract Contract Super 

C. Compilation fails at line n1 

D. Compilation fails at line n2 

Answer:

Q6. Given: 

public class Counter { 

public static void main (String[ ] args) { 

int a = 10; 

int b = -1; 

assert (b >=1) : “Invalid Denominator”; 

int = a / b; 

System.out.println (c); 

What is the result of running the code with the –ea option? 

A. -10 

B. 0 

C. An AssertionError is thrown. 

D. A compilation error occurs. 

Answer:

Q7. Given: 

A. Ym Xm2 

B. Ym Xm1 

C. Compilation fails 

D. A ClassCastException is thrown at runtime 

Answer:

Q8. Given: What is the result? 

A. hEllOjAvA! 

B. Hello java! 

C. Out of limits hEllOjAvA! 

D. Out of limits 

Answer:

Q9. Given: 

public class ScopeTest { 

int j, int k; 

public static void main(String[] args) { 

ew ScopeTest().doStuff(); } 

void doStuff() { 

nt x = 5; 

oStuff2(); 

System.out.println("x"); 

void doStuff2() { 

nt y = 7; 

ystem.out.println("y"); 

or (int z = 0; z < 5; z++) { 

ystem.out.println("z"); 

ystem.out.println("y"); 

Which two items are fields? 

A. j 

B. k 

C. x 

D. y 

E. z 

Answer: A,B 

Q10. Given: 

Which two classes use the shape class correctly? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

E. Option E 

F. Option F 

Answer: B,E 

Explanation: When an abstract class is subclassed, the subclass usually provides implementations for all of the abstract methods in its parent class (E). However, if it does not, then the subclass must also be declared abstract (B). Note: An abstract class is a class that is declared abstract—it may or may not include abstract methods. Abstract classes cannot be instantiated, but they can be subclassed.