GATE CS 2026, set 1 · Question 63 · Operating System · Numerical answer (NAT) · 2 marks · no negative marks
Consider the following program snippet. Assume that the program compiles and runs successfully. Further, assume that the fork() system call is always successful in creating a process.
int main () { int i; for (i = 0; i < 3; i++){ if (fork() == 0){ continue; } break; } printf("Hello!"); return 0; }
The total number of times that the printf statement gets executed is ______.
(answer in integer)
Answer
Answer 4
Answer from the official GATE CS 2026 answer key.
The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes