Skip to content

Beta · Data may be lost.Your data may be reset or lost.

GateBrew
← GATE CSE 2026 Set 1
Questions

Q53

NAT2 marksOperating systems

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)

Sign in to save attempts.

Solutions and discussion are hidden while you attempt this question. They open once you check or show the answer.