A process executes the following code: for (i = 0; i < n; i++) fork();The…

GATE · 2008 · CS

A process executes the following code:

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

The total number of child processes created is

  1. A.

    n

  2. B.

    2n - 1

  3. C.

    2n

  4. D.

    2(n+1) - 1

Attempted by 383 students.

Show answer

Correct answer: B

The worked solution is available to enrolled students.

Video solution available to enrolled students.

Explore the full course: Iocl Engineers Officers Grade A Paper 2

Loading lesson…