Vidyalelo
Computer Science · Q493

Linux

Engineering and GATE · Computer Science · question 493

Q493

In this program #include #include #include int main() pid_t child; child=fork(); switch(child) case -1 : perror("fork"); exit(1); case 0 : while(1) printf("Child Process "); sleep(1); break; default : sleep(5); kill(child,SIGINT); printf("The child process has been killed by the parent process "); break; return 0;

A.
the child process kills the parent process
B.
the parent process kills the child process
Answer
C.
both the processes are killed by each other
D.
none of the mentioned

Answer: Option B

Solution

Answer: Option B
No explanation is given for this question Let's Discuss on Board