Tree Traversal MCQ Quiz in తెలుగు - Objective Question with Answer for Tree Traversal - ముఫ్త్ [PDF] డౌన్లోడ్ కరెన్
Last updated on Mar 11, 2025
Latest Tree Traversal MCQ Objective Questions
Top Tree Traversal MCQ Objective Questions
Tree Traversal Question 1:
The post order traversal of a binary tree is ACEDBHIGF. In-order traversal of same heap is AECBDFHGI. The possible pre-order traversal is
Answer (Detailed Solution Below)
Tree Traversal Question 1 Detailed Solution
For a heap: Postorder traversal is ACEDBHIGF
Pre-order traversal: FBEACDGHI
Tree Traversal Question 2:
For the following binary tree, inorder traversal yields the expression:
Answer (Detailed Solution Below)
Tree Traversal Question 2 Detailed Solution
Concept:
In the in-order traversal method, the left subtree is visited first, then the root and then the right subtree. Every node is a subtree in itself.
Explanation:
Given a binary tree :
For this, we first visit the left - subtree of root -.
1) It will first print a. Then root, + (a + )
2) Then it will go to right subtree, in this again left subtree of root *. It prints b , then * , then d (a + b * d)
3) Then it print "-". (a + b * d -)
4) Then move to right subtree. First print e, then /, then f .(e/f)
5) Final output will be : a + b * d - e/f
Tree Traversal Question 3:
The POST-order traversal of a binary tree is A, C, E, D, B, H, I, G, and F. The IN-order traversal of this tree is A, B, C, D, E, F, G, H, I. In the POST-order traversal of A is numbered as 1, C as 2, E as 3 and so on also in IN-order traversal A is numbered as 1, B as 2, C as 3.The PRE-order traversal is also order in the same way. Which letter will be assigned the same number in PRE-order, IN-order, and POST-order traversal?
Answer (Detailed Solution Below)
Tree Traversal Question 3 Detailed Solution
POST-order: A, C, E, D, B, H, I, G, F
IN-order: A, B, C, D, E, F, G, H, I
Binary tree
PRE- order: F, B, A, D, C, E, G, I and H
Therefore D will be assigned the same number in PRE-order, IN-order, and POST-order traversal
Tree Traversal Question 4:
The preorder traversal sequence of a binary search tree is
25, 15, 10, 4, 12, 22, 18, 24, 50, 35, 31, 44, 70, 66, 90
Which one of the following is the postorder traversal sequence of the same tree?
Answer (Detailed Solution Below)
Tree Traversal Question 4 Detailed Solution
The correct answer is option 2.
Concept:
In order to build a binary tree from given traversal sequences, one of the traversal sequences must be Inorder. The other traversal sequence might be either Preorder or Postorder. We know that the Inorder traversal of a Binary Search Tree is always in ascending order.
Preorder traversal sequence of a binary search tree,
25, 15, 10, 4, 12, 22, 18, 24, 50, 35, 31, 44, 70, 66, 90
Inorder traversal sequence of a binary search tree,
4, 10, 12, 15, 18, 22, 24, 25, 31, 35, 44, 50, 66, 70, 90
Postorder traversal is a type of traversal in which we first visit the left subtree in postorder, then the right subtree in postorder, and then visit the root node.
Postorder is= 4, 12, 10, 18, 24, 22, 15, 31, 44, 35, 66, 90, 70, 50, 25
Hence the correct answer is 4, 12, 10, 18, 24, 22, 15, 31, 44, 35, 66, 90, 70, 50, 25.
Additional Information
Tree traversal | ||||||
Method flow |
Inorder | preorder | postorder |
Converse Inorder |
Converse Preorder | Converse Postorder |
|
|
|
|
|
|
Tree Traversal Question 5:
The Preorder traversal of a tree given below is:
Answer (Detailed Solution Below)
Tree Traversal Question 5 Detailed Solution
The correct solution is 'option 1'.
Key Points
Algo Preorder(tree root)
{
- Visit the root node.
- Traverse the left subtree ( call Algo Preorder(left-subtree) ).
- Traverse the right subtree ( call Algo Preorder(right-subtree) ).
}
- Start with a root node 'A' move towards it's left subtree i.e 'B'. And again the node 'B' becomes the root node. Recursively calling by the above function prints the pre-order of the above Tree.
Thus, the correct answer is: A B D F E C G I H J K L
Additional Information
- To build a copy of the tree, a preorder traverse is used. Preorder traversal is often used to get the prefix on an expression tree.
- Here, some tree traversal techniques and flow.
- In-order - F D B E A I G C J H L K
- Pre-order - A B D F E C G I H J K L
- Post-order - F D E B I G J L K H C A
- Converse Inorder - K L H J C G I A E B D F
- Converse Preorder- A C H K L J G I B E D F
- Converse Postorder- L K J H I G C E F D B A
Tree traversal | ||||||
Method flow |
Inorder | preorder | postorder |
Converse Inorder |
Converse Preorder | Converse Postorder |
|
|
|
|
|
|
Tree Traversal Question 6:
What is/are the operations in Data structure
I. Traversing
II. Searching
III. Deleting
Answer (Detailed Solution Below)
Tree Traversal Question 6 Detailed Solution
- The data appearing in data structure are processed by means of certain operations; Operation in data structure are listed below:
1. Traversing: Accessing each record exactly once so that certain items in the record may be processed.
2. Searching: Finding the location of the record with a given key value or finding the locations of all records which satisfy one or more condition.
3. Insertion: Adding a new record to the structure.
4. Deleting: Removing a record from the structure.
Other operations: sorting, merging, copying and concatenation
Tree Traversal Question 7:
Consider the tree T given below. If post order traversal of T gives BCEAD, the lables of nodes 1, 2, 3, 4, 5, respectively are:
Answer (Detailed Solution Below)
Tree Traversal Question 7 Detailed Solution
Pre-order of above tree = 12453
In order of above tree = 42513
Postorder of above tree = 45231
And the given Post order is BCEAD
Hence B=4, C=5, E=2, A=3, D=1
The labels of nodes 1, 2, 3, 4, 5 = {D, E, A, B, C}
Hence the correct answer is DEABC.
Tree Traversal Question 8:
When we perform in order traversal on a binary tree, we get the ascending order array. The tree is:
Answer (Detailed Solution Below)
Tree Traversal Question 8 Detailed Solution
Opttion 3: correct:
When we perform in order traversal on a binary tree, we get the ascending order array. The tree is binary search tree
Random binary search tree
Post-order traversal is 23, 18, 27, 25, 10, 60, 80, 70, 30.
In-order traversal traversal is 10, 18, 23, 25, 27, 30, 60, 70, 80
Preorder traversal is 30, 10, 25, 18, 23, 27, 70, 60 ,80
In order traversal, of the binary search tree is in ascending order.
Tree Traversal Question 9:
Let post order traversal of a binary search tree (BST) is given by VSQTURP. If S < V < Q < P < T < R < U, then the pre-order traversal of the BST is:
Answer (Detailed Solution Below)
Tree Traversal Question 9 Detailed Solution
Binary search Tree Inorder always be in Ascending order
Since S < V < Q < P < T < R < U
Therefore In order traversal is SVQPTRU
Given post order is VSQTURP
Binary Search Tree:
Therefore Pre-order traversal of the binary search tree is PQSVRTU.
The correct answer is option 2
Tree Traversal Question 10:
Given the following expression tree, identify the correct arithmetic expression:
Answer (Detailed Solution Below)
Tree Traversal Question 10 Detailed Solution
Concept:
Algorithm:
Step 1: Put operands into stack when we visiting operator last time go to step 2
Step 2: Calculate pop1 operator pop2 and again push into stack and Repeat Step 1
Step 3: Repeat Step 1 and Step 2 until Root node is visited last time
Explanation:
So option 2 is the correct answer.