Exam2pass
0 items Sign In or Register
  • Home
  • IT Exams
  • Guarantee
  • FAQs
  • Reviews
  • Contact Us
  • Demo
Exam2pass > Oracle > Oracle Certifications > 1Z0-816 > 1Z0-816 Online Practice Questions and Answers

1Z0-816 Online Practice Questions and Answers

Questions 4

Given the code fragment:

Path currentFile = Paths.get("/scratch/exam/temp.txt"); Path outputFile = Paths get("/scratch/exam/new.txt"); Path directory = Paths.get("/scratch/");

Files.copy(currentFile, outputFile); Files.copy(outputFile, directory); Files.delete (outputFile);

The /scratch/exam/temp.txt file exists. The /scratch/exam/new.txt and /scratch/new.txt files do not exist.

What is the result?

A. /scratch/exam/new.txt and /scratch/new.txt are deleted.

B. The program throws a FileaAlreadyExistsException.

C. The program throws a NoSuchFileException.

D. A copy of /scratch/exam/new.txt exists in the /scratch directory and /scratch/exam/new.txt is deleted.

Buy Now

Correct Answer: C

Expalanation:

Questions 5

Which two are functional interfaces? (Choose two.)

A. Option A

B. Option B

C. Option C

D. Option D

E. Option E

Buy Now

Correct Answer: CE

Reference: http://tutorials.jenkov.com/java-functional-programming/functional-interfaces.html

Questions 6

Given:

What is the result?

A. The compilation fails at line 9.

B. The compilation fails at line 2.

C. Hello World

D. The compilation fails at line 8.

Buy Now

Correct Answer: C

Questions 7

Given: Which statement on line 1 enables this code to compile?

A. Function f = n -> n * 2;

B. Function f = n -> n * 2;

C. Function f = n -> n * 2;

D. Function f = n -> n * 2;

E. Function f = n -> n * 2;

Buy Now

Correct Answer: A

Questions 8

Which code fragment compiles?

A. Option A

B. Option B

C. Option C

D. Option D

Buy Now

Correct Answer: D

Questions 9

Given:

Which is true?

A. System.out is the standard output stream. The stream is open only when System.out is called.

B. System.in cannot reassign the other stream.

C. System.out is an instance of java.io.OutputStream by default.

D. System.in is the standard input stream. The stream is already open.

Buy Now

Correct Answer: D

Reference: https://www.geeksforgeeks.org/java-lang-system-class-java/

Questions 10

Given:

You want to use the myResource class in a try-with-resources statement. Which change will accomplish this?

A. Extend AutoCloseable and override the close method.

B. Implement AutoCloseable and override the autoClose method.

C. Extend AutoCloseable and override the autoClose method.

D. Implement AutoCloseable and override the close method.

Buy Now

Correct Answer: D

Reference: https://stackabuse.com/the-try-with-resources-statement-in-java/

Questions 11

Given:

This code results in a compilation error.

Which code should be inserted on line 1 for a successful compilation?

A. Consumer consumer = msg -> { return System.out.print(msg); };

B. Consumer consumer = var arg -> {System.out.print(arg);};

C. Consumer consumer = (String args) -> System.out.print(args);

D. Consumer consumer = System.out::print;

Buy Now

Correct Answer: D

Questions 12

Given:

After which line can we insert assert i < 0 || values[i] <= values[i + 1]; to verify that the values array is partially sorted?

A. after line 8

B. after line 6

C. after line 5

D. after line 10

Buy Now

Correct Answer: B

Questions 13

Given: When run and all three files exist, what is the state of each reader on Line 1?

A. All three readers are still open.

B. All three readers have been closed.

C. The compilation fails.

D. Only reader1 has been closed.

Buy Now

Correct Answer: C

Exam Code: 1Z0-816
Exam Name: Java SE 11 Programmer II
Last Update: May 29, 2026
Questions: 80

PDF (Q&A)

$45.99
ADD TO CART

VCE

$49.99
ADD TO CART

PDF + VCE

$59.99
ADD TO CART

Exam2Pass----The Most Reliable Exam Preparation Assistance

There are tens of thousands of certification exam dumps provided on the internet. And how to choose the most reliable one among them is the first problem one certification candidate should face. Exam2Pass provide a shot cut to pass the exam and get the certification. If you need help on any questions or any Exam2Pass exam PDF and VCE simulators, customer support team is ready to help at any time when required.

Home | Guarantee & Policy |  Privacy & Policy |  Terms & Conditions |  How to buy |  FAQs |  About Us |  Contact Us |  Demo |  Reviews

2026 Copyright @ exam2pass.com All trademarks are the property of their respective vendors. We are not associated with any of them.