Two Process Solutions MCQs: 12 Solved Synchronization Questions with Explanations
Solve 12 published two-process synchronization questions, then use the worked interleavings to spot failures in mutual exclusion, progress and bounded waiting.
KnowledgeGate Team
Exam prep & CS education

Two-process algorithms look short, but one misplaced read, flag assignment or turn test can change mutual exclusion, progress or bounded waiting. Twelve questions test correctness criteria, naive flags, strict alternation and Peterson's algorithm. Before reading each explanation, write a counterexample interleaving. Do not trust symmetry alone.
1. Test every two-process solution with the same three checks

Mutual exclusion allows at most one process in the critical section. Progress stops a remainder-section process blocking an interested one. Bounded waiting permits finitely many overtakes after a request.
Use this calibration whenever you inspect code:
Solution | Exact trace | Result |
|---|---|---|
Naive flag | Start | Mutual exclusion fails. |
Strict alternation | Start | Mutual exclusion holds, but progress fails. |
Peterson | Both flags start | Exactly one enters, then P1 proceeds. |
Use Process Synchronization and Semaphores as the concept refresher.
2. Two Process Solutions MCQs 1-4: requirements and Peterson building blocks
Question 1 (UGC NET 2014)
Which of the following conditions does not hold good for a solution to a critical section problem ?
A. No assumptions may be made about speeds or the number of CPUs.
B. No two processes may be simultaneously inside their critical sections.
C. Processes running outside its critical section may block other processes.
D. Processes do not wait forever to enter its critical section.
Answer: C.
P0 remaining outside must not block requesting P1, so C contradicts progress. A, B and D express speed independence, mutual exclusion and bounded waiting. Open the solved question.
Question 2 (NIACL AO 2013)
A classic software-based solution to the critical-section problem is known as
A. Peterson’s solution
B. Process synchronization
C. Coordination
D. Race condition
Answer: A.
Peterson's solution is the named two-process software algorithm. The other choices describe the wider subject, a generic idea and the failure being controlled. Open the solved question.
Question 3
Which solution for the Critical Section Problem uses a boolean array flag?
A. Semaphores
B. Peterson's Solution
C. Dining Philosophers
D. Test and Set
Answer: B.
Peterson uses flag[0] and flag[1] for interest and turn for simultaneous requests. The alternatives name a primitive, a classical problem and a hardware instruction.
Question 4 (UPPSC Polytechnic Lecturer 2022)
How many variables are used in Peterson's algorithm for synchronisation of two processes?
A. 1
B. 2
C. 3
D. 4
Answer: C.
Count flag[0], flag[1] and turn: three shared values. Although declared as one array and one scalar, this question counts the Boolean entries separately. Open the solved question.
3. Two Process Solutions MCQs 5-6: read Peterson's state correctly
Question 5 (UPPSC Polytechnic Lecturer 2022)
Which of the following statements is correct about Peterson's algorithm for process synchronisation?
A. It works for 3 processes only.
B. It uses one bool type array of size 3 bool flag [3] and int variable turn.
C. If flag[i] is true, then process Pi is ready to enter the critical section.
D. It fails when two processes want to enter the critical section at the same time.
Answer: C.
flag[i] = true records Pi's request, not permission to enter. The two-process algorithm resolves simultaneous requests through turn. Open the solved question.
Question 6
Peterson’s solution satisfies :
A. Mutual Exclusion only
B. Progress but not mutual exclusion
C. Mutual Exclusion and progress only
D. Mutual Exclusion and progress and Bounded waiting.
Answer: D.
With atomic reads and writes, flags plus turn give mutual exclusion and ignore uninterested processes. turn also bounds how often a contender is bypassed.
4. Two Process Solutions MCQs 7-8: expose the race or deadlock with an interleaving
Question 7 (GATE 2007)
Processes P1 and P2 use critical_flag in the following routine to achieve mutual exclusion. Assume that critical_flag is initialized to FALSE in the main program.
get_exclusive_access ( )
{
if (critical_flag == FALSE) {
critical_flag = TRUE ;
critical_region () ;
critical_flag = FALSE;
}
}Consider the following statements.
i. It is possible for both P1 and P2 to access critical_region concurrently.
ii. This may lead to a deadlock.
Which of the following holds?
A. (i) is false and (ii) is true
B. Both (i) and (ii) are false
C. (i) is true and (ii) is false
D. Both (i) and (ii) are true
Answer: C.
Starting with critical_flag = FALSE, P1 and P2 both read FALSE before either writes; both write TRUE and enter. Mutual exclusion fails, but without waiting there is no deadlock. Open the solved question.
Question 8 (GATE 2007)
Two processes, P_1 and P_2, need to access a critical section of code. Consider the following synchronization construct used by the processes: Here, wants1 and wants2 are shared variables, which are initialized to false. Which one of the following statements is TRUE about the above construct?
P1(i) P2(j)
While(true) While(true)
{ {
wants1 = T; wants2 = T;
While (wants2 == T); While (wants1 == T);
Critical section Critical section
wants1 = F; wants2 = F;
Remainder section Remainder section
} }A. It does not ensure mutual exclusion.
B. It does not ensure bounded waiting.
C. It requires that processes enter the critical section in strict alternation.
D. It does not prevent deadlocks, but ensures mutual exclusion
Answer: D.
Both flags start false. P1 writes wants1 = T and P2 writes wants2 = T; both then see true and spin forever. Neither enters, so deadlock is possible while mutual exclusion holds. Open the solved question.
5. Two Process Solutions MCQs 9-10: strict alternation preserves safety but loses progress

Question 9 (GATE 2016)
Consider the following two-process synchronization solution.
Process 0
---------
Entry: loop while (turn == 1);
(critical section)
Exit: turn = 1;
Process 1
----------
Entry: loop while (turn == 0);
(critical section)
Exit: turn = 0;The shared variable turn is initialized to zero. Which one of the following is TRUE?
A. This is a correct two-process synchronization solution.
B. This solution violates mutual exclusion requirement.
C. This solution violates progress requirement.
D. This solution violates bounded wait requirement.
Answer: C.
P0 enters with turn = 0, exits and sets turn = 1. If P1 stays uninterested, P0 waits despite an empty critical section, so progress fails. Open the solved question.
Question 10
Which of the following is true with respect to strict alternation
A. Always guarantee mutual exclusion
B. never guarantee progress
C. Sometimes guarantees bounded waiting but not always
D. It can cause deadlock
Answers: A and B.
One turn value admits only one process, proving A. Forced alternation blocks an interested process behind an uninterested one, proving B, while retaining a fixed overtaking bound.
6. Two Process Solutions MCQs 11-12: trace Boolean protocols and complete Peterson's predicate
Question 11 (GATE 2010)
Consider the methods used by processes P1 and P2 for accessing their critical sections whenever needed, as given below. The initial values of shared boolean variables S1 and S2 are randomly assigned.
Method used by P1 Method used by P2
while (S1 == S2); while (S1 != S2);
Critical Section Critical Section
S1 = S2; S2 = not(S1);Which one of the following statements describes the properties achieved?
A. Mutual exclusion but not progress
B. Progress but not mutual exclusion
C. Neither mutual exclusion nor progress
D. Both mutual exclusion and progress
Answer: A.
At (0,0), P1 waits while P2 enters and sets S2 = not(S1) = 1; at (0,1), P1 enters and sets S1 = S2. Complementary tests prevent joint entry, but the eligible process must run before the other progresses. Open the solved question.
Question 12 (GATE 2001)
Consider Peterson's algorithm for mutual exclusion between two concurrent processes i and j. The program executed by process i is shown below.
Repeat
flag[i] = true;
turn = j;
while(P) do no-op;
Enter critical section, perform actions, then exit critical section
flag[i] = false;
Perform other non-critical section actions
Until false;For the program to guarantee mutual exclusion, the predicate P in the while loop should be:
A. flag[j] = true and turn = i
B. flag[j] = true and turn = j
C. flag[i] = true and turn = j
D. flag[i] = true and turn = i
Answer: B.
The predicate makes i wait only when j is interested and turn = j. Both flags become true; i writes turn = j, then j writes turn = i. Now i's test is false and i enters, while j's symmetric test is true. Reversing the last write reverses the winner, still admitting one. Open the solved question.
7. Two Process Solutions MCQs: trap table, answer key and next practice
Pattern | Trap |
|---|---|
Naive check-then-set | Both read false, so mutual exclusion fails. |
Set own flag, then wait | Both true means both wait. |
Strict alternation | An uninterested process blocks progress despite mutual exclusion. |
Peterson | Flags plus |
Answer key: 1-C, 2-A, 3-B, 4-C, 5-C, 6-D, 7-C, 8-D, 9-C, 10-A+B, 11-A, 12-B.
Weak on 1-6? Revise criteria and variables. For 7-10, trace interleavings. For 11-12, record Boolean assignments.
For a broader survey, Process Synchronization MCQs: 12 Solved GATE Questions owns the cross-topic route through critical sections, two-process protocols and semaphores. Questions 8, 9 and 11 also appear there as survey examples; here they are compared with nine same-topic questions under mutual exclusion, progress and bounded waiting. Question 12 uses a different Peterson-predicate version. Continue with GATE Guidance by Sanchit Sir, then apply the same trace discipline to Semaphore Trace Tables for GATE: 3 Classic Problems.
Keep learning
Classical Synchronization Problems MCQs: 12 Solved Questions with Explanations
Test your grasp of bounded buffers, readers-writers and dining philosophers through 12 solved MCQs. Trace each state change before reading the explanation.
Process Synchronization MCQs: 12 solved GATE questions with explanations
Process synchronization MCQs for GATE: 12 solved previous-year questions on critical sections, race conditions, Peterson's algorithm and semaphore ordering.
Free Space Management MCQs: 12 Solved Questions with Explanations
Solve 12 published free-space and file-management MCQs, then check each answer with direct reasoning and two fully worked bitmap calculations.
FIFO Page Replacement MCQs: 12 Solved Questions with Step-by-Step Explanations
Practise FIFO carefully through 12 questions on hits, faults, preloaded frames, reverse reference strings, queue traces, and Belady's anomaly.





