Free Practice Oracle 1Z0-809 Exam Questions 2025

Stay ahead with 100% Free Java SE 8 Programmer II 1Z0-809 Dumps Practice Questions

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

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!?


Answer: A,C
Question 2

Given the code fragment:

Untitled1-page69-image118
Assume that:
 The required database driver is configured in the classpath.
 The appropriate database is accessible with the dbURL, userName, and passWord exists.
 The Employee and Customer tables are available and each table has id column with a few records and
the SQL queries are valid.
What is the result of compiling and executing this code fragment?


Answer: C
Question 3

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?


Answer: A
Question 4

Given:

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


Answer: B
Question 5

Given code of Test.java file: 

1. package com.udayan.ocp;

2.  

3. public class Test {

4.     private static String msg = "Hello";

5.  

6.     private static String changeMsg(String m) {

7.         msg = m;

8.         return null;

9.     }

10.  

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

12.         if(args.length == 0) {

13.             assert false : changeMsg("Bye");

14.         }

15.         System.out.println(msg);

16.     }

17. }

What will be the result of executing Test class with below command? 

java -ea com.udayan.ocp.Test


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

© Copyrights TheExamsLab 2025. All Rights Reserved

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