Leads4pass > Oracle > Oracle Certifications > 1Z0-816 > 1Z0-816 Online Practice Questions and Answers

1Z0-816 Online Practice Questions and Answers

Questions 4

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 5

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?

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 6

Which code fragment prints 100 random numbers?

A. Option A

B. Option B

C. Option C

D. Option D

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: Which statement is equivalent to line 1?

A. double totalSalary = list.stream().map(e -> e.getSalary() * ratio).reduce(bo).ifPresent (p -> p.doubleValue());

B. double totalSalary = list.stream().mapToDouble(e -> e.getSalary() * ratio).sum;

C. double totalSalary = list.stream().map(Employee::getSalary * ratio).reduce(bo).orElse(0.0);

D. double totalSalary = list.stream().mapToDouble(e -> e.getSalary() * ratio).reduce(starts, bo);

Buy Now
Questions 9

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 10

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 11

Given: What will secure this code from a potential Denial of Service condition?

A. After Line 4, add indexReader.close().

B. On Line 3, enclose processData(dataReader) with try with resources.

C. After Line 3, add dataReader.close().

D. On Line 1, use try with resources when opening each dataReader.

E. Before Line 1, check the size of dataFiles to make sure it does not exceed a threshold.

Buy Now
Questions 12

Which three annotation uses are valid? (Choose three.)

A. Function func = (@NonNull x) -> x.toUpperCase();

B. var v = "Hello" + (@Interned) "World"

C. Function func = (var @NonNull x) -> x.toUpperCase();

D. Function func = (@NonNull var x) -> x.toUpperCase();

E. var myString = (@NonNull String) str;

F. var obj = new @Interned MyObject();

Buy Now
Questions 13

Which two statements independently compile? (Choose two.)

A. List list = new ArrayList();

B. List list = new ArrayList();

C. List list = new ArrayList();

D. List list = new ArrayList();

E. List list = new ArrayList();

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

PDF (Q&A)

$49.99

VCE

$55.99

PDF + VCE

$65.99