EXPERTY DESIGNED 1Z0-809 PRACTICE TEST

Oracle 1Z0-809 Exam Questions
Total Questions: 469
Java SE 8 Programmer II
Updated On: Sep 09, 2025
Page : 1-47
Question 1

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. class Person {

8.     private String firstName;

9.     private String lastName;

10.  

11.     public Person(String firstName, String lastName) {

12.         this.firstName = firstName;

13.         this.lastName = lastName;

14.     }

15.  

16.     public String getFirstName() {

17.         return firstName;

18.     }

19.  

20.     public String getLastName() {

21.         return lastName;

22.     }

23.  

24.     public String toString() {

25.         return "{" + firstName + ", " + lastName + "}";

26.     }

27. }

28.  

29. public class Test {

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

31.         List list = Arrays.asList(

32.                 new Person("Tom", "Riddle"),

33.                 new Person("Tom", "Hanks"),

34.                 new Person("Yusuf", "Pathan"));

35.         list.stream().sorted(Comparator.comparing(Person::getFirstName).reversed()

36.                 .thenComparing(Person::getLastName)).forEach(System.out::println);

37.     }

38. }

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

Options :
Answer: A

Question 2

Given:

Untitled1-page69-image37
and the code fragment:
Untitled1-page69-image36
Which two code fragments, when inserted at line n1 independently, enable the code to print
TruckCarBike?

Options :
Answer: A,D

Question 3

Given:

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

Options :
Answer: B

Question 4

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 –da option?

Options :
Answer: A

Question 5

Given the code fragment:
List<String> empDetails = Arrays.asList(“100, Robin, HR”,
 “200, Mary, AdminServices”,
 “101, Peter, HR”);
empDetails.stream()
 .filter(s-> s.contains(“1”))
 .sorted()
 .forEach(System.out::println); //line n1
What is the result?

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.