Krishna Logo
qa training in canada now
Divied
Call: Anusha @ 1 (877) 864-8462

 

Latest News
Home Navigation Divied
INTERVIEW Navigation Divied UNIX INTERVIEW QUESTIONS Navigation Divied Predict the output of the following program code
Predict The Output Of The Following Program Code
Predict the output of the following program code

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

 

Ans:
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.


Shadow Bottom
 
 
© 2005 -