Non-Linear Data Structures: Trees: 17 MCQs with answers

All 17 multiple-choice questions from this kit, free and with no sign-up.

Warm-up · 6 questions

Q1. Why is a tree classified as a non-linear data structure?

Beginner
A Its elements are stored in a single contiguous line.
B It always stores its data in sorted order.
C It allows each element only one predecessor and one successor.
D Each node can have many children, giving a one-to-many shape.
Show the answer

D · Each node can have many children, giving a one-to-many shape.

Linear structures like arrays and lists are one-to-one; a tree is one-to-many because a node can point to multiple children, which is the defining non-linear property.

Q2. In a tree, what do we call a node that has no children?

Beginner
A Subtree
B Parent
C Root
D Leaf
Show the answer

D · Leaf

A node with no children is a leaf (degree 0). The root is the topmost node, and a parent is a node with at least one child.

Q3. A tree has 15 nodes. How many edges does it contain?

Beginner
A 16
B 14
C 30
D 15
Show the answer

B · 14

Every node except the root has exactly one parent edge, so a tree with $n$ nodes has $n - 1$ edges: $15 - 1 = 14$.

Q4. Which traversal of a binary search tree visits nodes in ascending sorted order?

Beginner
A Postorder
B Preorder
C Level order
D Inorder
Show the answer

D · Inorder

Inorder visits left subtree, node, then right subtree. Because a BST keeps smaller values on the left and larger on the right, this produces sorted output.

Q5. A file explorer where folders contain folders and files is best modeled by which structure?

Beginner
A A flat array
B A queue
C A tree
D A stack
Show the answer

C · A tree

Nested folders form a hierarchy — each folder can contain many items, which is exactly the one-to-many shape of a tree.

Q6. A tree with $n$ nodes always has exactly $n - 1$ edges and contains no cycles.

Beginner
A True
B False
Show the answer

A · True

A tree with $n$ nodes always has exactly $n - 1$ edges and contains no cycles.

Building up · 6 questions

Q7. Which statement about the degree of a node is correct?

Intermediate
A It is the number of edges from the root to the node.
B It is the number of ancestors above the node.
C It is the number of children the node has.
D It is the maximum depth of the tree.
Show the answer

C · It is the number of children the node has.

Degree counts a node's children. The number of edges from the root is depth, and the maximum depth is the tree's height.

Q8. A structure has 10 nodes and 12 edges. What can you conclude?

Intermediate
A It is a valid tree with extra leaves.
B It cannot be a tree because it contains at least one cycle.
C It is a balanced binary search tree.
D It is a forest of two trees.
Show the answer

B · It cannot be a tree because it contains at least one cycle.

A tree with $n$ nodes must have exactly $n - 1$ edges. With 10 nodes and 12 edges there are more edges than a tree allows, so at least one cycle exists.

Q9. A BST is built by inserting values in strictly increasing order. What happens to search performance?

Intermediate
A It improves to $O(1)$ because values are sorted.
B It stays $O(\log n)$ because the tree is balanced.
C It degrades to $O(n)$ because the tree becomes list-like.
D It becomes $O(n \log n)$ due to rebalancing.
Show the answer

C · It degrades to $O(n)$ because the tree becomes list-like.

Sorted input makes every new node a right child, producing a degenerate linked-list-like tree of height $n$, so search becomes $O(n)$.

Q10. Which traversal should you use to delete an entire tree safely?

Intermediate
A Level order, so rows are removed top-down.
B Inorder, so values come out sorted.
C Preorder, so parents are removed first.
D Postorder, so children are removed before parents.
Show the answer

D · Postorder, so children are removed before parents.

Postorder processes left and right subtrees before the node, so every child is freed before its parent — the safe order for deletion.

Q11. What distinguishes a binary search tree from a plain binary tree?

Intermediate
A A BST never contains leaf nodes.
B A BST stores all values at the leaves only.
C A BST allows each node up to three children.
D A BST enforces left-smaller and right-larger ordering at every node.
Show the answer

D · A BST enforces left-smaller and right-larger ordering at every node.

Both limit children to two, but only a BST adds the ordering rule that makes fast search possible.

Q12. Which structure is a collection of disjoint trees with no shared nodes?

Intermediate
A A balanced BST
B A forest
C A cycle
D A subtree
Show the answer

B · A forest

A forest is exactly a set of disjoint trees. A subtree is a node plus its descendants within one tree.

Topper level · 5 questions

Q13. Assertion (A): A tree with $n$ nodes always has exactly $n - 1$ edges. Reason (R): Every node except the root has exactly one parent, and each parent-child link is one edge.

Advanced
A A is false but R is true.
B A is true but R is false.
C Both A and R are true, but R does not explain A.
D Both A and R are true, and R correctly explains A.
Show the answer

D · Both A and R are true, and R correctly explains A.

Each non-root node contributes exactly one edge to its parent, so edges equal non-root nodes, which is $n - 1$. The reason is the direct justification of the assertion.

Q14. Consider these statements about trees: I. A tree contains no cycles. II. Exactly one path connects any two nodes in a tree. III. Every graph is a tree. Which combination is correct?

Advanced
A I and II only
B II and III only
C I and III only
D I, II and III
Show the answer

A · I and II only

Trees are connected and acyclic, so I and II hold. Statement III is false: graphs may contain cycles or be disconnected, so not every graph is a tree.

Q15. A team needs fast lookups on millions of records that are inserted in sorted order. Which choice is best?

Advanced
A A stack holding the records
B A naive BST built by inserting the sorted records
C A plain unsorted array scanned linearly
D A self-balancing tree such as an AVL or red-black tree
Show the answer

D · A self-balancing tree such as an AVL or red-black tree

Sorted insertion degenerates a naive BST to $O(n)$ search. A self-balancing tree keeps height near $\log n$, preserving $O(\log n)$ lookups.

Q16. You draw a structure and can trace a loop that returns to your starting node. What does this tell you?

Advanced
A It is a forest of two trees.
B It is a graph but not a tree, because it contains a cycle.
C It is a tree with an extra leaf.
D It is a balanced binary search tree.
Show the answer

B · It is a graph but not a tree, because it contains a cycle.

A tree must be acyclic. Tracing a loop back to the start proves a cycle exists, so the structure is a general graph, not a tree.

Q17. Consider a binary search tree (BST) constructed by inserting the following values in the given order: 30, 20, 40, 10, 25, 35, 50. What will be the depth of the node containing the value 25?

Advanced
A 1
B 3
C 4
D 2
Show the answer

D · 2

The depth of a node in a tree is defined as the number of edges from the root to that node. In this BST, the root is 30 (depth 0), 20 is the left child of 30 (depth 1), and 25 is the right child of 20 (depth 2). Therefore, the depth of the node containing the value 25 is 2.

Make your own

Your notes can be a kit like these

Every kit here was made from real study material. Point Veda at a chapter, a PDF, a photo or a link and get notes, flashcards, practice MCQs, games and a scored test — free, in 42 languages.

  • Chapter notes
  • Flashcards
  • Practice MCQs
  • Scored tests
  • Exam prep

Get Veda free See what students get

Free to start · No ads · Works in 42 languages