UNIX Operating System Question: Download Questions PDF
Predict the output of the following program code in UNIX?
![UNIX Operating System Interview Answer UNIX Operating System Interview Question](https://globalguideline.com/public/images/interview/34.png)
Answer:
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.
{
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.
Download UNIX Operating System Interview Questions And Answers
PDF
Previous Question | Next Question |
Explain UNIX fork() system call. | Predict the output of the following program code? |