What will print as the SIGINT signal hits the running process of this program?
#include<stdio.h>
#include<stdlib.h>
#include<signal.h>
void response (int);
void response (int sig_no)
{
printf("%s",sys_siglist[sig_no]);
}
int main()
{
signal(SIGINT,response);
while(1){
printf("googlen");
sleep(1);
}
return 0;
}
a) Interrupt
b) Stop
c) Terminate
d) none of the mentioned
Submitted by: Murtazaa) Interrupt
Explanation:
The messages associated with signals can be access by the function sys_siglist().
Output:
[root@localhost google]# gcc -o san san.c
[root@localhost google]# ./san
google
google
google
^CInterruptgoogle
google
^CInterruptgoogle
google
^CInterruptgoogle
google
google
^Z
[4]+ Stopped ./san
[root@localhost google]#
Submitted by: Murtaza
Explanation:
The messages associated with signals can be access by the function sys_siglist().
Output:
[root@localhost google]# gcc -o san san.c
[root@localhost google]# ./san
^CInterruptgoogle
^CInterruptgoogle
^CInterruptgoogle
^Z
[4]+ Stopped ./san
[root@localhost google]#
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. |