GATE Solved Paper 2017-19 - GATE 2019

26. Which of the following protocol pairs can be used to send and retrieve e-mails (in that order)?

  • Option : B
  • Explanation :
    SMTP is push protocol and to send email and POP3 is pull protocol i.e. to retrieve email.
Cancel reply
Cancel reply

27. The following C program is executed on a Unix/Linux system:

 int main()
 {
 int i;
 for (i=0; i<10; i++)
 if (i%2 == 0) fork();
 return 0;
 }
 The total number of child processes created is ________.

Note – Numerical Type question

  • Option : A
  • Explanation :
    Condition “if” will be satisfy for i = 0, 2, 4, 6, 8 only. So, “fork()” will call for 5 times.
    Total number of processes created is,
    = 2number of fork()
    There is always only one parent process of these processes and remaining will be child processes.
    Hence number of child process created is,
    = 2number of fork() - 1
    = 25 - 1
    = 32 - 1
    = 31
    So, option (A) is correct
Cancel reply
Cancel reply

28. Consider the following C program:

 int jumble(int x, int y){
 x=2*x+y;
 return x;
 }
 int main(){
 int x=2, y=5;
  y=jumble(y,x);
  x=jumble(y,x);
  printf(“%d \n”, x);
  return 0;
  }
  The value printed by the program is _______.

Note – Numerical Type question

  • Option : A
  • Explanation :
    Given, “for” loop will run from i=0 to 4.
    i = 0
    sum = 0+ 10 – 10 = 0
    i = 1
    sum = 0 + 9 – 8 = 1
    i = 2
    sum = 1 + 8 – 6 = 3
    i = 3
    sum = 3 + 7 – 4 = 6
    i = 4
    sum = 6 + 6 – 2 = 10
    Now, loop terminate and value of sum (i.e., 10) will be printed.
    So, The output of above C program is 10.
Cancel reply
Cancel reply

30. An array of 25 distinct elements is to be sorted using quicksort. Assume that the pivot element is chosen uniformly at random. The probability that the pivot element gets placed in the worst possible location in the first round of partitioning (rounded off to 2 decimal places) is ________.

  • Option : A
  • Explanation :
    Given an array of 25 distinct elements, and pivot element is chosen uniformly randomly. So, there are only 2 worst case position in the pivot element is either first (or) last.
    Therefore, required probability is,
    = 2/25
    = 0.08
    So, option (A) is correct.
Cancel reply
Cancel reply