Signal Handling Interview Preparation Guide

Signal Handling frequently Asked Questions in various Linux Signal Handling job Interviews by interviewer. The set of questions here ensures that you offer a perfect answer posed to you. So get preparation for your new job hunting
Tweet Share WhatsApp

21 Linux Signal Handling Questions and Answers:

7 :: This program will print:

#include<stdio.h>
#include<signal.h>
#include<unistd.h>

void response (int);
void response (int sig_no)
{
printf("%s is workingn",sys_siglist[sig_no]);
}
int main()
{
alarm(5);
sleep(50);
printf("googlen");
signal(SIGALRM,response);
return 0;
}
a) "google"
b) "Alarm clock"
c) nothing
d) none of the mentioned

b) "Alarm clock"
Explanation:After 5 seconds of the execution of this program, the signal SIGALRM hits the process and handler executes.
Output:
[root@localhost google]# gcc -o san san.c
[root@localhost google]# ./san
Alarm clock
[root@localhost google]#