Java Multithreading MCQs with answers
58 questions tagged Java Multithreading, each with the correct answer and an explanation. Page 1 of 3.
- Which of the following best describes a thread-safe class?
- Which of the following can be used to limit access to a resource to only one thread at a time?
- How many times can a thread object's `start()` method be called?
- Which interface allows scheduling of tasks with a delay?
- Which method stops accepting new tasks in ExecutorService?
- Which thread method would you use to run a thread in the background?
- Which class provides a framework for asynchronous task execution?
- Which method is called internally by `start()`?
- Which of the following is not a benefit of using thread pools?
- Which of these is a subclass of the Thread class?
- Which method in ExecutorService stops all actively executing tasks?
- Which exception is thrown when a thread is interrupted during sleep?
- What is the use of `ThreadLocal` in Java?
- What does the `Thread.yield()` method do?
- Which of the following provides a better alternative to manually creating threads?
- Which class is used to retrieve the result of a `Callable` task?
- Which method of the `Thread` class causes the currently executing thread to sleep?
- Which interface is used to represent a task that returns a result in Java?
- Which of the following is NOT a thread state in Java?
- Which of the following is true about the `volatile` keyword in Java?