Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Unix%20Interview%20Questions%20and%20Answers

Question: Predict the output of the following program code</P><!--webbot bot="Include" U-Include="../_private/tbl_gglapck.htm" TAG="BODY" startspan --><!--webbot bot="Include" i-checksum="224" endspan --><P class="answers">main()
{
fork();
printf("Hello World!");
}
Answer: Hello World!Hello World!
Explanation:
The fork creates a child that is a duplicate of the parent process. The child begins from the fork().All the statements after the call to fork() will be executed twice.(once by the parent process and other by child). The statement before fork() is executed only by the parent process.
Is it helpful? Yes No

Most helpful rated by users:

©2024 WithoutBook