New Year Special 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: save70

Java SE 1z0-809 Dumps PDF

Page: 4 / 7
Total 196 questions

Java SE 8 Programmer II Questions and Answers

Question 13

Which two statements are true about synchronization and locks? (Choose two.)

Options:

A.

A thread automatically acquires the intrinsic lock on a synchronized statement when executed.

B.

The intrinsic lock will be retained by a thread if return from a synchronized method is caused by an uncaught exception.

C.

A thread exclusively owns the intrinsic lock of an object between the time it acquires the lock and the time it releases it.

D.

A thread automatically acquires the intrinsic lock on a synchronized method’s object when entering that method.

E.

Threads cannot acquire intrinsic locks on classes.

Question 14

Given the code fragment:

Map books = new TreeMap<>();

books.put (1007, “A”);

books.put (1002, “C”);

books.put (1003, “B”);

books.put (1003, “B”);

System.out.println (books);

What is the result?

Options:

A.

{1007=A, 1003=B, 1002=C}

B.

{1007=A, 1003=B, 1003=B, 1002=C}

C.

{1007=A, 1002=C, 1003=B, 1003=B}

D.

{1002=C, 1003=B, 1007=A}

Question 15

Given:

interface Rideable {Car getCar (String name); }

class Car {

private String name;

public Car (String name) {

this.name = name;

}

}

Which code fragment creates an instance of Car?

Options:

A.

Car auto = Car (“MyCar”): : new;

B.

Car auto = Car : : new;Car vehicle = auto : : getCar(“MyCar”);

C.

Rideable rider = Car : : new;Car vehicle = rider.getCar(“MyCar”);

D.

Car vehicle = Rideable : : new : : getCar(“MyCar”);

Question 16

Given:

What is the result?

Options:

A.

–catch--finally--dostuff-

B.

–catch-

C.

–finally--catch-

D.

–finally-dostuff--catch-

Page: 4 / 7
Total 196 questions