GATE 2020 Computer Science and Information Technology (CS) Questions with Solutions

GATE 2020

64 questions

MCQ 41 · NAT 231-mark 29 · 2-mark 35

Questions 56–60 of 64

Q57Heap Tree2 marksNAT
Consider the array representation of a binary min-heap containing 1023 elements. The minimum number of comparisons required to find the maximum in the heap is ___________.

Q58Function2 marksNAT
Consider the following C functions.
int tob(int b, int* arr){
   int i;
   for(i=0; b>0; i++){
      if(b%2) arr[i]=1;
      else    arr[i]=0;
      b = b/2;
   }
   return(i);

}
int pp(int a,int b) {
   int arr[20];
   int i, tot = 1, ex, len;
   ex = a;
   len = tob(b,arr);
   for(i=0; i<len; i++){
      if(arr[i]==1)
         tot = tot * ex;
      ex = ex * ex;
   }
   return(tot);
}

The value returned by pp(3,4) is _____

Q59Minimum Spanning Tree2 marksNAT
Consider a graph G=(V,E)G=(V,E), where V={v1,v2,...,v100}V=\{v_1,v_2,...,v_{100}\}, E={(vi,vj)∣1≤i<j≤100}E=\{(v_i,v_j)|1\leq i \lt j\leq 100\}, and weight of the edge (vi,vj)  is  ∣i−j∣(v_i,v_j)\; is \; |i-j|. The weight of minimum spanning tree of G is _________

Q60CPU Scheduling2 marksNAT
Consider the following set of processes, assumed to have arrived at time 0. Consider the CPU scheduling algorithms Shortest Job First (SJF) and Round Robin (RR). For RR, assume that the processes are scheduled in the order P1,P2,P3,P4P_1,P_2,P_3,P_4.
Processes P1 P2 P3 P4 Burst time (in ms) 8 7 2 4
If the time quantum for RR is 4 ms, then the absolute value of the difference between the average turnaround times (in ms) of SJF and RR (round off to 2 decimal places) is _______

Q61Finite Automata2 marksNAT
Consider the following language.

L={x∈{a,b}∗∣x \in \{a,b\}^*| number of a's in x divisible by 2 but not divisible by 3}

The minimum number of states in DFA that accepts L is _______