nerdexam
Oracle

1Z0-804 · Question #87

Give: What is the likely result?

The correct answer is D. The program goes into an infinite loop. join() does not proceed until the task's result has been computed. Here we start to wait beforedoing the computing. The code will not finish.

Concurrency

Question

Give:

What is the likely result?

Exhibit

1Z0-804 question #87 exhibit

Options

  • AThe program produces the correct result, with similar performance to the original.
  • BThe program produces the correct result, with performance degraded to the equivalent of being
  • CThe program produces an incorrect result.
  • DThe program goes into an infinite loop.
  • EAn exception is thrown at runtime.
  • FThe program produces the correct result, with better performance than the original.

How the community answered

(21 responses)
  • A
    5% (1)
  • C
    5% (1)
  • D
    81% (17)
  • F
    10% (2)

Explanation

join() does not proceed until the task's result has been computed. Here we start to wait beforedoing the computing. The code will not finish.

Topics

#infinite loop#thread safety#concurrency bugs#shared state

Community Discussion

No community discussion yet for this question.

Full 1Z0-804 Practice