Pass4itsure > Oracle > Oracle Java > 1Z0-816 > 1Z0-816 Online Practice Questions and Answers

1Z0-816 Online Practice Questions and Answers

Questions 4

Given:

Which two interfaces can be used in lambda expressions? (Choose two.)

A. MyInterface1

B. MyInterface3

C. MyInterface5

D. MyInterface2

E. MyInterface4

Buy Now
Questions 5

Given: Which one is correct?

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 6

Given:

What is the output?

A. null

B. A NoSuchElementException is thrown at run time.

C. Duke

D. A NullPointerException is thrown at run time.

Buy Now
Questions 7

var numbers = List.of(0,1,2,3,4,5,6,7,8,9);

You want to calculate the average of numbers.

Which two codes will accomplish this? (Choose two.)

A. double avg = numbers.stream().parallel().averagingDouble(a -> a);

B. double avg = numbers.parallelStream().mapToInt (m -> m).average().getAsDouble();

C. double avg = numbers.stream().mapToInt (i -> i).average().parallel();

D. double avg = numbers.stream().average().getAsDouble();

E. double avg = numbers.stream().collect(Collectors.averagingDouble(n -> n));

Buy Now
Questions 8

Given:

and

What is the result?

A. A NullPointerException is thrown at run time.

B. The compilation fails.

C. 1 Null null

D. 1

E. A ClassCastException is thrown at run time.

Buy Now
Questions 9

Which statement about a functional interface is true?

A. It must be defined with the public access modifier.

B. It must be annotated with @FunctionalInterface.

C. It is declared with a single abstract method.

D. It is declared with a single default method.

E. It cannot have any private methods and static methods.

Buy Now
Questions 10

Given:

Which two are correct? (Choose two.)

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 11

Given:

Which is true about line 1?

A. If the value is not present, a NoSuchElementException is thrown at run time.

B. It always executes the System.out::print statement.

C. If the value is not present, a NullPointerException is thrown at run time.

D. If the value is not present, nothing is done.

Buy Now
Questions 12

Which two statements set the default locale used for formatting numbers, currency, and percentages? (Choose two.)

A. Locale.setDefault(Locale.Category.FORMAT, "zh-CN");

B. Locale.setDefault(Locale.Category.FORMAT, Locale.CANADA_FRENCH);

C. Locale.setDefault(Locale.SIMPLIFIED_CHINESE);

D. Locale.setDefault("en_CA");

E. Locale.setDefault("es", Locale.US);

Buy Now
Questions 13

Given: Which annotation should be used to remove warnings from compilation?

A. @SuppressWarnings on the main and print methods

B. @SuppressWarnings("unchecked") on main and @SafeVarargs on the print method

C. @SuppressWarnings("rawtypes") on main and @SafeVarargs on the print method

D. @SuppressWarnings("all") on the main and print methods

Buy Now
Exam Code: 1Z0-816
Exam Name: Java SE 11 Programmer II
Last Update: May 01, 2024
Questions: 80
10%OFF Coupon Code: SAVE10

PDF (Q&A)

$45.99

VCE

$49.99

PDF + VCE

$59.99