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:
class UserException extends Exception { }
class AgeOutOfLimitException extends UserException { }
and the code fragment:
class App {
 public void doRegister(String name, int age)
 throws UserException, AgeOutOfLimitException {
 if (name.length () < 6) {
 throw new UserException ();
 } else if (age >= 60) {
 throw new AgeOutOfLimitException ();
 } else {
 System.out.println(“User is registered.”);
 }
 }
 public static void main(String[ ] args) throws UserException {
 App t = new App ();
 t.doRegister(“Mathew”, 60);
 }
}
What is the result?

Options :
Answer: B

Question 2

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: C

Question 3

Given code of Test.java file: 

1. package com.udayan.ocp;

2.  

3. import java.util.Arrays;

4. import java.util.Comparator;

5. import java.util.List;

6.  

7. public class Test {

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

9.         List list = Arrays.asList(10, 20, 8);

10.         

11.         System.out.println(list.stream().max(Comparator.comparing(a -> a)).get()); //Line 1

12.  

13.         System.out.println(list.stream().max(Integer::compareTo).get()); //Line 2

14.  

15.         System.out.println(list.stream().max(Integer::max).get()); //Line 3

16.     }

17. }

Which of the following statement is true?

Options :
Answer: C

Question 4

Given code of Test.java file: 

1. package com.udayan.ocp;

2.  

3. import java.time.*;

4.  

5. public class Test {

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

7.         System.out.println(Duration.ofDays(-2));

8.     }

9. }

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

Options :
Answer: D

Question 5

Given code of Test.java file:

package com.udayan.ocp;

 

import java.util.Arrays;

import java.util.List;

 

public class Test {

    public static void main(String[] args) {

        List list = Arrays.asList("A", "E", "I", "O");

        list.add("U");

        list.forEach(System.out::print);

    }

}

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

Options :
Answer: B

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