Answers

Question and Answer:

  Home  Linux Signal Handling

⟩ Which one of the following is not true about this program? #include<stdio.h> #include<signal.h> void response (int); void response (int signo) { printf("%sn",sys_siglist[signo]); signal(SIGSEGV,SIG_IGN); } int main() { signal (SIGSEGV,response); char *str; *str = 10; return 0; } a) kernel sends SIGSEGV signal to a process as segmentation fault occurs b) in this process signal handler will execute only one time of recieving the signal SIGSEGV c) both (a) and (b) d) none of the mentioned

d) none of the mentioned

Explanation:

In this process the segmentation fault occurs because the memory is not allocated to the pointer *str.

Output:

[root@localhost google]# gcc -o san san.c

[root@localhost google]# ./san

Segmentation fault

Segmentation fault (core dumped)

[root@localhost google]#

 178 views

More Questions for you: