126. A node with no children is called a:
- Parent
- Leaf
- Sibling
- Root
Answer: B) Leaf
Explanation: Leaves are at the bottom of the tree. Lesson 3.3 · Data Structures & Algorithms
MCQs / Computer Science / NSCT: Data Structures & Algorithms
150 multiple-choice questions on NSCT: Data Structures & Algorithms from Computer Science, each with the correct answer and, where available, a teacher's explanation. Read through them to revise the chapter, then practise the same questions one by one to test yourself.
Answer: B) Leaf
Explanation: Leaves are at the bottom of the tree. Lesson 3.3 · Data Structures & Algorithms
Answer: D) 1, 6, 3, 14, 10, 8
Explanation: Post-order visits left, right, then root – the first key inserted (root) comes last. Lesson 3.3 · Data Structures & Algorithms
Answer: A) 2
Explanation: The longest root-to-leaf path has 2 edges. Lesson 3.3 · Data Structures & Algorithms
Answer: A) 50, 30, 20, 40, 70, 60, 80
Explanation: Pre-order visits root, then left subtree, then right subtree. Lesson 3.3 · Data Structures & Algorithms
Answer: B) 5
Explanation: The root of a min-heap is always the smallest element. Lesson 3.3 · Data Structures & Algorithms
Answer: B) 2
Explanation: The longest root-to-leaf path has 2 edges. Lesson 3.3 · Data Structures & Algorithms
Answer: D) 9
Explanation: 100 mod 13 = 9. Lesson 3.5 · Data Structures & Algorithms
Answer: A) 8
Explanation: Push operands; on an operator pop two values and push the result. Answer 8. Lesson 3.2 · Data Structures & Algorithms
Answer: C) 4
Explanation: 1234 mod 10 = 4. Lesson 3.5 · Data Structures & Algorithms
Answer: B) Extra memory used as input grows
Explanation: It counts additional memory, e.g. merge sort needs O(n). Lesson 3.1 · Data Structures & Algorithms
Answer: A) 2
Explanation: The longest root-to-leaf path has 2 edges. Lesson 3.3 · Data Structures & Algorithms
Answer: A) O(n)
Explanation: The search degenerates into scanning a list. Lesson 3.5 · Data Structures & Algorithms
Answer: A) 77
Explanation: Push operands; on an operator pop two values and push the result. Answer 77. Lesson 3.2 · Data Structures & Algorithms
Answer: C) O(n)
Explanation: n + n = 2n = O(n). Lesson 3.1 · Data Structures & Algorithms
Answer: B) [1, 7, 5, 3, 9]
Explanation: Selection sort swaps the minimum into position 0. Lesson 3.6 · Data Structures & Algorithms
Answer: D) 2
Explanation: 58 mod 7 = 2. Lesson 3.5 · Data Structures & Algorithms
Answer: A) 19
Explanation: Every node except the root has exactly one incoming edge. Lesson 3.3 · Data Structures & Algorithms
Answer: A) Best case
Explanation: Best case is O(1). Lesson 3.1 · Data Structures & Algorithms
Answer: B) 18
Explanation: Push operands; on an operator pop two values and push the result. Answer 18. Lesson 3.2 · Data Structures & Algorithms
Answer: D) Dijkstra's algorithm
Explanation: Roads are a weighted graph. Lesson 3.4 · Data Structures & Algorithms
Answer: A) V − 1 edges
Explanation: A spanning tree connects all vertices without cycles. Lesson 3.4 · Data Structures & Algorithms
Answer: D) O(log n)
Explanation: Count how often the innermost statement runs as n grows: O(log n). Lesson 3.1 · Data Structures & Algorithms
Answer: A) O(n²)
Explanation: Doubling n quadruples time, which is quadratic. Lesson 3.1 · Data Structures & Algorithms
Answer: A) Stack
Explanation: Push opening brackets, pop on closing brackets. Lesson 3.2 · Data Structures & Algorithms
Answer: A) LIFO
Explanation: Last in, first out. Lesson 3.2 · Data Structures & Algorithms
Previous Page 6 of 6
Practise NSCT: Data Structures & Algorithms MCQs