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

GATE 2017 (Session 2)

65 questions

MCQ 45 · NAT 201-mark 30 · 2-mark 35

Questions 46–50 of 65

Q46Binary Search Tree2 marksMCQ−0.67 if wrong
The pre-order transversal of a binary search tree is given by 12, 8, 6, 2, 7, 9, 10, 16, 15, 19, 17, 20. Then the post-order traversal of this tree is:

Q47Loop2 marksMCQ−0.67 if wrong
Consider the C program fragment below which is meant to divide x by y using repeated subtractions. The variables x, y, q and r are all unsigned int.
while (r >= y) {
r = r - y;
q = q +1;
}
Which of the following conditions on the variables x, y, q and r before the execution of the fragment will ensure that the loop terminates in a state satisfying the condition x==(y*q+r)?

Q48Asymptotic Notation2 marksMCQ−0.67 if wrong
Consider the following C function

int fun (int n) {
  int i, j;
  for (i = 1; i <= n; i++) {
      for (j = 1 ; j < n ; j+=i) {
          printf ("%d %d ", i, j);
          }
     }
}
The time complexity of fun in terms of θ\theta notation is

Q49Finite Automata2 marksMCQ−0.67 if wrong
Let δ\delta denote that transition function and δ^\hat{\delta} denote the extended transition function of the ϵ\epsilon- NFA whose transition table is given below:
δ a b → q0 q1 q2 q3 {q2} {q1} {q0} {q2} {q2} {q3} {q0} {q2}
Then δ^(q2,aba)\hat{\delta}(q_{2},aba) is ____

Q50Context Free Language2 marksMCQ−0.67 if wrong
Consider the following languages

L1={ap∣pL_{1}=\{a^{p}|p is a prime number}
L2={anbmc2m∣n≥0,m≥0}L_{2}=\{a^{n}b^{m}c^{2m}|n\geq 0,m\geq 0\}
L3={anbnc2n∣n≥0}L_{3}=\{a^{n}b^{n}c^{2n}|n\geq 0\}
L4={anbn∣n≥1}L_{4}=\{a^{n}b^{n}|n\geq 1\}

Which of the following are CORRECT ?

I.L1L_{1} is context-free but not regular.
II. L2L_{2} is not context-free.
III. L3L_{3} is not context-free but recursive.
IV. L4L_{4} is deterministic context-free.