Types of Semaphores MCQs: 11 Solved Questions on P, V and Mutex

Solve 11 semaphore MCQs on counting-value arithmetic, option-order traps and a broken mutex trace. Each explanation shows the deciding equation or interleaving.

KnowledgeGate Team

Exam prep & CS education

Updated 31 Oct 20268 min read64 views
Types of Semaphores MCQs: 11 Solved Questions on P, V and Mutex

Semaphore MCQs look simple, but errors come from reversing P and V, rejecting a negative count, or trusting a variable named mutex. Solve these 11 MCQs before reading each explanation, using one ledger: S_final = S_initial - completed P operations + completed V operations. Review terms at CS Fundamentals, then calculate before checking options. Atomic operations, waiting queues, starvation, barriers, handoffs and the ten-process GATE 1997 mutex variant are worked in Semaphores and Process Ordering MCQs: 10 Solved Questions; counting-value questions instead require repeated equation checks, while the Coal India 2017 variant uses eight processes to test the same unmatched-signal defect at a different scale.

Lock the semaphore ledger before solving

A counting semaphore represents permits: P, wait, or down consumes one; V, signal, or up returns one. A negative extended count records waiting demand. A binary semaphore is 0 or 1, but exclusion still requires P(mutex) before the critical section and V(mutex) after it.

Start with S = 3. P1 executes P, so S = 2; P2 executes P, giving 1; P3 executes P, giving 0. P4 attempts P, producing -1 and blocking. P1 executes V, taking the count to 0 and waking P4; P4 consumes that release. P2 executes V

A counting-semaphore ledger showing permits falling from 3 to 0, then waiting demand and a V signal restoring one permit.

Types of semaphores MCQs 1-3: net change and option order

Find the net change as V - P, add it to the initial value, then map the result to the current options.

Question 1 (GATE 1998)

A counting semaphore was initialized to 10. Then 6 P (wait) operations and 4 V (signal) operations were completed on this semaphore. The resulting value of the semaphore is

  • A. 0

  • B. 8

  • C. 10

  • D. 12

Correct answer: B. 8.

Apply the signs: 10 - 6 + 4 = 8. The net change 4 - 6 = -2 also takes 10 to 8. Option 10 ignores the imbalance; 12 reverses it. Because the operations completed, no schedule is needed.

Question 2 (GATE 1998)

A counting semaphore was initialized to 10. Then 6 P (wait) operations and 4 V (signal) operations were completed on this semaphore. The resulting value of the semaphore is:

  • A. 0

  • B. 10

  • C. 12

  • D. 8

Correct answer: D. 8.

Recalculate: 10 - 6 + 4 = 8. Here 8 is D, not B. The reordered options test whether you carry the numerical result to the choices instead of remembering another version's letter.

Question 3 (GATE 1992)

At a particular time of computation the value of a counting semaphore is 7. Then 20 P operations and 15 V operations were completed on this semaphore. The new value of the semaphore will be

  • A. 42

  • B. 2

  • C. 7

  • D. 12

Correct answer: B. 2.

Compute 7 - 20 + 15 = 2. Equivalently, 15 - 20 = -5, then 7 - 5 = 2. An extended ledger may pass below zero to record waiting demand; the final 2 means two permits remain.

Types of semaphores MCQs 4-6: choose the operation set and solve for x

For a target, write final = initial - P + V. Test every statement in Question 4; isolate x in Questions 5 and 6.

Question 4 (ISRO 2017)

At particular time, the value of a counting semaphore is 10, it will become 7 after: (a) 3 V operations (b) 3 P operations (c) 5 V operations and 2 P operations (d) 2 V operations and 5 P operations Which of the following option is correct?

  • A. Only (b)

  • B. Only(d)

  • C. Both (b) and (d)

  • D. None of these

Correct answer: C. Both (b) and (d).

Evaluate each statement: (a) 10 + 3 = 13; (b) 10 - 3 = 7; (c) 10 + 5 - 2 = 13; (d) 10 + 2 - 5 = 7. Therefore both (b) and (d) reach 7. Operation order does not change this completed-count arithmetic.

Question 5 (ISRO 2017)

A counting semaphore was initialized to 7. Then 20 P (wait) operations and x V (signal) operations were completed on this semaphore. If the final value of semaphore is 5, then the value x will be

  • A. 0

  • B. 13

  • C. 18

  • D. 5

Correct answer: C. 18.

Write 7 - 20 + x = 5, so x = 5 - 7 + 20 = 18. Check: 7 - 20 + 18 = 5. The tempting 13 is the deficit after 20 waits, not the signals needed to finish at 5.

Question 6 (ISRO 2016, UGC NET 2023)

At a particular time of computation the value of a counting semaphore is 7. Then 20p operations and 'x' V operations were completed on this semaphore. If the Final value of semaphore is 5 ,x will be

  • A. 18

  • B. 22

  • C. 15

  • D. 13

Correct answer: A. 18.

Treat lowercase 20p as 20 P operations: 7 - 20 + x = 5, so x = 18, now at A. Here 22 ignores the equation, while 13 is only the post-wait deficit. Check: 7 - 20 + 18 = 5.

Types of semaphores MCQs 7-10: repeat without inheriting a letter

Repeated forms expose memorised option letters. Write a one-line equation even when the numbers look familiar.

Question 7 (ISRO 2015)

At a particular time of computation the value of a counting semaphore is 7. Then 20 P operations and 15 V operations were completed on this semaphore. The resulting value of the semaphore is :

  • A. 42

  • B. 2

  • C. 7

  • D. 12

Correct answer: B. 2.

Write 7 - 20 + 15 = 2. Option 42 adds everything, 12 reverses the signs, and 7 assumes equal waits and signals. Retain 2, not its letter.

Question 8 (UGC NET 2018)

At a particular time of computation, the value of a counting semaphore is 10. Then 12 P operations and "x" V operations were performed on this semaphore. If the final value of semaphore is 7, x will be

  • A. 8

  • B. 9

  • C. 10

  • D. 11

Correct answer: B. 9.

Set up 10 - 12 + x = 7, so x = 7 - 10 + 12 = 9. Verify: 10 - 12 + 9 = 7. Keeping the target in the equation avoids nearby distractors.

Question 9 (UGC NET 2019)

At a particular time of computation, the value of a counting semaphore is 7. Then 20 P (wait) operations and 15 V (signal) operations are completed on this semaphore. What is the resulting value of the semaphore?

  • A. 28

  • B. 12

  • C. 2

  • D. 42

Correct answer: C. 2.

Preserve the signs: 7 - 20 + 15 = 2. Questions 3 and 7 put 2 at B; here it is C. Option 12 comes from the reversed-sign calculation 7 + 20 - 15. Calculate, then map.

Question 10 (UGC NET 2019)

A counting semaphore is initialized to 8. 3 wait ( ) operations and 4 signal ( ) operations are applied. Find the current value of semaphore variable.

  • A. 9

  • B. 5

  • C. 1

  • D. 4

Correct answer: A. 9.

Calculate 8 - 3 + 4 = 9. Signals exceed waits by one, so the net change is +1. Option 5 stops after the waits and ignores four signals; the empty parentheses change nothing.

Types of semaphores MCQ 11: when an unmatched V breaks mutex

A correct pattern requires P(mutex) before CS and one matching V(mutex) afterwards. P8 begins with V(mutex), creating admission without first consuming it.

Question 11 (Coal India 2017)

Code
Let each process Pi, i = 1 to 7 executes the following code.

repeat
    P(mutex);
    CS
    V(mutex);
forever
The process P8 executes the following code:
repeat
    V(mutex);
    CS
    V(mutex);
forever
What is the maximum number of processes that can be present in the critical section at any point of time?
Given that the initial value of binary semaphore variable “mutex” is 1.
  • A. 7

  • B. 8

  • C. 1

  • D. 10

Correct answer: B. 8.

A legal schedule reaches eight occupants. P1 waits and enters, then P8 signals and enters, and P2 consumes that signal. On each P8 loop, schedule one waiting process after P8's exit signal and another after its next leading signal. In order, admit P3 and P4, then P5 and P6, then P7; finally P8 re-enters while P1 through P7 remain paused. All eight processes are then in the critical section.

The semaphore value stays binary: it alternates between 0 and 1 and is 1 at the final snapshot, while the occupant count is 8. Option 1 assumes a valid protocol, 7 omits P8, and 10 exceeds the eight processes in the stem. Review Process Synchronization and Semaphores.

Semaphore interleaving trace reaching eight occupants while the final binary mutex value is 1.

Separate binary and counting semaphore claims

Question to ask

Counting semaphore

Binary semaphore

Value meaning

Available permits or extended waiting demand

Logical 0/1 state

Typical use

k identical resources

One-at-a-time exclusion or event signalling

P or wait

Consume one or block

Change 1 to 0 or block

V or signal

Return one or wake a waiter

Release and possibly wake one waiter

Safety condition

Correct initial count and balanced operations

Every entrant follows wait, CS, signal

A mutex is ownership-aware; a semaphore may be signalled by another process. Identical ranges do not guarantee identical safety. Continue with Process Synchronization MCQs: 12 Solved Questions for critical-section practice.

Audit the five traps before counting the score

Trap

Wrong move

Correction

Reversed signs

initial + P - V

Use initial - P + V

Intermediate as final

Stop after P

Apply both operation counts

Letter memory

Recall an earlier option

Recompute, then map choices

Negative means impossible

Reject an extended negative count

Read it as waiting demand in this model

mutex name means safety

Trust the variable name

Check that every process waits before CS

Check in 20 seconds: write S0 - P + V, substitute, verify net change, then inspect option order. For code, list processes crossing or bypassing P

Short version and the next practice step

Keep this chain: P/wait consumes; V/signal returns; counting tracks permits; a negative extended count tracks waiting demand; binary is 0/1; exclusion still needs a correct wait-CS-signal protocol.

Retry missed arithmetic without options: write the equation, calculate, then map. Reconstruct Question 11 until all eight processes are accounted for. For broader revision, use Computer Science Fundamentals for Placements by Sanchit Sir. Now solve all 11 again, circling each sign first.