Consider the following code segment: void main() { int pid, n, i; for (i = 0;…

Consider the following code segment:

void main() {

    int pid, n, i;

    for (i = 0; i <= n; i++) {

            pid = fork();

    }

    printf("%d", pid);

}

Total number of processes will be? 

  1. A.

    2n+1

  2. B.

    1 + 2n+1

  3. C.

    2n+1 - 1

  4. D.

    2n+1 +2

Attempted by 406 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…