Labour Day Sale Limited Time 60% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: 713PS592

Note! The 1z0-816 Exam is no longer available. Get in touch with our Live Chat or email us for more information about the 1z0-819 Exam.

1z0-816 Java SE 11 Programmer II 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.txtfile exists. The/scratch/exam/new.txt and/scratch/new.txtfiles do not exist.

What is the result?

Options:

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
Questions 5

Given:

1z0-816 Question 5

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

values array is partially sorted?

Options:

A.

after line 8

B.

after line 6

C.

after line 5

D.

after line 10

Buy Now
Questions 6

Given:

1z0-816 Question 6

Which two are correct? (Choose two.)

1z0-816 Question 6

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Buy Now
Questions 7

Given:

1z0-816 Question 7

Assume the file on path does not exist. What is the result?

Options:

A.

The compilation fails.

B.

/u01/work/filestore.txt is not deleted.

C.

Exception

D.

/u01/work/filestore.txt is deleted.

Buy Now
Questions 8

Given the code fragment:

Path source = Paths.get(“/repo/a/a.txt”);

Path destination = Paths.get(“/repo”);

Files.move(source, destination); // line 1

Files.delete (source); // line 2

Assuming thesourcefile anddestinationfolder exist, what Is the result?

Options:

A.

A java.nio.file.FileAlreadyExistsException is thrown on line 1.

B.

A java.nio.file.NoSuchFileException is thrown on line 2.

C.

A copy of /repo/a/a.txt is moved to the /repo directory and /repo/a/a.txt is deleted.

D.

a.txt is renamed repo.

Buy Now
Questions 9

Given:

1z0-816 Question 9

Which one is correct?

Options:

A.

An IllegalThreadStateException is thrown at run time.

B.

Three threads are created.

C.

The compilation fails.

D.

Four threads are created.

Buy Now
Questions 10

Given:

var fruits = List.of(“apple”, “orange”, “banana”, “lemon”);

You want to examine the first element that contains the character n. Which statement will accomplish this?

Options:

A.

String result = fruits.stream().filter(f −> f.contains(“n”)).findAny();

B.

fruits.stream().filter(f −> f.contains(“n”)).forEachOrdered(System.out::print);

C.

Optional result = fruits.stream().filter(f −> f.contains (“n”)).findFirst ();

D.

Optional result = fruits.stream().anyMatch(f −> f.contains(“n”));

Buy Now
Questions 11

Given:

1z0-816 Question 11

Which two are correct? (Choose two.)

Options:

A.

The output will be exactly 2 1 3 4 5.

B.

The program prints 1 4 2 3, but the order is unpredictable.

C.

Replacing forEach() with forEachOrdered(), the program prints 2 1 3 4 5, but the order is unpredictable.

D.

Replacing forEach() with forEachOrdered(), the program prints 1 2 3 4 5.

E.

Replacing forEach() with forEachOrdered(), the program prints 2 1 3 4 5.

Buy Now
Questions 12

A bookstore's sales are represented by a list ofSaleobjects populated with the name of the customer and the books they purchased.

public class Sale {

private String customer;

private List items;

// constructor, setters and getters not shown

}

public class Book {

private String name;

private double price;

// constructor, setters and getters not shown

}

Given a list ofSaleobjects,tList, which code fragment creates a list of total sales for each customer in ascending order?

1z0-816 Question 12

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Buy Now
Exam Code: 1z0-816
Exam Name: Java SE 11 Programmer II
Last Update: Apr 14, 2023
Questions: 80