Exam Code: 1Z0-809
Exam Questions: 469
Java SE 8 Programmer II
Updated: 15 Jul, 2026
Viewing Page : 1 - 47
Practicing : 1 - 5 of 469 Questions
Question 1

Given the code fragment:Stream 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

Question 2

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.ListIterator;6.  7. public class Test {8.     public static void main(String[] args) {9.         List list = Arrays.asList("T", "S", "R", "I", "F");10.         ListIterator iter = list.listIterator(2);11.         while(iter.hasNext()) {12.             System.out.print(iter.next());13.         }14.     }15. }What will be the result of compiling and executing Test class?

Options :
Answer: B

Question 3

Given the code fragment:List colors = Arrays.asList(“red”, “green”, “yellow”);Predicate 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 4

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 5

Below is the code of Test.java file:1. package com.udayan.ocp;2.  3. class Outer {4.     static class Inner {5.         static void greetings(String s) {6.             System.out.println(s);7.         }8.     }9. }10.  11. public class Test {12.     public static void main(String[] args) {13.         /*INSERT*/14.     }15. }Which of the following 2 options can replace /*INSERT*/ such that there on executing class Test, output is: HELLO!?

Options :
Answer: A,C

Viewing Page : 1 - 47
Practicing : 1 - 5 of 469 Questions

© Copyrights FreePDFQuestions 2026. All Rights Reserved

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