Logo 
Search:

Unix / Linux / Ubuntu FAQ

Submit Interview FAQ
Home » Interview FAQ » Unix / Linux / UbuntuRSS Feeds

Unix program practical question 1

  Shared By: Adah Miller    Date: Jan 25    Category: Unix / Linux / Ubuntu    Views: 154

Answer:

Predict the output of the following program code

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.

Share: 
 

Didn't find what you were looking for? Find more on Unix program practical question 1 Or get search suggestion and latest updates.


Your Comment
  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].


Tagged: