Free Oracle 1Z0-809 Exam Questions

Become Oracle Certified with updated 1Z0-809 exam questions and correct answers

Page:    1 / 94      
Total 469 Questions | Updated On: Jun 16, 2025
Add To Cart
Question 1

Given:

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


Answer: B
Question 2

Consider the code of Greet.java file:

1. package com.udayan.ocp;

2.  

3. public final class Greet {

4.     private String msg;

5.     public Greet(String msg) {

6.         this.msg = msg;

7.     }

8.  

9.     public String getMsg() {

10.         return msg;

11.     }

12.  

13.     public void setMsg(String msg) {

14.         this.msg = msg;

15.     }

16. }

Is Greet class an immutable class?


Answer: B
Question 3

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.function.Predicate;

6.  

7. public class Test {

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

9.         List list = Arrays.asList(-80, 100, -40, 25, 200);

10.         Predicate predicate = num -> {

11.             int ctr = 1;

12.             boolean result = num > 0;

13.             System.out.print(ctr++ + ".");

14.             return result;

15.         };

16.         

17.         list.stream().filter(predicate).findFirst();

18.     }

19. }

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


Answer: D
Question 4

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?


Answer: B
Question 5

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?


Answer: A
Page:    1 / 94      
Total 469 Questions | Updated On: Jun 16, 2025
Add To Cart

© Copyrights DumpsCertify 2025. All Rights Reserved

We use cookies to ensure your best experience. So we hope you are happy to receive all cookies on the DumpsCertify.