iGET

Java Programming - MCQ Practice Questions

Practice free Java Programming multiple-choice questions with detailed answers and explanations. Perfect for competitive exam preparation.

958 questions | 100% Free

Q.1Easy

Which interface must be implemented to create a thread in Java?

Q.2Medium

What is the difference between Thread.sleep() and Thread.yield()?

Q.3Easy

Which method is used to stop a thread in Java?

Q.4Medium

What is the purpose of the synchronized keyword in Java multithreading?

Q.5Medium

Which of the following is NOT a thread state in Java?

Q.6Medium

What will be the output of calling start() multiple times on the same thread object?

Q.7Easy

Which method is called to make a thread wait until another thread completes?

Q.8Medium

What is a race condition in multithreading?

Q.9Medium

Consider a synchronized method. Can multiple threads call it simultaneously on the same object?

Q.10Medium

What is the difference between notify() and notifyAll()?

Q.11Medium

Which class provides thread-safe operations on shared variables in Java?

Q.12Hard

What happens when wait() is called from a thread that doesn't hold the lock?

Q.13Medium

What is a daemon thread in Java?

Q.14Easy

Which of the following is a valid way to create a thread in Java?

Q.15Medium

What is a deadlock in multithreading?

Q.16Hard

How does the volatile keyword help in multithreading?

Q.17Hard

What will happen if you call sleep() inside a synchronized block?

Q.18Hard

Which interface allows multiple threads to access a resource with a permit system?

Q.19Medium

What is thread pooling and which class is commonly used for it?

Q.20Hard

Consider code where Thread A holds Lock1 and waits for Lock2, while Thread B holds Lock2 and waits for Lock1. What is this scenario called?