GATE CS 2024 (Forenoon) — Question 57

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

Consider the following code snippet using the fork() and wait() system calls. Assume that the code compiles and runs correctly, and that the system calls run successfully without any errors.
c
1int x = 3;
2while (x > 0) {
3    fork( );
4    printf("hello");
5    wait(NULL);
6    x--;
7}
8
The total number of times the printf statement is executed is ________.
Practise the full 2024-FN paper
Challenge a friend: WhatsApp Telegram
From RENYXERAWhat rank do your marks get?GATE score, likely All-India Rank and qualifying marks for your category.
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