11.) What is the primary advantage of using a thread pool in Java?
A) It allows for more fine-grained thread control.
B) It eliminates the need to create and destroy threads frequently.
C) It ensures that only one thread runs at a time.
D) It simplifies the debugging of multithreaded programs.
12.) Which Java API provides a framework for managing thread pools?
A) java.util.concurrent
B) java.lang.Thread
C) java.util.threading
D) java.concurrent.pool
13.) What does it mean for a method to be thread-safe in Java?
A) The method can only be called by a single thread at a time.
B) The method does not use any synchronized blocks.
C) The method behaves correctly and consistently when called by multiple threads.
D) The method is declared as “synchronized.”
14.) Which data structure is typically considered thread-safe in Java without additional synchronization?
A) ArrayList
B) HashSet
C) Vector
D) HashMap
15.) What is the purpose of atomic operations in multithreading?
A) To execute operations with maximum speed
B) To execute operations sequentially
C) To ensure that certain operations are executed as a single, uninterruptible unit
D) To prevent operations from being executed
16.) Which Java class provides atomic operations for variables?
A) AtomicInteger
B) AtomicBoolean
C) AtomicVariable
D) AtomicOperation
17.) What is the range of thread priorities in Java?
A) 0 to 10
B) 1 to 100
C) -1 to 1
D) Low, Medium, High
18.) In Java, what does increasing a thread’s priority indicate?
A) A preference for executing other threads first
B) A preference for executing the current thread first
C) Equal preference for all threads
D) No preference for thread execution order
19.) What is the purpose of thread-local storage in Java?
A) To store global variables
B) To share variables between threads
C) To store thread-specific data that is not shared with other threads
D) To store constants that are accessed by multiple threads
20.) Which class in Java provides support for thread-local variables?
A) ThreadLocal
B) LocalVariable
C) ThreadVariable
D) ThreadStorage