Oracle
1Z0-805 · Question #56
1Z0-805 Question #56: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-805 to reveal the answer and full explanation for question #56. The question stem and answer options stay visible for context.
Question
Given the following incorrect program: class MyTask extends RecursiveTask<Integer> { final int low; final int high; static final int THRESHOLD = /* . . . / MyTask (int low, int high) { this.low = low; this.high = high; } Integer computeDirectly()/ . . . */ protected void compute() { if (high ?low<;= THRESHOLD) return computeDirectly(); int mid = (low + high) / 2; invokeAll(new MyTask(low, mid), new MyTask(mid, high)); Which two changes make the program work correctly?
Options
- AResults must be retrieved from the newly created MyTask Instances and combined.
- BThe THRESHOLD value must be increased so that the overhead of task creation does not dominate
- CThe midpoint computation must be altered so that it splits the workload in an optimal manner.
- DThe compute () method must be changed to return an Integer result.
- EThe computeDirectly () method must be enhanced to fork () newly created tasks.
- FThe MyTask class must be modified to extend RecursiveAction instead of RecursiveTask.
Unlock 1Z0-805 to see the answer
You've previewed enough free 1Z0-805 questions. Unlock 1Z0-805 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.