• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

GATE-CS-2016 (Set 2)

Question 41

A complete binary min-heap is made by including each integer in [1, 1023] exactly once. The depth of a node in the heap is the length of the path from the root of the heap to that node. Thus, the root is at depth 0. The maximum depth at which integer 9 can appear is _____________

  • 6

  • 7

  • 8

  • 9

Question 42

Consider the following New-order strategy for traversing a binary tree: Visit the root; Visit the right subtree using New-order Visit the left subtree using New-order The New-order traversal of the expression tree corresponding to the reverse polish expression 3 4 * 5 - 2 ˆ 6 7 * 1 + - is given by:
  • + - 1 6 7 * 2 ˆ 5 - 3 4 *
  • - + 1 * 6 7 ˆ 2 - 5 * 3 4
  • - + 1 * 7 6 ˆ 2 - 5 * 4 3
  • 1 7 6 * + 2 5 4 3 * - ˆ -

Question 43

Consider the following program: C
int f(int *p, int n)
{
    if (n <= 1) return 0;
    else return max(f(p+1,n-1),p[0]-p[1]);
}
int main()
{
    int a[] = {3,5,2,6,4};
    printf(\"%d\", f(a,5));
}
Note: max(x,y) returns the maximum of x and y. The value printed by this program is
  • 2
  • 3
  • 4
  • 5

Question 44

Let A1, A2, A3, and A4 be four matrices of dimensions 10 x 5, 5 x 20, 20 x 10, and 10 x 5, respectively. The minimum number of scalar multiplications required to find the product A1A2A3A4 using the basic matrix multiplication method is

  • 1500

  • 2000

  • 500

  • 100

Question 45

The given diagram shows the flowchart for a recursive function A(n). Assume that all statements, except for the recursive calls, have O(1) time complexity. If the worst case time complexity of this function is O(nα), then the least possible value (accurate up to two decimal positions) of α is __________ z9
  • 2.2 to 2.4
  • 3.2 to 3.4
  • 0 to 1.8
  • 1

Question 46

The number of ways in which the numbers 1, 2, 3, 4, 5, 6, 7 can be inserted in an empty binary search tree, such that the resulting tree has height 6, is _____________ Note: The height of a tree with a single node is 0. [This question was originally a Fill-in-the-Blanks question]
  • 2
  • 4
  • 64
  • 32

Question 47

In an adjacency list representation of an undirected simple graph G = (V, E), each edge (u, v) has two adjacency list entries: [v] in the adjacency list of u, and [u] in the adjacency list of v. These are called twins of each other. A twin pointer is a pointer from an adjacency list entry to its twin. If |E| = m and |V | = n, and the memory size is not a constraint, what is the time complexity of the most efficient algorithm to set the twin pointer in each entry in each adjacency list?
  • Θ(n2)
  • Θ(m+n)
  • Θ(m2)
  • Θ(n4)

Question 48

Consider the following two statements:
I. If all states of an NFA are accepting 
   states then the language accepted by 
   the NFA is Σ∗ .
II. There exists a regular language A such 
    that for all languages B, A ∩ B is regular. 
Which one of the following is CORRECT?
  • Only I is true
  • Only II is true
  • Both I and II are true
  • Both I and II are false

Question 49

Consider the following languages: L1 = {anbmcn : m, n >= 1} L2 = {anbnc2n : n >= 1} Which one of the following is TRUE?
  • Both L1 and L2 are context-free.
  • L1 is context-free while L2 is not context-free.
  • L2 is context-free while L1 is not context-free.
  • Neither L1 nor L2 is context-free.

Question 50

Consider the following languages.
L1 = {   | M takes at least 2016 steps on some input},
L2 = {   | M takes at least 2016 steps on all inputs} and
L3 = {   | M accepts ε},
where for each Turing machine M, denotes a specific encoding of M. Which one of the following is TRUE?
  • L1 is recursive and L2, L3 are not recursive
  • L2 is recursive and L1, L3 are not recursive
  • L1, L2 are recursive and L3 is not recursive
  • L1, L2, L3 are recursive

There are 65 questions to complete.

Last Updated :
Take a part in the ongoing discussion