×

Special Offer! Sale of the Month | Extra 20% OFF - Ends In Coupon code: TEL20

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: Aug 21, 2019
Add To Cart
Question 1

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
Question 2

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?


Answer: A
Question 3

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?


Answer: A
Question 4

Given code of Test.java file: 

package com.udayan.ocp;

import java.util.concurrent.*;

public class Test {

    public static void main(String[] args) throws InterruptedException, ExecutionException {

        ExecutorService es = Executors.newSingleThreadExecutor();

        Future f = es.submit(() -> "HELLO");

        System.out.println(f.get());

        es.shutdown();

    }

}

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


Answer: B
Question 5

Given code of Test.java file: 

1. package com.udayan.ocp;

2.  

3. import java.util.ArrayDeque;

4. import java.util.Deque;

5.  

6. public class Test {

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

8.         Deque deque = new ArrayDeque<>();

9.         deque.push(new Boolean("abc"));

10.         deque.push(new Boolean("tRuE"));

11.         deque.push(new Boolean("FALSE"));

12.         deque.push(true);

13.         System.out.println(deque.pop() + ":" + deque.peek() + ":" + deque.size());

14.     }

15. }

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


Answer: A
Page:    1 / 94      
Total 469 Questions | Updated On: Aug 21, 2019
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.