Multithreading and Concurrency in Java

Test your understanding of threads,synchronization,and concurrency utilities.

1. Which interface should be implemented to create a thread in Java when extending Thread is not preferred?
2. What does the 'synchronized' keyword in Java ensure for a method?
3. Which method is used to make a thread wait for another thread to complete execution?
4. What is the result type of the Runnable interface's run() method?
5. Which class represents the result of an asynchronous computation in Java?
6. Which of the following is NOT a thread state in Java?
7. What is the primary purpose of the volatile keyword in Java?
8. What determines the default priority of a newly created thread in Java?
9. Which methods throw InterruptedException when a thread is interrupted? (Select all that apply)
10. Which of the following are thread-safe collections? (Select all that apply)
11. Which components are part of Java's Executor Framework? (Select all that apply)
12. Which conditions are necessary for a deadlock to occur? (Select all that apply)
13. Which of the following are valid uses of the synchronized keyword? (Select all that apply)
14. The volatile keyword guarantees atomicity for increment operations like i++.
15. A thread in the BLOCKED state is waiting to acquire a monitor lock.
16. ThreadLocal provides thread-safe access by sharing a single variable across threads.
17. Calling Object.wait() releases the object's monitor lock.
18. Name the interface that declares the call() method, which returns a value and may throw checked exceptions.
19. What method is used to wake all threads waiting on an object's monitor?
20. What is the common abbreviation for the Java concurrency utilities package (e.g., containing ConcurrentHashMap)?
Answered 0 of 0 — 0 correct