EXPERTY DESIGNED 1Z0-809 PRACTICE TEST

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

Given code of Test.java file: 

1. package com.udayan.ocp;

2.  

3. import java.util.List;

4. import java.util.Map;

5. import java.util.stream.Collectors;

6. import java.util.stream.Stream;

7.  

8. class Certification {

9.     String studId;

10.     String test;

11.     int marks;

12.  

13.     Certification(String studId, String test, int marks) {

14.         this.studId = studId;

15.         this.test = test;

16.         this.marks = marks;

17.     }

18.  

19.     public String toString() {

20.         return "{" + studId + ", " + test + ", " + marks + "}";

21.     }

22.  

23.     public String getStudId() {

24.         return studId;

25.     }

26.  

27.     public String getTest() {

28.         return test;

29.     }

30.  

31.     public int getMarks() {

32.         return marks;

33.     }

34. }

35.  

36. public class Test {

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

38.         Certification c1 = new Certification("S001", "OCA", 87);

39.         Certification c2 = new Certification("S002", "OCA", 82);

40.         Certification c3 = new Certification("S001", "OCP", 79);

41.         Certification c4 = new Certification("S002", "OCP", 89);

42.         Certification c5 = new Certification("S003", "OCA", 60);

43.         Certification c6 = new Certification("S004", "OCA", 88);

44.  

45.         Stream stream = Stream.of(c1, c2, c3, c4, c5, c6);

46.         Map> map =

47.                 stream.collect(Collectors.partitioningBy(s -> s.equals("OCA")));

48.         System.out.println(map.get(true));

49.     }

50. }

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

Options :
Answer: A

Question 2

F: is accessible for reading and below is the directory structure for F:

1. F:.

2. └───A

3.     └───B

4.         └───C

5.                 Book.java

'Book.java' file is available under 'C' directory.

Given code of Test.java file: 

1. package com.udayan.ocp;

2.  

3. import java.nio.file.Path;

4. import java.nio.file.Paths;

5.  

6. public class Test {

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

8.         Path file = Paths.get("F:\\A\\B\\Book.java");

9.         System.out.println(file.toAbsolutePath());

10.     }

11. }

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

Options :
Answer: A

Question 3

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

1. package com.udayan.ocp;

2.  

3. class M {

4.     private int num1 = 100;

5.     class N {

6.         private int num2 = 200;

7.     }

8.     

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

10.         M outer = new M();

11.         M.N inner = outer.new N();

12.         System.out.println(outer.num1 + inner.num2);

13.     }

14. }

Options :
Answer: A

Question 4

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

Question 5

Given the code fragment:
Stream<Path> files = Files.walk(Paths.get(System.getProperty(“user.home”)));
 files.forEach (fName -> { //line n1
 try {
 Path aPath = fName.toAbsolutePath(); //line n2
 System.out.println(fName + “:”
 + Files.readAttributes(aPath,
Basic.File.Attributes.class).creationTime
());
 } catch (IOException ex) {
 ex.printStackTrace();
 });
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.