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

Which method is used to stop a thread in Java?

Q.3Easy

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

Q.4Easy

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

Q.5Easy

In Java multithreading, which method is used to pause the execution of a thread for a specified number of milliseconds without releasing locks?

Q.6Easy

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

Q.7Easy

Which of the following statements about the notify() method is correct?

Q.8Easy

Which exception is thrown when a thread is interrupted while waiting?

Q.9Easy

What is the return type of the join() method in Java threading?

Q.10Easy

Which of the following best describes the purpose of the Runnable interface in Java?

Q.11Easy

Which of the following statements about Java threads is correct?

Q.12Easy

What is the primary purpose of the volatile keyword in Java multithreading?

Q.13Easy

Which of the following will cause a deadlock situation?

Q.14Easy

Which collection class is thread-safe without explicit synchronization?

Q.15Easy

Which method is used to prevent race conditions by allowing only one thread to access a resource at a time?

Q.16Easy

Which of the following collections is thread-safe in Java?

Q.17Easy

What is the output of the following code? Thread t = new Thread(() -> System.out.println(Thread.currentThread().getName())); t.start();

Q.18Easy

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

Q.19Easy

What is the difference between start() and run() methods in threading?

Q.20Easy

Which of the following thread states is NOT a valid Java thread state?