This set of Data Structures & Algorithms Multiple Choice Questions & Answers (MCQs) focuses on “Binary Tree Operations”.
1. What is the maximum number of children that a binary tree node can have?
Explanation: In a binary tree, a node can have atmost 2 nodes (i.e.) 0,1 or 2 left and right child.
Explanation: The given tree is an example for binary search since the tree has got two children and the left and right children do not satisfy binary search tree’s property.
3. A binary tree is a rooted tree but not an ordered tree.
Explanation: A binary tree is a rooted tree and also an ordered tree (i.e) every node in a binary tree has at most two children.
4. How many common operations are performed in a binary tree?
Explanation: Three common operations are performed in a binary tree- they are insertion, deletion and traversal.
5. What is the traversal strategy used in the binary tree?
a) depth-first traversal
b) breadth-first traversal
c) random traversal
d) preorder traversal
Explanation: Breadth first traversal, also known as level order traversal is the traversal strategy used in a binary tree. It involves visiting all the nodes at a given level.
6. How many types of insertion are performed in a binary tree?
Explanation: Two kinds of insertion operation is performed in a binary tree- inserting a leaf node and inserting an internal node.
Explanation: The above diagram is a depiction of deleting a node with 0 or 1 child since the node D which has 1 child is deleted.
8. General ordered tree can be encoded into binary trees.
Explanation: General ordered tree can be mapped into binary tree by representing them in a left-child-right-sibling way.
9. How many bits would a succinct binary tree occupy?
Explanation: A succinct binary tree occupies close to minimum possible space established by lower bounds. A succinct binary tree would occupy 2n+O(n) bits.
10. The average depth of a binary tree is given as?
d) O(log N)
Explanation: The average depth of a binary tree is given as O(√N). In case of a binary search tree, it is O(log N).
11. How many orders of traversal can be applied to a binary tree?
Explanation: The three orders of traversal that can be applied to a binary tree are in-order, pre-order and post order traversal.
12. If binary trees are represented in arrays, what formula can be used to locate a left child, if the node has an index i?
Explanation: If binary trees are represented in arrays, left children are located at indices 2i+1 and right children at 2i+2.
13. Using what formula can a parent node be located in an array?
Explanation: If a binary tree is represented in an array, parent nodes are found at indices (i-1)/2.
Sanfoundry Global Education & Learning Series – Data Structure.
To practice all areas of Data Structure, here is complete set of 1000+ Multiple Choice Questions and Answers.