VOOZH about

URL: https://www.geeksforgeeks.org/questions/consider-the-following-code-fragment-if-fork-0/

⇱ GATE | CS | 2005 | Operating system | System calls | Question 72


Last Updated :
Discuss
Comments

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?

u = x + 10 and v = y

u = x + 10 and v != y

u + 10 = x and v = y

u + 10 = x and v != y

Share your thoughts in the comments
GeeksforGeeks