Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews Linux OS Interviews:Awk ProgrammingBash Arithmetic ExpressionsDevice DriversGCC CompilerLinux AdministratorLinux CommandsLinux DebuggingLinux EnvironmentLinux GeneralLinux IPCLinux MakefileLinux OSLinux OS EditorsLinux OS ManagementLinux OS ShellLinux Proc FilesystemLinux Search PatternLinux Shared & Static LibrariesLinux Socket ProgrammingLinux Startup and ShutdownLinux SysfsLinux SystemsLinux ThreadsLinux UbuntuSignal HandlingSystem Calls
Copyright © 2018. All Rights Reserved
Signal Handling Interview Question:
What is the output of this program?
#include<stdio.h>
#include<signal.h>
void response (int);
void response (int sig_no)
{
printf("%sn",sys_siglist[sig_no]);
}
int main()
{
pid_t child;
int status;
child = fork();
switch(child){
case -1:
perror("fork");
case 0:
break;
default :
signal(SIGCHLD,response);
wait(&status);
break;
}
}
a) this program will print nothing
b) this program will print "Child Exited"
c) segmentation fault
d) none of the mentioned
Submitted by: Murtazab) this program will print "Child Exited"
Explanation:
The child process sends SIGCHILD signal to its parent as it terminates.
Output:
[root@localhost google]# gcc -o san san.c
[root@localhost google]# ./san
Child exited
[root@localhost google]#
Submitted by: Murtaza
Explanation:
The child process sends SIGCHILD signal to its parent as it terminates.
Output:
[root@localhost google]# gcc -o san san.c
[root@localhost google]# ./san
Child exited
[root@localhost google]#
Submitted by: Murtaza
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.