Linux Interview Questions and Answers – Process Management

Basic Computer Knowledge Test Questions and Answers

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

Answer: Option 'B'

Only parent executes the exit_handler 1 and 2

Basic Computer Knowledge Test Questions and Answers

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

Answer: Option 'C'

“leaf child” will be printed 4 times

Basic Computer Knowledge Test Questions and Answers

13.

Which niceness value among the following indicate most favorable scheduling?

   A.) 0
   B.) 19
   C.) 5
   D.) -20

Answer: Option 'D'

-20

Basic Computer Knowledge Test Questions and Answers

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

Answer: Option 'D'

600ms

Basic Computer Knowledge Test Questions and Answers

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 these

Answer: Option 'B'

decrease the priority of a process

Linux Interview Questions and Answers – Process Management Download Pdf

Recent Posts