1Z0-809 | 10 Tips For Renew 1Z0-809 practice test

Q61. Given: 

class Book { 

int id; 

String name; 

public Book (int id, String name) { 

this.id = id; 

this.name = name; 

public boolean equals (Object obj) { //line n1 

boolean output = false; 

Book b = (Book) obj; 

if (this.name.equals(b name))} 

output = true; 

return output; 

and the code fragment: 

Book b1 = new Book (101, “Java Programing”); 

Book b2 = new Book (102, “Java Programing”); 

System.out.println (b1.equals(b2)); //line n2 

Which statement is true? 

A. The program prints true. 

B. The program prints false. 

C. A compilation error occurs. To ensure successful compilation, replace line n1 with: boolean equals (Book obj) { 

D. A compilation error occurs. To ensure successful compilation, replace line n2 with: System.out.println (b1.equals((Object) b2)); 


Q62. 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. 

Q63. Given the code fragment: 

List<Integer> list1 = Arrays.asList(10, 20); 

List<Integer> list2 = Arrays.asList(15, 30); 

//line n1 

Which code fragment, when inserted at line n1, prints 10 20 15 30? 

A. Stream.of(list1, list2) 

.flatMap(list -> list.stream()) 

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

B. Stream.of(list1, list2) 

.flatMap(list -> list.intStream()) 

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

C. list1.stream() 

.flatMap(list2.stream().flatMap(e1 -> e1.stream()) 

.forEach(s -> System.out.println(s + “ “)); 

D. Stream.of(list1, list2) 

.flatMapToInt(list -> list.stream()) 

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


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

A. 20 

B. 25 

C. 29 

D. Compilation fails 

E. AnArrayIndexOutOfBoundsException is thrown at runtime 


Q65. Given: 

What is the result? 

A. 10 : 22 : 20 

B. 10 : 22 : 22 

C. 10 : 22 : 6 

D. 10 : 30 : 6 


Q66. Given the code fragment: 

ZonedDateTime depart = ZonedDateTime.of(2015, 1, 15, 3, 0, 0, 0, ZoneID.of(“UTC-7”)); ZonedDateTime arrive = ZonedDateTime.of(2015, 1, 15, 9, 0, 0, 0, ZoneID.of(“UTC-5”)); long hrs = ChronoUnit.HOURS.between(depart, arrive); //line n1 System.out.println(“Travel time is” + hrs + “hours”); 

What is the result? 

A. Travel time is 4 hours 

B. Travel time is 6 hours 

C. Travel time is 8 hours 

D. An exception is thrown at line n1. 


Q67. Given the for loop construct: 

for ( expr1 ; expr2 ; expr3 ) { 


Which two statements are true? 

A. This is not the only valid for loop construct; there exits another form of for loop constructor. 

B. The expression expr1 is optional. it initializes the loop and is evaluated once, as the loop begin. 

C. When expr2 evaluates to false, the loop terminates. It is evaluated only after each iteration through the loop. 

D. The expression expr3 must be present. It is evaluated after each iteration through the loop. 

Answer: B,C 


The for statement have this forms: 

for (init-stmt; condition; next-stmt) { 


There are three clauses in the for statement. 

The init-stmt statement is done before the loop is started, usually to initialize an iteration 


The condition expression is tested before each time the loop is done. The loop isn't 

executed if the boolean expression is false (the same as the while loop). 

The next-stmt statement is done after the body is executed. It typically increments an 

iteration variable. 

Q68. Given the code fragment: 

String str = “Java is a programming language”; ToIntFunction<String> indexVal = str: : indexOf; //line n1 int x = indexVal.applyAsInt(“Java”);//line n2 System.out.println(x); 

What is the result? 

A. 0 

B. 1 

C. A compilation error occurs at line n1. 

D. A compilation error occurs at line n2. 


Q69. Given the code fragment: 

BiFunction<Integer, Double, Integer> val = (t1, t2) -> t1 + t2;//line n1 

System.out.println(val.apply(10, 10.5)); 

What is the result? 

A. 20 

B. 20.5 

C. A compilation error occurs at line n1. 

D. A compilation error occurs at line n2. 


Q70. Given the content of /resourses/Message.properties: 

welcome1=”Good day!” 

and given the code fragment: 

Properties prop = new Properties (); 

FileInputStream fis = new FileInputStream (“/resources/Message.properties”); 



System.out.println(prop.getProperty(“welcome2”, “Test”));//line n1 


What is the result? 

A. Good day! 


followed by an Exception stack trace 

B. Good day! 

followed by an Exception stack trace 

C. Good day! 



D. A compilation error occurs at line n1.