Skip to content
Related Articles

Related Articles

GATE | GATE 2017 MOCK II | Question 52

View Discussion
Improve Article
Save Article
  • Last Updated : 28 Jun, 2021

A counting semaphore was initialized to 0, then 20 V operations were successfully completed on this semaphore, followed with 18 P operations, the resulting value of the semaphore is:

(A) 18
(B) 20
(C) 0
(D) 2


Answer: (D)

Explanation: 20V => increments the semaphore 20 times. Hence , the value becomes 20.
18P => decrements the semaphore 18 times. Hence , the value becomes 2.


Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!