The following pair of processes share a common variable X.
X is set to 5 before either process begins execution. As usual, statements within a process are executed sequentially, but statements in process A may execute in any order with respect to statements in process B.
How many different values of X are possible after both processes finish executing?
A. two
B. three
C. four
D. eight
Code:
Process A
int Y;
A1: Y = X*2;
A2: X = Y;
Process B
int Z;
B1: Z = X+1;
B2: X = Z;
How many different values of X are possible after both processes finish executing?
A. two
B. three
C. four
D. eight