Skip to main content

Threads — Part 1 MCQs with Explanations

Practice high-yield Programming & Software Development MCQs on Threads — Part 1 with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.

Questions
40
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
48 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
40

Verified Practice Questions

Interactive test mode with detailed academic worked solutions

Live Progress | 0/40 answered
✓ 0 correct ✗ 0 wrong 0% score
Question 1 of 40
★ FPSC ★ PPSC

Which of the following constructor of class Thread is valid one?

Question 2 of 40
★ FPSC ★ PPSC

Analyze the following code: public class Test implements Runnable{ public static void main(String[] args){ Test t = new Test(); t.start(); } public void run() { } }

Question 3 of 40
★ FPSC ★ PPSC

What will happen when you attempt to compile and run the following code? public class Test extends Thread{ public static void main(String argv[]){ Test t = new Test(); t.run(); t.start(); } public void run(){ System.out.println("run-test"); } }

Question 4 of 40
★ FPSC ★ PPSC

What will happen after compiling and running following code? class A implements Runnable{ public void run(){ System.out.println("run-a"); } } public class Test{ public static void main(String... args){ A a = new A(); Thread t = new Thread(a); t.start(); t.start(); } }

Question 5 of 40
★ FPSC ★ PPSC

Predict the output: class A implements Runnable{ public void run(){ try{ for(int i=0;i<4;i++){ Thread.sleep(100); System.out.println(Thread.currentThread().getName()); } }catch(InterruptedException e){ } } } public class Test{ public static void main(String argv[]) throws Exception{ A a = new A(); Thread t = new Thread(a, "A"); Thread t1 = new Thread(a, "B"); t.start(); t.join(); t1.start(); } }

Question 6 of 40
★ FPSC ★ PPSC

What will be the output? class A extends Thread{ public void run(){ for(int i=0; i<2; i++){ System.out.println(i); } } } public class Test{ public static void main(String argv[]){ Test t = new Test(); t.check(new A(){}); } public void check(A a){ a.start(); } }

Question 7 of 40
★ FPSC ★ PPSC

What will happen when you attempt to compile and run the following code? class A implements Runnable{ public void run(){ System.out.println("run-A"); } } public class Test{ public static void main(String argv[]){ A a = new A(); Thread t = new Thread(a); System.out.println(t.isAlive()); t.start(); System.out.println(t.isAlive()); } }

Question 8 of 40
★ FPSC ★ PPSC

What notifyAll() method do?

Question 9 of 40
★ FPSC ★ PPSC

What is the output for the below code? class A implements Runnable{ public void run(){ System.out.println(Thread.currentThread().getName()); } } public class Test{ public static void main(String... args){ A a = new A(); Thread t = new Thread(a); t.setName("good"); t.start(); } }

Question 10 of 40
★ FPSC ★ PPSC

Predict the output: public class Test extends Thread{ private int i; public void run(){ i++; } public static void main(String[] args){ Test a = new Test(); a.run(); System.out.print(a.i); a.start(); System.out.print(a.i); } }

Question 11 of 40
★ FPSC ★ PPSC

Which of this method can be used to make the main thread to be executed last among all the threads?

Question 12 of 40
★ FPSC ★ PPSC

Which of the following stops execution of a thread?

Question 13 of 40
★ FPSC ★ PPSC

Which of the following will ensure the thread will be in running state?

Question 14 of 40
★ FPSC ★ PPSC

What will be the output of the following Java program? class newthread extends Thread { Thread t; newthread() { t1 = new Thread(this,"Thread_1"); t2 = new Thread(this,"Thread_2"); t1.start(); t2.start(); } public void run() { t2.setPriority(Thread.MAX_PRIORITY); System.out.print(t1.equals(t2)); } } class multithreaded_programing { public static void main(String args[]) { new newthread(); } }

Question 15 of 40
★ FPSC ★ PPSC

What is a thread in Java?

Question 16 of 40
★ FPSC ★ PPSC

Which interface is used to create a thread in Java?

Question 17 of 40
★ FPSC ★ PPSC

What is the main advantage of using multithreading in Java programs?

Question 18 of 40
★ FPSC ★ PPSC

How can you create a new thread in Java by implementing the Runnable interface?

Question 19 of 40
★ FPSC ★ PPSC

What is the purpose of the start() method in Java threads?

Question 20 of 40
★ FPSC ★ PPSC

In Java, can a thread be restarted after it has completed execution?

Question 21 of 40
★ FPSC ★ PPSC

What is the result of calling the run() method directly instead of start() in Java threads?

Question 22 of 40
★ FPSC ★ PPSC

How can you achieve synchronization between threads in Java?

Question 23 of 40
★ FPSC ★ PPSC

What is a race condition in multithreaded Java programs?

Question 24 of 40
★ FPSC ★ PPSC

In Java, what is the purpose of the sleep() method in threads?

Question 25 of 40
★ FPSC ★ PPSC

What is the purpose of the join() method in Java threads?

Question 26 of 40
★ FPSC ★ PPSC

In Java, what is the difference between a thread's priority and its thread group's maximum priority?

Question 27 of 40
★ FPSC ★ PPSC

How can you check if a thread is still running in Java?

Question 28 of 40
★ FPSC ★ PPSC

In Java, can you force a thread to stop its execution using the stop() method?

Question 29 of 40
★ FPSC ★ PPSC

What is the purpose of the yield() method in Java threads?

Question 30 of 40
★ FPSC ★ PPSC

In Java, what is the purpose of the interrupt() method in threads?

Question 31 of 40
★ FPSC ★ PPSC

Which keyword is used to declare a synchronized method in Java?

Question 32 of 40
★ FPSC ★ PPSC

In Java, what is a daemon thread?

Question 33 of 40
★ FPSC ★ PPSC

How can you prevent multiple threads from accessing a critical section of code simultaneously in Java?

Question 34 of 40
★ FPSC ★ PPSC

What is the purpose of the isDaemon() method in Java threads?

Question 35 of 40
★ FPSC ★ PPSC

In Java, what happens when a thread encounters an uncaught exception and terminates abruptly?

Question 36 of 40
★ FPSC ★ PPSC

What is the result of calling the setDaemon(true) method on a running thread in Java?

Question 37 of 40
★ FPSC ★ PPSC

In Java, what is the purpose of the isInterrupted() method in threads?

Question 38 of 40
★ FPSC ★ PPSC

How can you handle exceptions in Java threads?

Question 39 of 40
★ FPSC ★ PPSC

In Java, which class is used to create and manage thread groups?

Question 40 of 40
★ FPSC ★ PPSC

What is the purpose of the setPriority() method in Java threads?

✓ Link copied to clipboard
Continue Your Practice

Advance Html — Part 1

Master the next curriculum module with 40 exam-standard MCQs.

Next Practice Set →

💡 Examiner's Advisory for Programming & Software Development

In competitive commission exams (FPSC, PPSC, KPPSC, SPSC, CSS, PMS), questions are frequently phrased with distractor options designed to catch rote learners. Whenever you answer an MCQ, read the Detailed Academic Explanation and Conceptual Anchor to understand why the remaining options are incorrect.

More Modules in Programming & Software Development

View All →
📚

Study Guides

Topic summaries and syllabus breakdown

Explore Guides →
🎯

Complete Library

Search through 78,000+ verified MCQs

Browse Library →
📱

Mobile App

Offline mock tests and instant bookmarks

Get Mobile App →