Question 120

How many times will "Hi" be printed by the following program?

How many times will "Hi" be printed by the following program? fork(); fork(); fork(); printf("Hi\n");
  1. A4
  2. B3
  3. C8
  4. D6
Show answerHide answer

Correct answer: (C) 8

Explanation

n fork() calls create 2^n processes; 2^3 = 8.

From DSSSB TGT Computer Science Full Mock Test 1

This is question 120 of DSSSB TGT Computer Science Full Mock Test 1. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.