Consider the following code fragment: if (fork() == 0) { a = a + 5;…
GATE · 2005 · CS
Consider the following code fragment:
if (fork() == 0)
{
a = a + 5;
printf("%d,%d\n", a, &a);
}
else
{
a = a - 5;
printf("%d, %d\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
Attempted by 246 students.
Sign up free to check your answer
Sign up freeLoading lesson…