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.301Easy

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

Q.302Medium

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

Q.303Easy

Which method is used to stop a thread in Java?

Q.304Medium

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

Q.305Medium

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

Q.306Medium

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

Q.307Easy

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

Q.308Medium

What is a race condition in multithreading?

Q.309Medium

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

Q.310Medium

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

Q.311Medium

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

Q.312Hard

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

Q.313Medium

What is a daemon thread in Java?

Q.314Easy

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

Q.315Medium

What is a deadlock in multithreading?

Q.316Hard

How does the volatile keyword help in multithreading?

Q.317Hard

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

Q.318Hard

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

Q.319Medium

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

Q.320Hard

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?