Java Multithreading MCQs with answers Page - 5

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. Which interface is used to represent a task that returns a result in Java?

  • (A) Runnable
  • (B) Callable
  • (C) Executor
  • (D) Future

A

Admin • 828.43K Points
Coach

Q. Which method of the `Thread` class causes the currently executing thread to sleep?

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

A

Admin • 828.43K Points
Coach

Q. Which class is used to retrieve the result of a `Callable` task?

  • (A) Runnable
  • (B) Thread
  • (C) Future
  • (D) Executor

A

Admin • 828.43K Points
Coach

Q. Which of the following provides a better alternative to manually creating threads?

  • (A) ThreadGroup
  • (B) Runnable
  • (C) Executors
  • (D) ThreadPoolExecutor

A

Admin • 828.43K Points
Coach

Q. What does the `Thread.yield()` method do?

  • (A) Terminates the thread
  • (B) Sleeps the thread for a second
  • (C) Allows other threads of equal priority to execute
  • (D) Blocks the thread

A

Admin • 828.43K Points
Coach

Q. What is the use of `ThreadLocal` in Java?

  • (A) To store thread pools
  • (B) To isolate variable values per thread
  • (C) To store the ID of a thread
  • (D) To create child threads

A

Admin • 828.43K Points
Coach

Q. Which exception is thrown when a thread is interrupted during sleep?

  • (A) ThreadInterruptedException
  • (B) IllegalThreadStateException
  • (C) InterruptedException
  • (D) IOException

A

Admin • 828.43K Points
Coach

Q. Which method in ExecutorService stops all actively executing tasks?

  • (A) shutdown()
  • (B) terminate()
  • (C) shutdownNow()
  • (D) cancel()

A

Admin • 828.43K Points
Coach

Q. Which of these is a subclass of the Thread class?

  • (A) FutureTask
  • (B) ScheduledThreadPoolExecutor
  • (C) TimerTask
  • (D) None of the above

A

Admin • 828.43K Points
Coach

Q. Which of the following is not a benefit of using thread pools?

  • (A) Reduces resource consumption
  • (B) Improves response time
  • (C) Improves memory leak risk
  • (D) Efficient thread management
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