Linux Interview Questions and Answers – Process Management

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. What is a context switch?
a) Kernel switches from executing one process to another
b) Process switches from kernel mode to user mode
c) Process switches from user mode to kernel mode
d) None of the mentioned
View Answer

Answer: a
Explanation: None.

2. Pid of init process
a) 0
b) 1
c) 32767
d) none of the mentioned
View Answer

Answer: b
Explanation: None.

3. What is the default maximum number of processes that can exist in Linux?
a) 32768
b) 1024
c) 4096
d) unlimited
View Answer

Answer: a
Explanation: None.
advertisement
advertisement

4. How do you get parent process identification number?
a) waitpid
b) getpid()
c) getppid()
d) parentid()
View Answer

Answer: c
Explanation: None.

5. Parent process id of a deamon process is_________________
a) 2
b) 3
c) 4
d) 1
View Answer

Answer: d
Explanation: None.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

6. The process which terminates before the parent process exits becomes
a) Zombie
b) Orphan
c) Child
d) None of the mentioned
View Answer

Answer: a
Explanation: None.

7. Return value of fork() system call can be:
a) -1,<0, 0
b) -1,>0, 0
c) -1,<0
d) none of the mentioned
View Answer

Answer: b
Explanation: None.
advertisement

8. If the fork() system call returns -1, then it means?
a) No new child process is created
b) The child process is an orphan
c) The child process is in Zombie
d) none of the mentioned
View Answer

Answer: a
Explanation: None.

9. Fork returns _____ to parent process on success
a) 0
b) child process id
c) parent process id
d) none
View Answer

Answer: b
Explanation: None.
advertisement

10. 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());
}

a) 4
b) 8
c) 16
d) 32
View Answer

Answer: c
Explanation: None.

11. 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
View Answer

Answer: b
Explanation: None.

12. What is output of the following program?

 int main() 
 {     
	fork();       
	fork();        
	fork();       
	if (wait(0) == -1)          
	printf("leaf child\n");  
 }

a) “leaf child” will be printed 1 times
b) “leaf child” will be printed 3 times
c) “leaf child” will be printed 4 times
d) “leaf child” will be printed 8 times
View Answer

Answer: c
Explanation: None.

13. Which niceness value among the following indicate most favorable scheduling?
a) 0
b) 19
c) 5 
d) -20
View Answer

Answer: d
Explanation: None.

14. The maximum time slice that can be given to a process in Linux (where tick is 10ms) is
a) 150ms
b) 10ms
c) 300 ms
d) 600ms
View Answer

Answer: d
Explanation: None.

15. Nice can be used by an ordinary process to
a) increase the priority of a process
b) decrease the priority of a process
c) increase or decrease the priority of a process
d) none of the mentioned
View Answer

Answer: b
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.