Hi guys,
I noticed a typo error on a question in one of the mock exam questions in the book: OCP Oracle Certified Professional
Java SE8 Programmer II Study Guide by Jeanne Boyarsky and Scott Selikoff.
tb067900.JaSE8PrgIISG.be3.48. What is the result of executing the following application? (Choose all that apply.)
A. It outputs Salad bar empty exactly once.
B. It outputs Salad bar empty multiple times.
C. The code will not compile because of line r1.
D. The code will not compile because of line r2.
E. The code will not compile because of line r3.
F. It compiles but throws an exception at runtime.
G. It compiles but waits forever at runtime.
The answer is as follows:
The code compiles without issue, so C, D, and E are incorrect. The limit of the cyclic barrier is 4, and since we are sending 12 tasks to it, it is activated a total of three times. Therefore, B is the correct answer, and A, F, and G are incorrect. Note that the
thread pool is also 4, which means that we have just enough threads to break the barrier. For example, if our thread pool was 3, then the barrier would never be reached and G would be the correct answer.
The correct answer is only option B, not multi choice so I think should be removed (Choose all that apply.).
The choice type was radio-button(choose only one) in the question.