Gate CS-2005 Question Paper With Solutions

Q. 72 Consider the following code fragment:

if (fork() == )
{
   a = a + 5;
   printf("%d, %p n", a, &a);
}
else
{
   a = a - 5;
   printf ("%d, %p n", a,& a);
}

Let u, v be the values printed by the parent process, and x, y be the values printed by the child process. Which one of the following is TRUE?

(A) u = x + 10 and v = y

(B) u = x + 10 and v != y

(C) u + 10 = x and v = y

(D) u + 10 = x and v != y

Answer: (C)

Explanation:

Gate CS-2005 Question Paper With Solutions

Learn More:   Gate CS-2017-2 Question Paper With Solutions

LEAVE A REPLY

Please enter your comment!
Please enter your name here