Let's assume that the given statements are as $A, B,C,D$. we can execute these statements in any order and can preempt at any point in time.
- $A: a=a+1$
- $B: b=b+1$
- $C: b=2\times b$
- $D:a=a\times 2$
The possible execution sequences are as follows:
- $A,B,C,D$
- $A,C,D,B$
- $A,C,B,D$
- $C,D,A,B$
- $C,A,B,D$
- $C,A,D,B$
Let's understand how different output is generated when we interchange the execution order.
1) $A,B,C,D$: in this sequence initial value of $a=1,b=1$.
when $A$ is executed $a$ update it's value as $a=2$,$b=1$
when $B$ is executed $b$ update it's value as $a=2$,$b=2$
when $C$ is executed $b$ update it's value as $a=2$,$b=4$
when $D$ is executed $a$ update it's value as $a=4$,$b=4$
___________________________________________________________________
2) $A,C,D,B$: in this sequence initial value of $a=1,b=1$.
when $A$ is executed $a$ update it's value as $a=2$,$b=1$
when $C$ is executed $b$ update it's value as $a=2$,$b=2$
when $D$ is executed $b$ update it's value as $a=4$,$b=2$
when $B$ is executed $a$ update it's value as $a=4$,$b=3$
___________________________________________________________________
3) $A,C,B,D$: in this sequence initial value of $a=1,b=1$.
when $A$ is executed $a$ update it's value as $a=2$,$b=1$
when $C$ is executed $b$ update it's value as $a=2$,$b=2$
when $B$ is executed $b$ update it's value as $a=2$,$b=3$
when $D$ is executed $a$ update it's value as $a=4$,$b=3$
___________________________________________________________________
4) $C,D,A,B$: in this sequence initial value of $a=1,b=1$.
when $C$ is executed $a$ update it's value as $a=1$,$b=2$
when $D$ is executed $b$ update it's value as $a=2$,$b=2$
when $A$ is executed $b$ update it's value as $a=3$,$b=2$
when $B$ is executed $a$ update it's value as $a=3$,$b=3$
___________________________________________________________________
5) $C,A,B,D$: in this sequence initial value of $a=1,b=1$.
when $C$ is executed $a$ update it's value as $a=3$,$b=2$
when $A$ is executed $b$ update it's value as $a=2$,$b=2$
when $B$ is executed $b$ update it's value as $a=2$,$b=3$
when $D$ is executed $a$ update it's value as $a=4$,$b=3$
___________________________________________________________________
6) $C,A,D,B$: in this sequence initial value of $a=1,b=1$.
when $C$ is executed $a$ update it's value as $a=1$,$b=2$
when $A$ is executed $b$ update it's value as $a=2$,$b=2$
when $D$ is executed $b$ update it's value as $a=4$,$b=2$
when $B$ is executed $a$ update it's value as $a=4$,$b=3$
___________________________________________________________________
We can see that the given program produces three different values of $a's.b's$ as $(4,4),(4,3),(3,3)$
Option $(A)$ is correct.
A similar concept was asked in GATE CSE 2015 Set 1 | Question: 9