GATE CS 2005 – Question 70

Multiple choice 2 marks Question 70 2005

Question 70

MCQ 2 marks · −0.66 Operating Systems

Consider the following code fragment, where the variable a already holds a value before the fragment starts executing:

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?

Answers and explanations are free — they just need an account.

Where this question comes from

Source: GATE 2005 Computer Science and Engineering (question number approximate)