101. Evaluate the postfix expression: 9 3 1 - /
- 6
- 8
- 4
- 3
Answer: C) 4
Explanation: Push operands; on an operator pop two values and push the result. Answer 4. Lesson 3.2 · 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: C) 4
Explanation: Push operands; on an operator pop two values and push the result. Answer 4. Lesson 3.2 · Data Structures & Algorithms
Answer: D) [2, 8, 3, 6, 4]
Explanation: Selection sort swaps the minimum into position 0. Lesson 3.6 · Data Structures & Algorithms
Answer: A) Stack
Explanation: The latest action is undone first. Lesson 3.2 · Data Structures & Algorithms
Answer: C) O(n)
Explanation: Count how often the innermost statement runs as n grows: O(n). Lesson 3.1 · Data Structures & Algorithms
Answer: C) O(n)
Explanation: It may need to check every item. Lesson 3.1 · Data Structures & Algorithms
Answer: B) Merge sort
Explanation: Merging requires a temporary array. Lesson 3.6 · Data Structures & Algorithms
Answer: D) O(1)
Explanation: The hash function points directly to the slot. Lesson 3.5 · Data Structures & Algorithms
Answer: D) O(n²)
Explanation: Count how often the innermost statement runs as n grows: O(n²). Lesson 3.1 · Data Structures & Algorithms
Answer: D) Dynamic programming
Explanation: Memoisation or tabulation. Lesson 3.6 · Data Structures & Algorithms
Answer: C) 10, 22, 15, 35, 70, 50, 25
Explanation: Post-order visits left, right, then root – the first key inserted (root) comes last. Lesson 3.3 · Data Structures & Algorithms
Answer: D) 20, 40, 30, 60, 80, 70, 50
Explanation: Post-order visits left, right, then root – the first key inserted (root) comes last. Lesson 3.3 · Data Structures & Algorithms
Answer: B) 10
Explanation: ⌊log₂ 1000⌋ + 1 = 10. Lesson 3.6 · Data Structures & Algorithms
Answer: C) Trie
Explanation: Each path from the root spells a prefix. Lesson 3.3 · Data Structures & Algorithms
Answer: A) Insertion sort
Explanation: Insertion sort runs in nearly O(n) on almost-sorted data. Lesson 3.6 · Data Structures & Algorithms
Answer: B) O(2ⁿ)
Explanation: The call tree roughly doubles at each level. Lesson 3.1 · Data Structures & Algorithms
Answer: C) 7
Explanation: ⌊log₂ 100⌋ + 1 = 7. Lesson 3.6 · Data Structures & Algorithms
Answer: A) O(1)
Explanation: Each element moves between stacks at most once. Lesson 3.2 · Data Structures & Algorithms
Answer: B) 15
Explanation: 2^(h+1) − 1 = 15. Lesson 3.3 · Data Structures & Algorithms
Answer: D) 9
Explanation: Deleting the maximum leaves the second largest at the root. Lesson 3.3 · Data Structures & Algorithms
Answer: A) Vertices and edges
Explanation: G = (V, E). Lesson 3.4 · Data Structures & Algorithms
Answer: B) Backtracking
Explanation: Backtracking explores and retreats. Lesson 3.6 · Data Structures & Algorithms
Answer: B) BFS
Explanation: BFS explores by distance in levels. Lesson 3.4 · Data Structures & Algorithms
Answer: D) 1
Explanation: Stack after all operations (bottom→top): ['5', '3', '1']. Lesson 3.2 · Data Structures & Algorithms
Answer: B) Underflow
Explanation: Pop on an empty stack is underflow. Lesson 3.2 · Data Structures & Algorithms
Answer: B) Bubble sort
Explanation: Large values bubble to the end. Lesson 3.6 · Data Structures & Algorithms
Practise NSCT: Data Structures & Algorithms MCQs