Java Thread Quiz

Test your knowledge of Java threading concepts including thread lifecycle, Runnable interface, and key methods like start(), run(), wait(), and notify()

8 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

What is the name of the method used to start a thread execution?

  1. init();
  2. start();
  3. run();
  4. resume();
Question 2 Multiple Choice (Single Answer)

Which cannot directly cause a thread to stop executing?

  1. Calling the SetPriority() method on a Thread object.
  2. Calling the wait() method on an object.
  3. Calling notify() method on an object.
  4. Calling read() method on an InputStream object.
Question 3 Multiple Choice (Single Answer)

Which of the following will directly stop the execution of a Thread?

  1. wait()
  2. notify()
  3. notifyall()
  4. exits synchronized code
Question 4 Multiple Choice (Single Answer)

Which method must be defined by a class implementing the java.lang.Runnable interface?

  1. void run()
  2. public void run()
  3. public void start()
  4. void run(int priority)
Question 5 Multiple Choice (Single Answer)

Which will contain the body of the thread?

  1. run();
  2. start();
  3. stop();
  4. main();
Question 6 Multiple Choice (Single Answer)

Which method registers a thread in a thread scheduler?

  1. run();
  2. construct();
  3. start();
  4. register();
Question 7 Multiple Choice (Single Answer)

Which of the following will not directly cause a thread to stop?

  1. notify()
  2. wait()
  3. InputStream access
  4. sleep()
Question 8 Multiple Choice (Single Answer)

Which class or interface defines the wait(), notify(),and notifyAll() methods?

  1. Object
  2. Thread
  3. Runnable
  4. Class