QUESTION 151
Which two statements are true about the Fork/Join Framework? (Choose two.)
A. The
RecursiveTask
subclass is used when a task does not need to return a result.
B. The Fork/Join framework can help you take advantage of multicore hardware.
C. The Fork/Join framework implements a work-stealing algorithm.
D. The Fork/Join solution when run on multicore hardware always performs faster than standard sequential
solution.
Correct Answer:
AC
Section: (none)
Explanation
Explanation/Reference:
Reference:
https://www.logicbig.com/tutorials/core-java-tutorial/java-multi-threading/fork-and-join.html
QUESTION 152
Which two statements are true about synchronization and locks? (Choose two.)
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.
Correct Answer:
AB
Section: (none)
Explanation
Explanation/Reference:
Reference:
https://docs.oracle.com/javase/tutorial/essential/concurrency/locksync.html
QUESTION 153
Given the code fragment:
//line n1
Double d= str.average().getAsDouble();
System.out.println("Average= "+d);
Which should be inserted into
line n1
to print
Average = 2.5
?
A.
IntStream str = S