
Correct : 64
The correct answer is 64, which is a classic result from a fork-based process creation problem.
Key concepts used:
fork() creates a new child process. The return value is:
0 → inside child process
>0 → inside parent process (returns child's PID)
<0 → fork failed
execlp() replaces the current process image with a new program. Once called successfully, the remaining code in that process is NOT executed.
wait() makes the parent process block until a child process terminates.
With n fork() calls (without exec), total processes = 2n
For the answer to be 64:
26 = 64, meaning 6 fork() calls are involved
OR the program prints a value computed as 64 through process arithmetic.
The output of the given C program = 64
Similar Questions
Total Unique Visitors