Algorithms and computational thinking quiz
Trace short algorithms, compare searching and sorting methods, and test decomposition, abstraction, and boundary cases.
syllabus — topic scope & references
- Trace variables and outputs step by step
- Choose suitable search and sorting methods
- Identify decomposition, abstraction, and boundary tests
Cambridge IGCSE 0478 (2026–2028): 7 Algorithm design and problem-solving.
IB Computer Science (first assessment 2027): B.1 Computational thinking.
Original practice on shared foundations. Topic-area links do not imply complete syllabus or SL/HL coverage. Not affiliated with or endorsed by Cambridge or the IB.
Related: Programming fundamentals · Boolean logic and truth tables
review — read all questions & worked answers
Algorithms and computational thinking: questions, answers & explanations
This is the readable reference for the same 10 MCQs. Close this file to continue your quiz, or type quiz to start again.
1. Which searching method can examine an unsorted list directly?
- a) Binary search only
- b) Linear search
- c) Neither method can search an unsorted list
Answer: b) Linear search
Linear search checks items in turn and does not require the list to be sorted. Standard binary search does require ordering.
2. What is a requirement for standard binary search on an array?
- a) The values are sorted in the search order
- b) Every value is identical
- c) The array contains exactly eight items
Answer: a) The values are sorted in the search order
Binary search uses ordering to discard half the remaining search interval. An unsorted array does not support that reasoning.
3. Trace this pseudocode: x ← 3 WHILE x < 20 x ← x * 2 ENDWHILE OUTPUT x What is printed?
- a) 12
- b) 20
- c) 24
Answer: c) 24
x takes the values 3, 6, 12, 24. At 24, x < 20 is false, so the loop ends and prints 24.
4. In this pseudocode, both FOR bounds are included: total ← 0 FOR i ← 1 TO 4 total ← total + i NEXT i What is total?
- a) 4
- b) 10
- c) 6
Answer: b) 10
The loop adds 1 + 2 + 3 + 4 to the initial 0, giving 10.
5. What is decomposition?
- a) Breaking a problem into smaller, manageable parts
- b) Deleting all the data before solving a problem
- c) Writing every program as one long statement
Answer: a) Breaking a problem into smaller, manageable parts
Decomposition separates a larger problem into subproblems that can be understood, developed, and tested more easily.
6. What is abstraction?
- a) Keeping every detail regardless of relevance
- b) Choosing a computer's paint colour
- c) Focusing on relevant features while leaving out unnecessary detail
Answer: c) Focusing on relevant features while leaving out unnecessary detail
Abstraction builds a useful model by selecting the features needed for the problem and omitting irrelevant details.
7. A field accepts whole-number ages from 0 to 120 inclusive. Which set tests both boundaries and the nearest rejected values?
- a) 20, 30, 40, 50
- b) −1, 0, 120, 121
- c) 0, 40, 80, 120
Answer: b) −1, 0, 120, 121
Boundary testing checks the accepted endpoints and the immediately adjacent rejected values: −1, 0, 120, 121.
8. One left-to-right bubble-sort pass compares adjacent pairs in [5, 1, 4, 2], swapping when the left item is larger. What is the list after that pass?
- a) [1, 4, 2, 5]
- b) [1, 2, 4, 5]
- c) [5, 4, 2, 1]
Answer: a) [1, 4, 2, 5]
The comparisons move 5 right: [1,5,4,2], then [1,4,5,2], then [1,4,2,5]. One pass need not finish the whole sort.
9. What is the purpose of a trace table?
- a) To store a website's colour palette
- b) To guarantee that every possible input works
- c) To record changing values while stepping through an algorithm
Answer: c) To record changing values while stepping through an algorithm
A trace table records values at successive steps, helping you follow execution and identify mistakes. A single trace does not test every input.
10. An array has indices 0 to 4. A loop tries to read indices 0 to 5 inclusive. What is the problem?
- a) The loop never runs
- b) It tries to access an index outside the array
- c) The array must be sorted first
Answer: b) It tries to access an index outside the array
Index 5 is outside the stated valid range. This is a boundary or off-by-one error.
↑ ↓ recall commands · Tab autocomplete · Enter run
