What is the output of the below code?
void sig_handler ( int signum) {
printf("Handled the signaln");
}
int main() {
int pid;
signal (SIGKILL, sig_handler);
pid = fork();
if (pid==0) {
kill(getppid(), SIGKILL);
exit(0);
} else {
sleep(20);
}
return 0;
}
a) Error child cannot send a SIGKILL signal to parent.
b) Parent goes to the signal handler, prints handled the signal and goes back to sleep
c) Parent goes to the signal handler, prints handled the signal and exits
d) Parent exits without going to the signal handler
Submitted by: Murtazad) Parent exits without going to the signal handler
Submitted by: Murtaza
Submitted by: Murtaza
Read Online Signal Handling Job Interview Questions And Answers
Top Signal Handling Questions
☺ | Signals are handled using which system call? |
☺ | Default action of SIGSEGV is: |
☺ | Which signal is sent when the Child process terminates? |
☺ | The kill system call is used to: |
☺ | Which of the following signal cannot be handled or ignored? |
Top Linux OS Categories
☺ | Device Drivers Interview Questions. |
☺ | Linux OS Management Interview Questions. |
☺ | Linux Makefile Interview Questions. |
☺ | Linux Environment Interview Questions. |
☺ | Linux OS Shell Interview Questions. |