Skip to content
Related Articles

Related Articles

Algorithms Quiz | SP Contest 3 | Question 7
  • Last Updated : 25 Jul, 2018

Consider the below C program:




int main()
{
    fork();
    fork();
    fork();
      
    printf("Hello World");
}

How many child processes will be created when the above program executes?
(A) 4
(B) 5
(C) 6
(D) 7


Answer: (D)

Explanation: For n fork calls in a program, (2n-1) child processes are created.

Here n = 3.
Therefore, no of child process = 23 – 1 = 8 – 1 = 7.


Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :