Tree Traversal and Construction MCQs: 12 Solved Questions with Step-by-Step Explanations

Test traversal rules, rebuild binary trees from paired sequences, count height correctly, and use BST order through 12 fully explained MCQs.

KnowledgeGate Team

Exam prep & CS education

Updated 1 Sep 20267 min read

Memorising Root, Left, Right is not enough when a question asks you to reconstruct a tree, test whether two traversals identify it uniquely, or derive another traversal. Direct traversal rules lead into construction and BST consequences. Answer each before reading its explanation. If the fundamentals need revision, start with Binary Trees and Binary Search Trees, then use the Binary Tree MCQs as broader practice.

Preorder, inorder and postorder rules before construction

Keep one rule box in mind:

  • Preorder: Root, Left, Right

  • Inorder: Left, Root, Right

  • Postorder: Left, Right, Root

The root changes position, but every conventional depth-first order visits the left subtree before the right subtree.

Question 1

Which of the following best describes the correct sequence of node visits in a preorder traversal of a tree?

  • A. Visit root → Visit left subtree → Visit right subtree

  • B. Visit left subtree → Visit right subtree → Visit root

  • C. Visit right subtree → Visit root → Visit left subtree

  • D. Visit left subtree → Visit root → Visit right subtree

Answer: A. Preorder places the root before both subtrees. B is postorder, D is inorder, and C incorrectly visits the right subtree first.

Question 2

Which of the following represents the correct order of visiting nodes during an inorder traversal of a binary tree?

  • A. Visit root, then right subtree, then left subtree

  • B. Visit right subtree, then root, then left subtree

  • C. Visit left subtree, then root, then right subtree

  • D. Visit root, then left subtree, then right subtree

Answer: C. Inorder follows Left, Root, Right. D is preorder, while A and B reverse subtree order. It is sorted only for a BST, not every binary tree.

Question 3

Post-order Binary tree traversal is _____.

  • A. Left, Node, Right

  • B. Left, Right, Node

  • C. Node, Left, Right

  • D. Right, Left, Node

Answer: B. Postorder processes both subtrees before the node. A is inorder, C is preorder, and D wrongly reverses left and right.

Question 4

What is common in three different types of traversals (Inorder, Preorder and Post order)?

  • A. Root is visited before right subtree

  • B. Left subtree is always visited before right subtree

  • C. Root is visited after left subtree

  • D. All of the above

Answer: B. Compare Root-Left-Right, Left-Root-Right and Left-Right-Root. Only left-before-right is common. A fails for postorder, C for preorder, so D fails.

Reconstruct a binary tree when inorder is available

For construction, preorder supplies the root at its front, postorder supplies the root at its end, and inorder marks the exact left-right split. Repeat that process within each slice.

Question 5

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

Answer: A. Preorder gives root a; inorder splits into d b e and f c g. Their preorder slices make roots b and c, with children d, e and f, g. Postorder joins d e b, f g c, then a.

Question 6

Inorder and postorder traversal of a binary tree are given.

In : E, I, C, F, B, G, D, J, H, K

Post : I, E, F, C, G, J, K, H, D, B

Find the preorder traversal of a binary tree?

  • A. B, C, E, I, F, D, G, H, J, K

  • B. B, F, I, E, C, D, G, H, J, K

  • C. B, C, E, I, F, D, G, H, K, J

  • D. B, C, E, F, G, H, K, D, J, I

Answer: A. Postorder ends at root B. Inorder splits into E, I, C, F and G, D, J, H, K. The left postorder slice ends at C, giving preorder C, E, I, F; the right ends at D, giving D, G, H, J, K. Prepend B.

Reconstructed binary tree for Question 6 with root B and its worked preorder order B, C, E, I, F, D, G, H, J, K.

Apply postorder and measure height on reconstructed trees

Translate relationship statements into edges before traversing. For height, use the stem's edge-or-node convention.

Question 7

For the binary tree with root a; children of a as b and e; children of b as c and d; left child of e as f; and left child of c as g, which sequence is the post-order traversal?

  • A. f e g c d b a

  • B. g c b d a f e

  • C. g c d b f e a

  • D. f e d g c b a

Answer: C. The left subtree gives g c d b; the right gives f e. Visiting a last produces g c d b f e a.

Question 8

The post-order traversal of a binary tree is 8, 9, 6, 7, 4, 5, 2, 3, 1. The in-order traversal of the same tree is 8, 6, 9, 4, 7, 2, 5, 1, 3. The height of a tree is the length of the longest path from the root to any leaf. The height of the binary tree above is

  • A. 3

  • B. 5

  • C. 4

  • D. 2

Answer: C. Postorder ends at root 1; inorder puts 3 right and everything else left. The left postorder slice ends at 2, with left root 4 and right child 5. Repeating the split gives 4 children 6, 7, and 6 children 8, 9.

The longest route 1 → 2 → 4 → 6 → 8 has five nodes but four edges, so height is 4.

Binary tree for Question 8 with root 1, showing the longest root-to-leaf path 1, 2, 4, 6, 8 across four edges.

Know which traversal pairs determine one unique tree

Assume labels are unique. Inorder plus preorder or postorder works because one supplies the root and inorder supplies the split. Preorder plus postorder lacks that split: A with one left child B, or one right child B, gives preorder A, B and postorder B, A in both cases.

Question 9

Consider the label sequences obtained by the following pairs of traversals on a labeled binary tree. Which of these pairs identify a tree uniquely ?

(i) preorder and postorder

(ii) inorder and postorder

(iii) preorder and inorder

(iv) level order and postorder

  • A. (i) only

  • B. (ii), (iii)

  • C. (iii) only

  • D. (iv) only

Answer: B. Pairs (ii) and (iii) supply a root and inorder boundaries. The two-node counterexample disproves (i); level order plus postorder also cannot always distinguish left-right structure.

Use BST ordering to derive traversals without guesswork

In a BST, left-subtree keys are smaller and right-subtree keys are larger. With distinct keys, inorder is ascending; other orders need the actual shape.

Question 10

The numbers 70, 50, 10, 80, 30, 60, 100, 90, 40, 20 are inserted in the given order into a binary search tree. What is the in-order traversal sequence of the resultant binary search tree?

  • A. 70, 50, 10, 80, 30, 60, 100, 90, 40, 20

  • B. 100, 90, 80, 70, 60, 50, 40, 30, 20, 10

  • C. 10, 30, 50, 70, 90, 20, 40, 60, 80, 100

  • D. 10, 20, 30, 40, 50, 60, 70, 80, 90, 100

Answer: D. Root 70 has 50, 80. Under 50, place 10 left, 60 right; 30 is right of 10, with children 20, 40. Under 80, place 100 right and 90 left of it. Inorder is ascending.

Question 11

Which sequence is the pre-order traversal of the BST formed by inserting the following keys in the given order?

9, 8, 12, 22, 4, 10, 13

  • A. 8, 9, 4, 12, 10, 22, 13

  • B. 9, 8, 4, 12, 22, 10, 13

  • C. 9, 8, 4, 12, 10, 22, 13

  • D. 13, 22, 10, 12, 4, 8, 9

Answer: C. Root 9 has 8 left and 12 right. Place 4 left of 8, 10 and 22 around 12, then 13 left of 22. Preorder is 9, 8, 4, 12, 10, 22, 13.

Question 12

A binary search tree contains the numbers 1, 2, 3, 4, 5, 6, 7, 8. When the tree is traversed in pre-order and the values in each node printed out, the sequence of values obtained is 5, 3, 1, 2, 4, 6, 8, 7. If the tree is traversed in post-order, the sequence obtained would be

  • A. 8, 7, 6, 5, 4, 3, 2, 1

  • B. 1, 2, 3, 4, 8, 7, 6, 5

  • C. 2, 1, 4, 3, 6, 7, 8, 5

  • D. 2, 1, 4, 3, 7, 8, 6, 5

Answer: D. Preorder gives root 5. Its left slice builds 3, with left child 1, 1's right child 2, and right child 4. The right slice builds 6, whose right child 8 has left child 7. Postorder joins 2, 1, 4, 3, 7, 8, 6, then 5.

For implementation practice with the same tree, recursion and traversal ideas, continue with DSA using Java.

Answer audit, common traps and the next practice step

Answer key: 1-A, 2-C, 3-B, 4-B, 5-A, 6-A, 7-C, 8-C, 9-B, 10-D, 11-C, 12-D.

If an answer went wrong, diagnose the reason: you may have confused root position with subtree order, reconstructed without inorder boundaries, forgotten that BST inorder is sorted, or counted nodes when the height definition asks for path length in edges.

Browse the Coding & DSA category for wider practice. For more traversal and construction practice, use Traversals & Construction PYQ Questions. Keep the rule box, practise reconstruction slices by hand, and count height using the definition given.