Summer Special - Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: top65certs

New Release 1z0-809 Java SE Questions

Page: 10 / 16
Total 208 questions

Java SE 8 Programmer II Questions and Answers

Question 37

Given the information: The employee table has 10 records.

Given the code fragment:

What is the result?

Options:

A.

deletes the second row and prints the emp_id of the first row

B.

throws a runtime exception at Line n1

C.

deletes the first row and throws an exception at Line n2

D.

deletes the first row and prints the emp_id of the second row

Question 38

Which statement is true about the single abstract method of the java.util.function.Predicate interface?

Options:

A.

It accepts one argument and returns void.

B.

It accepts one argument and returns boolean.

C.

It accepts one argument and always produces a result of the same type as the argument.

D.

It accepts an argument and produces a result of any data type.

Question 39

The data.doc, data.txt and data.xml files are accessible and contain text.

Given the code fragment:

Stream paths = Stream.of (Paths. get(“data.doc”),

Paths. get(“data.txt”),

Paths. get(“data.xml”));

paths.filter(s-> s.toString().endWith(“txt”)).forEach(

s -> {

try {

Files.readAllLines(s)

.stream()

.forEach(System.out::println); //line n1

} catch (IOException e) {

System.out.println(“Exception”);

}

}

);

What is the result?

Options:

A.

The program prints the content of data.txt file.

B.

The program prints:Exception<>Exception

C.

A compilation error occurs at line n1.

D.

The program prints the content of the three files.

Question 40

Given the code fragment:

What is the result?

Options:

A.

4000 : 2000

B.

4000 : 1000

C.

1000 : 4000

D.

1000 : 2000

Page: 10 / 16
Total 208 questions