Linux Interview Questions and Answers – Process Management

DigitalOcean Referral Badge DigitalOcean Referral Badge

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 these

Answer: Option 'A'

Kernel switches from executing one process to another

DigitalOcean Referral Badge

2.

Pid of init process

   A.) 0
   B.) 1
   C.) 32767
   D.) none of these

Answer: Option 'B'

1

DigitalOcean Referral Badge

3.

What is the default maximum number of processes that can exist in Linux?

   A.) 32768
   B.) 1024 
   C.) 4096
   D.) unlimited

Answer: Option 'A'

32768

DigitalOcean Referral Badge

4.

How do you get parent process identification number?

   A.) waitpid
   B.) getpid()
   C.) getppid()
   D.) parentid()

Answer: Option 'C'

getppid()

DigitalOcean Referral Badge
    DigitalOcean Referral Badge DigitalOcean Referral Badge

5.

Parent process id of a deamon process is_________________.

   A.) 2
   B.) 3
   C.) 4
   D.) 1

Answer: Option 'D'

1

DigitalOcean Referral Badge

6.

The process which terminates before the parent process exits becomes

   A.) Zombie
   B.) Orphan
   C.) Child
   D.) None of these

Answer: Option 'A'

Zombie

DigitalOcean Referral Badge

7.

Return value of fork() system call can be:

   A.) -1,<0, 0
   B.) -1,>0, 0
   C.) -1,<0
   D.) none of these

Answer: Option 'B'

-1,>0, 0

DigitalOcean Referral Badge

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 these

Answer: Option 'A'

No new child process is created

DigitalOcean Referral Badge

9.

Fork returns _____ to parent process on success

   A.)
   B.) child process id
   C.) parent process id
   D.) none

Answer: Option 'B'

child process id

DigitalOcean Referral Badge
    DigitalOcean Referral Badge DigitalOcean Referral Badge

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

Answer: Option 'C'

16

DigitalOcean Referral Badge

Linux Interview Questions and Answers – Process Management Download Pdf

Recent Posts