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?
BeginnerShow 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?
BeginnerShow 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?
BeginnerShow 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?
BeginnerShow 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?
BeginnerShow 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.
BeginnerShow 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?
IntermediateShow 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?
IntermediateShow 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?
IntermediateShow 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?
IntermediateShow 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?
IntermediateShow 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?
IntermediateShow 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.
AdvancedShow 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?
AdvancedShow 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?
AdvancedShow 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?
AdvancedShow 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?
AdvancedShow 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.
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