Correct Answer - Option 4 :
- In computing, particularly in the context of the Unix operating system and its work likes, fork is an operation whereby a process creates a copy of itself.
- It is usually a system call, implemented in the kernel.
- The fork is the primary (and historically, only) method of process creation on Unix - like operating systems.
The purpose of fork() is to create a new process, which becomes the child process of the caller. After a new child process is created, both processes will execute the next instruction following the fork() system call.
So the system will execute the print statements 2 times.
Hence we will get output as:
Hence option (4) is the correct answer.