Java Multithreading MCQs with answers Page - 4

You will find multiple-choice questions (MCQs) related to #Java Multithreading here. Go through these questions to prepare effectively for your upcoming exams and interviews.

To view the correct answer for any question, simply click the "Show Answer" button.

Have a question to share? Click on "Add Question" to contribute!

A

Admin • 828.43K Points
Coach

Q. What will happen if a thread is sleeping and gets interrupted?

  • (A) It will ignore the interruption
  • (B) It will throw InterruptedException
  • (C) It will terminate silently
  • (D) It will restart

A

Admin • 828.43K Points
Coach

Q. Which method causes the currently executing thread to pause and allow others to execute?

  • (A) stop()
  • (B) wait()
  • (C) yield()
  • (D) pause()

A

Admin • 828.43K Points
Coach

Q. Which of these classes implement the Runnable interface?

  • (A) Thread
  • (B) Timer
  • (C) TimerTask
  • (D) All of the above

A

Admin • 828.43K Points
Coach

Q. Which keyword is used to create a critical section in Java?

  • (A) protected
  • (B) volatile
  • (C) synchronized
  • (D) threadsafe

A

Admin • 828.43K Points
Coach

Q. Which of the following best describes a daemon thread?

  • (A) It cannot be interrupted
  • (B) It runs in the background and does not prevent JVM from exiting
  • (C) It has higher priority than normal threads
  • (D) It is the main thread of execution

A

Admin • 828.43K Points
Coach

Q. Which method is used to change a thread into a daemon thread?

  • (A) makeDaemon(true)
  • (B) setDaemon(true)
  • (C) runAsDaemon()
  • (D) markDaemon()

A

Admin • 828.43K Points
Coach

Q. What happens if `wait()` is called outside a synchronized context?

  • (A) It works normally
  • (B) Thread is paused
  • (C) IllegalMonitorStateException is thrown
  • (D) Thread becomes daemon

A

Admin • 828.43K Points
Coach

Q. Which method notifies all threads waiting on an object's monitor?

  • (A) notify()
  • (B) wakeAll()
  • (C) notifyAll()
  • (D) startAll()

A

Admin • 828.43K Points
Coach

Q. Which of the following is true about the `volatile` keyword in Java?

  • (A) It makes a variable read-only
  • (B) It guarantees visibility of changes to variables across threads
  • (C) It synchronizes a block of code
  • (D) It locks the object for other threads

A

Admin • 828.43K Points
Coach

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

  • (A) NEW
  • (B) RUNNABLE
  • (C) STARTED
  • (D) BLOCKED
What's Tag

As you may know, questions are organized under broad categories. Each category can include various types of questions. For example, the "History" category might contain questions about the Revolt of 1857, Shivaji Maharaj, Ancient History, Buddhism, and more.

To further refine this organization, we've introduced tags, which act as sub-categories to group questions more specifically.

Verified users can add tags to any question. If you have any suggestions regarding this system, we'd love to hear from you. Contact Us

Learn More