Concurrency & Parallelism (Introductory) MCQs

Topic-wise practice questions for Programming (C++ / Java / Python). Test your knowledge, check solutions on demand, and pace your preparation.

Zero-leak answer engine • Rate-limited explanations
Practice in Timed Mode
Q1medium
Two threads both execute count = count + 1 at the exact same time. The initial value is 0. After both finish, the value is 1 instead of 2. This is a classic example of:
Q2easy
Which of the following best describes the difference between a Process and a Thread?
Q3hard
(Code-Tracing / Logic) Trace the result of using a Mutex (Lock) in this pseudocode:

Thread A: Lock(m); x = x + 1; Unlock(m);
Thread B: Lock(m); x = x + 1; Unlock(m);
If x starts at 0, what is the guaranteed result?
Q4easy
What does it mean for a function or class to be "Thread-Safe"?
Q5easy
What is Amdahl's Law used to predict?
Q6hard
What are the four necessary conditions for a Deadlock to occur (Coffman conditions)?
Q7hard
What is the difference between a Mutex and a Semaphore?
Q8medium
An application is designed to use 100 threads on a 4-core CPU. The developer notices the app is actually slower than the single-threaded version. What is the most likely cause?
Q9hard
In Java/C#, what is the effect of calling thread.join()?
Q10medium
You have two threads that are constantly changing their state in response to each other, but neither is making any progress toward finishing. This is called: