GATE 2016 (Session 2) Computer Science and Information Technology (CS) Questions with Solutions

GATE 2016 (Session 2)

65 questions

MCQ 38 · NAT 271-mark 30 · 2-mark 35

Questions 21–25 of 65

Q21Graph Theory1 markNAT
Breadth First Search(BFS) is started on a binary tree beginning from the root vertex. There is a vertex t at a distance four from the root. If t is the n-th vertex in this BFS traversal, then the maximum possible value of n is______ .

Q22Array and Pointer1 markNAT
The value printed by the following program is .

void f(int*p, int m){
     m =m+5;
     *p =*p+m;
      return;
}
void main(){
     int i=5, j=10;
     f(&i, j);
     printf("%d", i+j);
}

Q23Sorting1 markMCQ−0.33 if wrong
Assume that the algorithms considered here sort the input sequences in ascending order. If the input is already in ascending order, which of the following are TRUE?
I. Quicksort runs in Θ(n2)\Theta (n^{2}) time
II. Bubblesort runs in Θ(n2)\Theta (n^{2}) time
III. Merge sort runs in Θ(n)\Theta (n) time
IV. Insertion sort runs in Θ(n)\Theta (n) time

Q24Dynamic Programming1 markMCQ−0.33 if wrong
The Floyd-Warshall algorithm for all-pair shortest paths computation is based on