In a synchronized block, if notifyAll() is called, what happens?
Q.182Medium
What is the primary difference between Semaphore and Mutex?
Q.183Medium
What happens when Thread.interrupt() is called on a thread?
Q.184Medium
In a deadlock scenario, which of the following is always true?
Q.185Medium
What is the key difference between Callable and Runnable?
Advertisement
Q.186Medium
What will happen if you try to call start() on a thread that has already completed execution?
Q.187Medium
Consider the code:
synchronized void method1() { wait(); }
If wait() is called without a lock, what happens?
Q.188Medium
What is the purpose of the yield() method in Java threading?
Q.189Medium
Which Java class provides thread-safe operations using Compare-And-Swap (CAS)?
Q.190Medium
What does the volatile keyword guarantee in multithreading?
Q.191Medium
In Java 21, which new feature was introduced for concurrent programming?
Q.192Medium
What is the output of this code snippet?
ExecutorService es = Executors.newFixedThreadPool(2);
es.execute(() -> System.out.println("Task 1"));
es.shutdown();
Q.193Medium
What exception does CyclicBarrier throw when a thread is interrupted while waiting?
Q.194Medium
In a producer-consumer scenario using BlockingQueue, what happens when a consumer thread calls take() on an empty queue?
Q.195Medium
A multi-threaded application experiences poor performance despite having adequate CPU cores. Code inspection reveals frequent calls to synchronized blocks on shared objects. Which modern Java feature (2024-25) could optimize this without major refactoring?
Q.196Medium
What is the output of the following code?
int x = 10;
try {
x = x / 0;
} catch(ArithmeticException e) {
x = x + 5;
} finally {
x = x * 2;
}
System.out.println(x);
Q.197Medium
What will be the output?
try {
throw new Exception("Test");
} catch(Exception e) {
System.out.println("Caught");
} finally {
System.out.println("Finally");
}
Q.198Medium
What is the output of multiple catch blocks?
try {
int[] arr = {1, 2, 3};
System.out.println(arr[5]);
} catch(ArrayIndexOutOfBoundsException e) {
System.out.println("Index");
} catch(Exception e) {
System.out.println("Exception");
}
Q.199Medium
Which of the following exceptions is a checked exception?