Logo 
Search:

Unix / Linux / Ubuntu FAQ

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

Unix program practical question 2

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

Answer:

Predict the output of the following program code

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


Answer:
"Hello World" will be printed 8 times.


Explanation:
2^n times where n is the number of calls to fork()

Share: 
 

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


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


Tagged: