Basic Computer Knowledge Test Questions and Answers

Linux Debugging Questions & Answers – fork, exec and wait System Calls

1.

What is the output of this progarm?

  1.     #include<stdio.h>
  2.     #include<unistd.h>
  3. 
     
  4.     int main()
  5.     {
  6.         pid_t child;
  7.         int a, b;
  8.         a = 10;
  9.         b = 20;
  10.         child = fork();
  11.         a = a + b;
  12.         if(child > 0){
  13.             printf("%d\n",a);
  14.         } 
  15.         return 0;
  16.     }

   A.) 10
   B.) 30
   C.) 50
   D.) none of these

Answer: Option 'B'

30

Linux Debugging Questions & Answers – fork, exec and wait System Calls Download Pdf

Recent Posts