EXPERTY DESIGNED 1Z0-809 PRACTICE TEST

Oracle 1Z0-809 Exam Questions
Total Questions: 469
Java SE 8 Programmer II
Updated On: Nov 10, 2025
Page : 1-47
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?

Options :
Answer: A

Question 2

Given code of Test.java file: 

1. package com.udayan.ocp;

2.  

3. public class Test {

4.     private static void div(int i, int j) {

5.         try {

6.             System.out.println(i / j);

7.         } catch(ArithmeticException e) {

8.             throw (RuntimeException)e;

9.         }

10.     }

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

12.         try {

13.             div(5, 0);

14.         } catch(ArithmeticException e) {

15.             System.out.println("AE");

16.         } catch(RuntimeException e) {

17.             System.out.println("RE");

18.         }

19.     }

20. }

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

Options :
Answer: A

Question 3

Given:

Untitled1-page69-image101
From what threading problem does the program suffer?

Options :
Answer: B

Question 4

Given the code fragments:
class MyThread implements Runnable {
 private static AtomicInteger count = new AtomicInteger (0);
 public void run () {
 int x = count.incrementAndGet();
 System.out.print (x+” “);
 }
}
and
Thread thread1 = new Thread(new MyThread());
Thread thread2 = new Thread(new MyThread());
Thread thread3 = new Thread(new MyThread());
Thread [] ta = {thread1, thread2, thread3};
for (int x= 0; x < 3; x++) {
 ta[x].start();
}
Which statement is true?

Options :
Answer: A

Question 5

Given code of Test.java file: 

1. package com.udayan.ocp;

2.  

3. import java.util.ArrayDeque;

4. import java.util.Deque;

5.  

6. public class Test {

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

8.         Deque deque = new ArrayDeque<>();

9.         deque.push(new Boolean("abc"));

10.         deque.push(new Boolean("tRuE"));

11.         deque.push(new Boolean("FALSE"));

12.         deque.push(true);

13.         System.out.println(deque.pop() + ":" + deque.peek() + ":" + deque.size());

14.     }

15. }

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

Options :
Answer: A

© Copyrights Oracledumps 2025. All Rights Reserved

We use cookies to ensure that we give you the best experience on our website (Oracledumps). If you continue without changing your settings, we'll assume that you are happy to receive all cookies on the Oracledumps.