Oracle 1Z0-809

Page:    1 / 94   
Total 469 questions | Updated On: Apr 25, 2024
Question 1

Given the code fragment:
List<String> colors = Arrays.asList(“red”, “green”, “yellow”);
Predicate<String> test = n - > {
 System.out.println(“Searching…”);
 return n.contains(“red”);
};
colors.stream()
 .filter(c -> c.length() > 3)
 .allMatch(test);
What is the result?


Answer: A
Question 2

Given code of Test.java file: 

1. package com.udayan.ocp;

2.  

3. import java.util.Arrays;

4. import java.util.List;

5. import java.util.ListIterator;

6.  

7. public class Test {

8.     public static void main(String[] args) {

9.         List list = Arrays.asList("T", "S", "R", "I", "F");

10.         ListIterator iter = list.listIterator(2);

11.         while(iter.hasNext()) {

12.             System.out.print(iter.next());

13.         }

14.     }

15. }

What will be the result of compiling and executing Test class?


Answer: B
Question 3

Given the code fragment:
List<String> colors = Arrays.asList(“red”, “green”, “yellow”);
Predicate<String> test = n - > {
 System.out.println(“Searching…”);
 return n.contains(“red”);
};
colors.stream()
 .filter(c -> c.length() >= 3)
 .allMatch(test);
What is the result?


Answer: C
Question 4

Given the code fragments:

Untitled1-page69-image83
and
Untitled1-page69-image88
What is the result?


Answer: D
Question 5

What will be the result of compiling and executing class Test?

1. package com.udayan.ocp;

2.  

3. class X {

4.     class Y {

5.         private void m() {

6.             System.out.println("INNER");

7.         }

8.     }

9.     

10.     public void invokeInner() {

11.         Y obj = new Y(); //Line 9

12.         obj.m(); //Line 10

13.     }

14. }

15.  

16. public class Test {

17.     public static void main(String[] args) {

18.         new X().invokeInner();

19.     }

20. }


Answer: C
Page:    1 / 94   
Total 469 questions | Updated On: Apr 25, 2024

Quickly grab our 1Z0-809 product now and kickstart your exam preparation today!

Name: Java SE 8 Programmer II
Exam Code: 1Z0-809
Certification: Oracle Java
Vendor: Oracle
Total Questions: 469
Last Updated: Apr 25, 2024