Java Thread Quiz
Test your knowledge of Java threading concepts including thread lifecycle, Runnable interface, and key methods like start(), run(), wait(), and notify()
Questions
Question 1 Multiple Choice (Single Answer)
What is the name of the method used to start a thread execution?
- init();
- start();
- run();
- resume();
Question 2 Multiple Choice (Single Answer)
Which cannot directly cause a thread to stop executing?
- Calling the SetPriority() method on a Thread object.
- Calling the wait() method on an object.
- Calling notify() method on an object.
- 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?
- wait()
- notify()
- notifyall()
- exits synchronized code
Question 4 Multiple Choice (Single Answer)
Which method must be defined by a class implementing the java.lang.Runnable interface?
- void run()
- public void run()
- public void start()
- void run(int priority)
Question 5 Multiple Choice (Single Answer)
Which will contain the body of the thread?
- run();
- start();
- stop();
- main();
Question 6 Multiple Choice (Single Answer)
Which method registers a thread in a thread scheduler?
- run();
- construct();
- start();
- register();
Question 7 Multiple Choice (Single Answer)
Which of the following will not directly cause a thread to stop?
- notify()
- wait()
- InputStream access
- sleep()
Question 8 Multiple Choice (Single Answer)
Which class or interface defines the wait(), notify(),and notifyAll() methods?
- Object
- Thread
- Runnable
- Class