All mock tests are FREE till 31 December — register to save your progress

At a particular time of computation, the value of a counting semaphore is 7. Then 20 P operations and 'x' V operations were performed on this semaphore. If the final value of the semaphore is 5, what is x?

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: C. 18

Explanation

As in Q17, the final semaphore value equals initial value minus P operations plus V operations: 7 − 20 + x = 5, so x = 18, option (iii). The arithmetic is identical to Q17; only one of the three wrong distractor values (14 here vs 13 in Q17) differs between the two listings.

More Computer System Architecture questions