Correct Answer - Option 2 : 2
Concepts:
V(S): Signal operation will increment the semaphore variable, that is, S++.
P(S): Wait operation will decrement the semaphore variable., that is, S--.
Data:
Initial counting semaphore = I = 7
Wait operation = 20 P
Signal operation = 15 V
Final counting semaphore = F
Formula:
F = I + 15V + 20P
Calculation:
F = 7 + 15(+1) + 20(-1)
∴ F = 2
the resulting value of the semaphore is 2