Binary Tree Operations Multiple Choice Questions and Answers (MCQs)

This set of Data Structures & Algorithms Multiple Choice Questions & Answers (MCQs) focuses on “Binary Tree Operations”.

1. How many types of insertion are performed in a binary tree?
A) 1
B) 2
C) 3
D) 4

Explanation: In a binary tree, there are two types of insertion operations: inserting a leaf node and inserting an internal node.

2. What operation does the following diagram depict?

A) inserting a leaf node
B) inserting an internal node
C) deleting a node with 0 or 1 child
D) deleting a node with 2 children

Explanation: Since node D, which has one child, is deleted, the above diagram depicts deleting a node with 0 or 1 child.

3. General ordered tree can be encoded into binary trees.
A) true
B) false

Explanation: By representing them in a left-child-right-sibling manner, a general ordered tree can be mapped into a binary tree.

4. How many bits would a succinct binary tree occupy?
A) n+O(n)
B) 2n+O(n)
C) n/2
D) n

Explanation: A compact binary tree takes up as little space as possible, as determined by lower bounds. A compact binary tree will be 2n+O(n) bits long.

5. The average depth of a binary tree is given as?
A) O(N)
B) O(√N)
C) O(N2)
D) O(log N)

Explanation: A binary tree’s average depth is given as O(N). It is O in the case of a binary search tree (log N).

6. How many orders of traversal are applicable to a binary tree (In General)?
A) 1
B) 4
C) 2
D) 3

Explanation: In-order, pre-order, and post-order traversal are the three types of traversal that can be used on a binary tree.

7. If binary trees are represented in arrays, what formula can be used to locate a left child, if the node has an index i?
A) 2i+1
B) 2i+2
D) 2i
D) 4i

Explanation: When binary trees are represented as arrays, the left children are indexed 2i+1 and the right children are indexed 2i+2.

8. Using what formula can a parent node be located in an array?
A) (i+1)/2
B) (i-1)/2
C) i/2
D) 2i/2

Explanation: In an array representation of a binary tree, parent nodes are located at indices (i-1)/2.

9. Which of the following properties are obeyed by all three tree – traversals?
A) Left subtrees are visited before right subtrees
B) Right subtrees are visited before left subtrees
C) Root node is visited before left subtree
D) Root node is visited before right subtree

Explanation: Left subtrees are visited before right subtrees in preorder, inorder, and postorder traversal. The Left subtree is visited first, followed by the Root node, and finally the Right subtree in inorder traversal. The Left subtree is visited first, followed by the Right subtree, and finally the Root node in postorder traversal.

10. Construct a binary tree using the following data.
The preorder traversal of a binary tree is 1, 2, 5, 3, 4. The inorder traversal of the same binary tree is 2, 5, 1, 4, 3.

A) 

binary-tree-operations-multiple-choice-questions-answers-mcqs-q15a


B)

binary-tree-operations-multiple-choice-questions-answers-mcqs-q15b

c) 

binary-tree-operations-multiple-choice-questions-answers-mcqs-q15c


D) 

binary-tree-operations-multiple-choice-questions-answers-mcqs-q15d



Explanation: Here,
Preorder Traversal is 1, 2, 5, 3, 4
Inorder Traversal is 2, 5, 1, 4, 3
Root node of binary tree is the first node in Preorder traversal.
The rough sketch of tree is:

binary-tree-operations-multiple-choice-questions-answers-mcqs-q15e

Second node in preorder traversal is 2. This makes 5 as right child to node 2. The fourth node in preorder traversal is 3. This makes 4 as right child to node 3. Thus the final tree is:

binary-tree-operations-multiple-choice-questions-answers-mcqs-q15d

11. What is the maximum number of children that a binary tree node can have?
A) 0
B)1
C) 2
D) 3
Explanation: In a binary tree, a node can have atmost 2 nodes (i.e.) 0,1 or 2 left and right child.

12. The following given tree is an example for?
binary-tree-operations-questions-answers-q2

A) Binary tree
B) Binary search tree
C) Fibonacci tree
D) AVL tree
Explanation: Since it has two children and the left and right children do not satisfy the binary search tree’s property, Fibonacci and AVL trees, the given tree is an example of a binary tree

13. A binary tree is a rooted tree but not an ordered tree.
A) true
B) false
Explanation: A binary tree is both a rooted and an ordered tree (each node in a binary tree has a maximum of two children).

14. How many common operations are performed in a binary tree?
A) 1
B) 2
C) 3
D) 4
Explanation: Insertion, deletion, and traversal are the three most common operations in a binary tree.

15. What is the traversal strategy used in the binary tree?
A) depth-first traversal
B) breadth-first traversal
C) random traversal
D) Priority traversal
Explanation: The traversal technique used in a binary tree is breadth first traversal, also known as level order traversal. It entails visiting all nodes at a specific stage.

A binary tree is a unique data structure. Any node in a binary tree can have a maximum of two children, known as Left Child and Right Child. It’s a way of arranging and locating records in a database, especially when all of the data is known to be in random access memory (RAM). Binary Search Tree – A binary search tree is used in many search applications where data is continually entering and exiting, such as the map and set objects used in many languages’ libraries. Almost every 3D video game uses binary space partitioning to decide which objects need to be rendered.

Leave a Reply

Your email address will not be published.