GATE CS Applied Course

GATE Previous Year Wise Questions

GATE Previous Subject Wise Questions

Question 41
Consider a binary max-heap implemented using an array. Which one of the following array represents a binary max-heap?
A
25,12,16,13,10,8,14
B
25,14,13,16,10,8,12
C
25,14,16,13,10,8,12
D
25,14,12,13,10,8,16
Data Structures gate 2009 Heap-Tree
Question 42
Consider a binary max-heap implemented using an array. What is the content of the array after two delete operations on the correct answer to the previous question?
A
14,13,12,10,8
B
14,12,13,8,10
C
14,13,8,12,10
D
14,13,12,8,10
Data Structures gate 2009 Heap-Tree
Question 43
In a binary tree with n nodes, every node has an odd number of descendants. Every node is considered to be its own descendant. What is the number of nodes in the tree that have exactly one child?
A
0
B
1
C
(n-1)/2
D
n-1
Data Structures gate 2010 Binary-Trees
Question 44

What is the minimum possible weight of a path P from vertex 1 to vertex 2 in this graph such that P contains at most 3 edges?
A
7
B
8
C
9
D
10
Data Structures gate 2010 Graphs
Question 45

Which one of the following choices gives a possible order in which the key values could have been inserted in the table?
A
46, 42, 34, 52, 23, 33
B
34, 42, 23, 52, 33, 46
C
46, 34, 42, 23, 52, 33
D
42, 46, 33, 23, 34, 52
Data Structures Hashing gate 2010
Question 46
The most efficient algorithm for finding the number of connected components in an undirected graph on n vertices and m edges has time complexity
A
θ(n)
B
θ(m)
C
θ(m+n)
D
θ(mn)
Data Structures Graphs GATE 2008 CS
Question 47
The Breadth First Search algorithm has been implemented using the queue data structure. One possible order of visiting the nodes of the following graph is
  
A
MNOPQR
B
NQMPOR
C
QMNPRO
D
QMNPOR
Data Structures GATE 2017 SET2 Graphs GATE 2008 CS
Question 48
G is a graph on n vertices and 2n – 2 edges. The edges of G can be partitioned into two edge-disjoint spanning trees. Which of the following is NOT true for G?
A
For every subset of k vertices, the induced subgraph has at most 2k–2 edges
B
The minimum cut in G has at least two edges
C
There are two edge-disjoint paths between every pair to vertices
D
There are two vertex-disjoint paths between every pair of vertices
Data Structures Graphs GATE 2008 CS
Question 49
You are given the postorder traversal, P, of a binary search tree on the n elements 1, 2, ..., n. You have to determine the unique binary search tree that has P as its postorder traversal. What is the time complexity of the most efficient algorithm for doing this?
A
θ(log n)
B
θ(n)
C
θ(nlog n)
D
None of the above, as the tree cannot be uniquely determined
Data Structures Binary-Trees GATE 2008 CS
Question 50
We have a binary heap on n elements and wish to insert n more elements (not necessarily one after another) into this heap. The total time required for this is
A
θ(log n)
B
θ(n)
C
θ(nlog n)
D
θ(n2)
Data Structures Heap-Tree GATE 2008 CS
Question 51
A max-heap is a heap where the value of each parent is greater than or equal to the value of its children. Which of the following is a max-heap?  
A
B
C
D
Data Structures gate 2011
Question 52
Consider the DAG with Consider V = {1, 2, 3, 4, 5, 6}, shown below. Which of the following is NOT a topological ordering? 
A
1 2 3 4 5 6
B
1 3 2 4 5 6
C
1 3 2 4 6 5
D
3 2 4 1 6 5
Data Structures Graphs GATE 2007 CS
Question 53
The height of a binary tree is the maximum number of edges in any root to leaf path. The maximum number of nodes in a binary tree of height h is:
A
2h−1
B
2h−1 – 1
C
2h+1– 1
D
2h+1
Data Structures Binary-Trees GATE 2007 CS
Question 54
The maximum number of binary trees that can be formed with three unlabeled nodes is:
A
1
B
5
C
4
D
3
Data Structures Binary-Trees GATE 2007 CS
Question 55
The following postfix expression with single digit operands is evaluated using a stack:
8 2 3 ^ / 2 3 * + 5 1 * -
Note that ^ is the exponentiation operator. The top two elements of the stack after the first * is evaluated are:
A
6, 1
B
5, 7
C
3, 2
D
1, 5
Data Structures GATE 2007 CS Stacks
Question 56
The inorder and preorder traversal of a binary tree are d b e a f c g and a b d e c f g, respectively. The postorder traversal of the binary tree is:
A
d e b f g c a
B
e d b g f c a
C
e d b f g c a
D
d e f g b c a
Data Structures Binary-Trees GATE 2007 CS
Question 57
Consider a hash table of size seven, with starting index zero, and a hash function (3x + 4) mod 7. Assuming the hash table is initially empty, which of the following is the contents of the table when the sequence 1, 3, 8, 10 is inserted into the table using closed hashing? Note that ‘_’ denotes an empty location in the table.
A
8, _, _, _, _, _, 10
B
1, 8, 10, _, _, _, 3
C
1, _, _, _, _, _,3
D
1, 10, 8, _, _, _, 3
Data Structures Hashing GATE 2007 CS
Question 58
A complete n-ary tree is a tree in which each node has n children or no children. Let I be the number of internal nodes and L be the number of leaves in a complete n-ary tree. If L = 41, and I = 10, what is the value of n?
A
3
B
4
C
5
D
6
Data Structures GATE 2007 CS
Question 59
Consider the following C program segment where CellNode represents a node in a binary tree:

struct CellNode
{
  struct CellNOde *leftChild;
  int element;
  struct CellNode *rightChild;
};
int GetValue(struct CellNode *ptr)
{
  int value = 0;
  if (ptr != NULL)
  {
   if ((ptr->leftChild == NULL) &&
        (ptr->rightChild == NULL))
      value = 1;
   else
      value = value + GetValue(ptr->leftChild)
                   + GetValue(ptr->rightChild);
  }
  return(value);
}

The value returned by GetValue() when a pointer to the root of a binary tree is passed as its argument is:
A
the number of nodes in the tree
B
the number of internal nodes in the tree
C
the number of leaf nodes in the tree
D
the height of the tree
Data Structures Binary-Trees GATE 2007 CS
Question 60
Consider the process of inserting an element into a Max Heap, where the Max Heap is represented by an array. Suppose we perform a binary search on the path from the new leaf to the root to find the position for the newly inserted element, the number of comparisons performed is:  
A
θ(log2n)
B
θ(log2log2n)
C
θ(n)
D
θ(nlog2n)
Data Structures Heap-Tree GATE 2007 CS
© 2025 - All rights are reserved- AAIC Technologies pvt ltd