1.
Pid of init process
Answer: Option 'B'
1
2.
What is the default maximum number of processes that can exist in Linux?
Answer: Option 'A'
32768
3.
How do you get parent process identification number?
Answer: Option 'C'
getppid()
4.
Parent process id of a deamon process is_________________.
Answer: Option 'D'
1
5.
The process which terminates before the parent process exits becomes
Answer: Option 'A'
Zombie
6.
Return value of fork() system call can be:
Answer: Option 'B'
-1,>0, 0
7.
If the fork() system call returns -1, then it means?
Answer: Option 'A'
No new child process is created
8.
Fork returns _____ to parent process on success
Answer: Option 'B'
child process id
9.
How many times printf() will be executed in the below mentioned program?
main() { int i;<br><br> for (i = 0; i < 4; i++) fork(); printf("my pid = %d\n", getpid()); }
Answer: Option 'C'
16
10.
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; }
Answer: Option 'B'
Only parent executes the exit_handler 1 and 2