Binary Tree: GATE CS Previous Year Questions

Binary Tree · Data Structures

35 questions · asked in 17 of 27 years (2000–2026)

MCQ 27 · NAT 81-mark 26 · 2-mark 9

2000Questions per year2026

Questions 16–20 of 35

Q16GATE 20101 markMCQ−0.33 if wrong
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?

Q17GATE 20082 marksMCQ−0.67 if wrong
A binary tree with n>1 nodes has n1n_{1}, n2n_{2} and n3n_{3} nodes of degree one, two and three respectively. The degree of a node is defined as the number of its neighbors.
Starting with the above tree, while there remains a node v of degree two in the tree, add an edge between the two neighbors of v and then remove v from the tree. How many edges will remain at the end of the process?

Q18GATE 20082 marksMCQ−0.67 if wrong
A binary tree with n>1 nodes has n1n_{1}, n2n_{2} and n3n_{3} nodes of degree one, two and three respectively. The degree of a node is defined as the number of its neighbors.

n3n_{3} can be expressed as

Q19GATE 20082 marksMCQ−0.67 if wrong
The following three are known to be the preorder, inorder and postorder sequences of a binary tree. But it is not known which is which.
I.MBCAFHPYK
II.KAMCBYPFH
III.MABCKYFPH
Pick the true statement from the following.

Q20GATE 20071 markMCQ−0.33 if wrong
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:

Keep practising

Topics in Data Structures

All CS topics ›