Answer:
The solution of this question is given below in explanation section.
Explanation:
The correct answer to this question is A i.e. 112002 .
the correct code of this question is given below
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
//#include "csapp.h"
void end(void)
{
printf("2");
}
int main()
{
if (fork() == 0)
atexit(end);
if (fork() == 0)
printf("0");
else
printf("1");
exit(0);
}
/* $end forkprob2 */
when you run this program, fork function print different values.
However, it is noted that when you run the program repeatedly, it will show you different values. But the most possible value that this program will show is A.
The picture is attached of the running program to get the idea of code.