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

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 2

Given the code fragment:Untitled1-page69-image23Assume that:The required database driver is configured in the classpath.The appropriate database is accessible with the dbURL, userName, and passWord existsThe Employee table has a column ID of type integer and the SQL query matches one record.What is the result?

Options :
Answer: A

Question 3

Given code of Test.java file: 1. package com.udayan.ocp;2.  3. public class Test {4.     private static void m1() throws Exception {5.         throw new Exception();6.     }7.  8.     public static void main(String[] args) {9.         try {10.             m1();11.         } finally {12.             System.out.println("A");13.         }14.     }15. }What will be the result of compiling and executing Test class?

Options :
Answer: D

Question 4

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 5

What will be the result of compiling and executing class Test?1. package com.udayan.ocp;2.  3. class X {4.     class Y {5.         private void m() {6.             System.out.println("INNER");7.         }8.     }9.     10.     public void invokeInner() {11.         Y obj = new Y(); //Line 912.         obj.m(); //Line 1013.     }14. }15.  16. public class Test {17.     public static void main(String[] args) {18.         new X().invokeInner();19.     }20. }

Options :
Answer: 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.