Assuming that the system call fork() never fails, consider the following C…
PYQ UGC NET 2020
Assuming that the system call fork() never fails, consider the following C program 𝑃1 and 𝑃2 executed on a UNIX/Linux system:
/* P1 */
int main() {
fork();
fork();
fork();
printf("Happy\n");
}
/* P2 */
int main() {
fork();
printf("Happy\n");
fork();
printf("Happy\n");
fork();
printf("Happy\n");
}
Statement 𝐼: 𝑃1 displays “Happy” 8 times
Statement 𝐼𝐼: 𝑃2 displays “Happy” 12 times
In the light of the above statements, choose the correct answer from the options given below
- A.
Both Statement 𝐼 and Statement 𝐼𝐼 are true
- B.
Both Statement 𝐼 and Statement 𝐼𝐼 are false
- C.
Statement 𝐼 is correct but Statement 𝐼𝐼 is false
- D.
Statement 𝐼 is incorrect but Statement 𝐼𝐼 is true
Attempted by 387 students.
Sign up free to check your answer
Sign up freeLoading lesson…

