Question 13873 – UGC NET JRF November 2020 Paper-2
November 28, 2023Question 13875 – UGC NET JRF November 2020 Paper-2
November 28, 2023UGC NET JRF November 2020 Paper-2
Question 19
|
Assuming that the system call fork () never fails, consider the following C programs P1 and P2 executed on a UNIX/ Linux system:
Statement I: P1 displays “Happy” 8 times.
Statement II: P2 displays “Happy” 12 times.
In the light of the above statements, choose the correct answer from the options given below:
![](https://solutionsadda.in/wp-content/uploads/2020/11/table.jpg)
Statement I: P1 displays “Happy” 8 times.
Statement II: P2 displays “Happy” 12 times.
In the light of the above statements, choose the correct answer from the options given below:
Both Statement I and Statement II are true
|
|
Both Statement I and Statement II are false
|
|
Statement I is correct but Statement II is false
|
|
Statement I is incorrect but Statement II is true
|
Question 19 Explanation:
As we know that “n” fork calls will lead to 2n-1child processes. Hence Total no. of process will be 2n-1+1(We added 1 for the parent process).
Now since in P1 all 3 fork calls are done before the printf statement so all 8( 23-1+1) processes will execute the Printf statement. Hence in P1 Printf statement will be executed for 8 times.
Now since in P1 all 3 fork calls are done before the printf statement so all 8( 23-1+1) processes will execute the Printf statement. Hence in P1 Printf statement will be executed for 8 times.
Correct Answer: C
Question 19 Explanation:
As we know that “n” fork calls will lead to 2n-1child processes. Hence Total no. of process will be 2n-1+1(We added 1 for the parent process).
Now since in P1 all 3 fork calls are done before the printf statement so all 8( 23-1+1) processes will execute the Printf statement. Hence in P1 Printf statement will be executed for 8 times.
Now since in P1 all 3 fork calls are done before the printf statement so all 8( 23-1+1) processes will execute the Printf statement. Hence in P1 Printf statement will be executed for 8 times.
Subscribe
Login
0 Comments