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

1Z0-816 Online Practice Questions and Answers

Questions 4

Which two are functional interfaces? (Choose two.)

A. Option A

B. Option B

C. Option C

D. Option D

E. Option E

Browse 80 Q&As
Questions 5

Given:

Examine these requirements:

Eliminate code duplication.

Keep constant the number of methods other classes may implement from this interface.

Which method can be added to meet these requirements?

A. Option A

B. Option B

C. Option C

D. Option D

Browse 80 Q&As
Questions 6

Given:

What is required to make the Foo class thread safe?

A. No change is required.

B. Make the declaration of lock static.

C. Replace the lock constructor call with new ReentrantLock (true).

D. Move the declaration of lock inside the foo method.

Browse 80 Q&As
Questions 7

Which code fragment compiles?

A. Option A

B. Option B

C. Option C

D. Option D

Browse 80 Q&As
Questions 8

You are working on a functional bug in a tool used by your development organization. In your investigation, you find that the tool is executed with a security policy file containing this grant.

What action should you take?

A. Nothing, because it is an internal tool and not exposed to the public.

B. Remove the grant because it is excessive.

C. Nothing, because it is not related to the bug you are investigating.

D. File a security bug against the tool referencing the excessive permission granted.

E. Nothing, because listing just the required permissions would be an ongoing maintenance challenge.

Browse 80 Q&As
Questions 9

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);

Browse 80 Q&As
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.

Browse 80 Q&As
Questions 11

Which code is correct?

A. Runnable r = "Message" -> System.out.println();

B. Runnable r = () -> System.out::print;

C. Runnable r = () -> {System.out.println("Message");};

D. Runnable r = -> System.out.println("Message");

E. Runnable r = {System.out.println("Message")};

Browse 80 Q&As
Questions 12

Given:

When is the readObject method called?

A. before this object is deserialized

B. after this object is deserialized

C. before this object Is serialized

D. The method is never called.

E. after this object is serialized

Browse 80 Q&As
Questions 13

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.

Browse 80 Q&As
Questions 14

Given the Person class with age and name along with getter and setter methods, and this code fragment:

What will be the result?

A. Aman Tom Peter

B. Tom Aman Peter

C. Aman Peter Tom

D. Tom Peter Aman

Browse 80 Q&As
Questions 15

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);

Browse 80 Q&As
Questions 16

Given:

What is the result?

A. Orange Juice

B. The compilation fails.

C. Orange Juice Apple Pie Lemmon Ice Raspberry Tart

D. The program prints nothing.

Browse 80 Q&As
Questions 17

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();

Browse 80 Q&As
Questions 18

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

Browse 80 Q&As
Exam Code: 1Z0-816
Exam Name: Java SE 11 Programmer II
Last Update: May 01, 2024
Questions: 80 Q&As

PDF

$45.99

VCE

$49.99

PDF + VCE

$59.99