MCQ- Java multithreading multiple choice questions with answers and explanation. 50% of the MCQ on multithreading in java are asked in interviews. But, additional objective questions have been added to cover java thread concept.

Q) In java multi-threading, a thread can be created by
  1. Extending Thread class
  2. Implementing Runnable interface
  3. Using both
  4. None

Answer: 3
In java multi-threaded program, a thread can be created using both by extending Thread class and Implementing Runnable interface. Read thread java example using both thread class and runnable interface .


Q) Which method is called internally by Thread start() method?
  1. execute()
  2. run()
  3. launch()
  4. main()

Answer: 2
Thread start() method internally calls run() method. All statements inside the run method is get executed by the thread.


Q) What is maximum thread priority in Java
  1. 10
  2. 12
  3. 5
  4. 8

Answer: 1


Q) Which method must be implemented by a Java thread?
  1. run()
  2. execute()
  3. start()
  4. None

Answer: 1


Q) Number of threads in below java program is
public class ThreadExtended extends Thread {

	public void run() {
		System.out.println("\nThread is running now\n");
	}

	public static void main(String[] args) {

		ThreadExtended threadE = new ThreadExtended();

		threadE.start();
	}
}
  1. 0
  2. 1
  3. 2
  4. 3

Answer: 3 : 2 threads are there.
Main program is also run as a thread. And, program has created one child thread. Hence, total 2 threads are there in the program.


Related Posts