exam questions

Exam 1z0-809 All Questions

View all questions & answers for the 1z0-809 exam

Exam 1z0-809 topic 1 question 28 discussion

Actual exam question from Oracle's 1z0-809
Question #: 38
Topic #: 2
[All 1z0-809 Questions]

Given the code fragment:
class CallerThread implements Callable<String> {
String str;
public CallerThread(String s) {this.str=s;}
public String call() throws Exception {
return str.concat("Call");
}
}
and
public static void main (String[] args) throws InterruptedException, ExecutionException
{
ExecutorService es = Executors.newFixedThreadPool(4); //line n1
Future f1 = es.submit (newCallerThread("Call"));
String str = f1.get().toString();
System.out.println(str);
}
Which statement is true?
Call Call and terminates.

  • A. The program prints Call Call and does not terminate.
  • B. The program prints line n1.
  • C. A compilation error occurs at ExecutionException is thrown at run time.
  • D. An
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Destroyer
Highly Voted 4 years, 7 months ago
Answer is A
upvoted 7 times
...
asdfjhfgjuaDCV
Most Recent 4 months, 3 weeks ago
A is the correct answer
upvoted 1 times
...
steefaand
5 months, 3 weeks ago
Selected Answer: A
A is true.
upvoted 1 times
...
iSnover
5 months, 3 weeks ago
Selected Answer: A
Answer is A. The program prints Call Call and does not terminate. We need to call es.shutdown() at the end of the main for the program to terminate
upvoted 1 times
...
Innovation
4 years, 6 months ago
The program prints Call Call and does not terminate. we need to call es.shutdown() at the end of the main for the program to terminate
upvoted 4 times
...
M_Jawad
4 years, 6 months ago
The program prints Call Call and does not terminate. Since no shutdown related method of the ExecutorService object is called, the program does not stop execution.
upvoted 4 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago