Java Multitasking  «Prev  Next»

Java Thread States - Quiz

Each question is worth one point. Select the best answer or answers for each question.
 

1. The code
t.sleep(2000);
will
Please select the best answer.
  A. Put a thread to sleep for 2,000 seconds
  B. Put a thread to sleep for 2 seconds
  C. Not compile

2. If a thread's state becomes "not running" because its wait() method is invoked, which method needs to be invoked to test all waiting threads to see if they should wake up again?
Please select the best answer.
  A. wakeUp();
  B. notify();
  C. notifyAll();

3. A thread will end its life when:
Please select the best answer.
  A. You invoke wait() for the thread
  B. You invoke sleep() for the thread
  C. The thread's run() method ends

Your score is 0.0