GATE CS 2015, set 1 · Question 30 · Operating System · Numerical answer (NAT) · 1 mark · no negative marks

The following two functions P1 and P2 that share a variable B with an initial value of 2 execute concurrently.
P1( ) { P2( ) { C = B - 1; D = 2 * B; B = 2 * C; B = D - 1; } }
The number of distinct values that B can possibly take after the execution is ______.

Answer

Answer 3

Answer from the official GATE CS 2015 answer key.

The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes