What is the output of the below code?
void exit_handler1();
void exit_handler2();
int main() {
int pid;
atexit(exit_handler1);
atexit(exit_handler2);
pid = fork();
if(pid == 0) {
_exit(0);
} else {
sleep(2);
exit(0);
}
return 0;
}
a) Only child executes the exit_handler 1 and 2.
b) Only parent executes the exit_handler 1 and 2.
c) Both parent and child executes the exit_handler 1 and 2.
d) Neither parent nor child executes the exit_handler 1 and 2.
Submitted by: Murtazab) Only parent executes the exit_handler 1 and 2.
Submitted by: Murtaza
Submitted by: Murtaza
Read Online Linux OS Management Job Interview Questions And Answers
Top Linux OS Management Questions
☺ | Which option of rmdir command will remove all directories a, b, c if path is a/b/c: |
☺ | Which of the following time stamps need not exist for a file on traditional unix file system: |
☺ | When mv f1 f2 is executed which file\'s inode is freed? |
☺ | What is the default maximum number of processes that can exist in Linux? |
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. |