exam questions

Exam 1z0-809 All Questions

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

Exam 1z0-809 topic 1 question 73 discussion

Actual exam question from Oracle's 1z0-809
Question #: 73
Topic #: 1
[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?

  • A. The program prints Call Call and terminates.
  • B. The program prints Call Call and does not terminate.
  • C. A compilation error occurs at line n1.
  • D. An ExecutionException is thrown at run time.
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
asdfjhfgjuaDCV
4 months, 3 weeks ago
B is the correct answer
upvoted 1 times
...
steefaand
5 months, 3 weeks ago
Selected Answer: B
B is true as ExecutorService is not shut down.
upvoted 1 times
...
MahdiHamdii
1 year, 7 months ago
Selected Answer: B
The program prints Call Call and does not terminate because there isn't an es.shutdown().
upvoted 2 times
...
WilsonKKerll
2 years, 4 months ago
Answer is B.
upvoted 2 times
...
Svetleto13
3 years, 3 months ago
B,tested
upvoted 3 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