Multiple choice technology operating systems

Predict the output of the following program code main() { fork(); printf("Hello World!"); }

  1. Hello World!Hello World!

  2. Hello World!

  3. World!Hello

  4. error

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

fork() creates a child process that duplicates the parent. Both processes continue execution from after the fork() call, so each executes the printf statement. The output appears twice: "Hello World!Hello World!". The order may vary but both processes print.