Linux Interview Questions and Answers – Signal Handling

Here is a listing of Linux / Unix Technical Interview Questions & Answers for experienced IT professionals as well as fresh engineering graduates. These questions can be attempted by anyone focusing on Linux Development and Systems programming.

1. If a signal is received by a process, when will it be processed?
a) It is processed immediately
b) It is processed when process is switching to kernel mode
c) It is processsed in the next timeslice given to the process
d) None of the mentioned
View Answer

Answer: b
Explanation: None.

2. Which signal is generated when we press control-C?
a) SIGINT
b) SIGTERM
c) SIGKILL
d) SIGSEGV
View Answer

Answer: a
Explanation: None.

3. Which signal is generated when we press ctrl-Z?
a) SIGKILL
b) SIGSTOP
c) SIGABRT
d) SIGINT
View Answer

Answer: b
Explanation: None.

4. Which signal is sent when the Child process terminates?
a) SIGINIT
b) SIGKILL
c) SIGSTOP
d) SIGCHLD
View Answer

Answer: d
Explanation: None.
advertisement
advertisement

5. Which of the following signal cannot be handled or ignored?
a) SIGINT
b) SIGCHLD
c) SIGKILL
d) SIGALRM
View Answer

Answer: c
Explanation: None.

6. Another signal that cannot be caught is:
a) SIGPIPE
b) SIGHUP
c) SIGSTOP
d) SIGUSR1
View Answer

Answer: c
Explanation: None.
Note: Join free Sanfoundry classes at Telegram or Youtube

7. When real interval timer expires which signal is generated?
a) SIGINT
b) SIGCHLD
c) SIGKILL
d) SIGALRM
View Answer

Answer: d
Explanation: None.

8. Signals are handled using which system call?
a) kill
b) signal
c) both
d) none
View Answer

Answer: b
Explanation: None.
advertisement

9. Default action of SIGSEGV is
a) Terminate
b) Core dump + Terminate
c) Stop
d) Cont
View Answer

Answer: b
Explanation: None.

10. The kill system call is used to
a) Send shutdown messages to all by superuser
b) Send a signal to a process
c) Kill processes
d) Stop the processes
View Answer

Answer: b
Explanation: None.
advertisement

11. What is the output of the below code?

    void sig_handler ( int signum) {
        printf(“Handled the signal\n”);
    }
 
    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
View Answer

Answer: d
Explanation: None.

Sanfoundry Global Education & Learning Series – Linux Administration & Programming.

Learn detailed answer of these interview questions and an in-depth coverage on Linux Systems Programming by our popular training program titled Linux Systems Programming delivered by our Founder & CTO.

Read here to know more about the skills required to become a Linux Systems Developer.

Here’s the list of Best Books in Linux Commands & Shell Programming.
Here’s the list of Best Books in Linux Kernel, Device-Drivers & System Programming.

To practice all questions on Linux Administration & Programming, here is complete set of 1000+ Multiple Choice Questions and Answers on Linux. These questions focuses on Process Management, Memory Management, File Management, Inter Process Communications, Signal Handling, etc.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.