Fill Preparation Gaps with Free Online 1Z0-809 Exam Practice

Exam Code: 1Z0-809
Exam Questions: 469
Java SE 8 Programmer II
Updated: 02 May, 2025
Question 1

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 2

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

Options :
Answer: C

Question 3

Given:

Untitled1-page69-image37
and the code fragment:
Untitled1-page69-image36
Which two code fragments, when inserted at line n1 independently, enable the code to print
TruckCarBike?

Options :
Answer: A,D

Question 4

Untitled1-page69-image65

What is the result?

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 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.