GATE CS 2026 (Forenoon) — Question 63

Operating Systems (OS)System Calls, Processes, Threads, InterProcess CommunicationNAT2 marksMedium

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.
c
1int main() {
2    int i;
3    for (i = 0; i < 3; i++){
4        if (fork() == 0){
5            continue;
6        }
7        break;
8    }
9    printf("Hello!");
10    return 0;
11}
12
The total number of times that the printf statement gets executed is ________. (answer in integer)
Practise the full 2026-FN paper
Challenge a friend: WhatsApp Telegram
From RENYXERAPractise this subject in the exam simulatorTimed, GATE-style tests with analytics that find your weak topics.
Practise more on System Calls, Processes, Threads, InterProcess CommunicationTimed, in the real exam interface · free to start

A GATE question every morning

One real past-paper question every morning for your branch, answer hidden until you tap. Free on Telegram.

Join
Stuck? Ask in the student group