Skip to content
Michelle’s Computer
Terminal

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

ALGORITHMS AND COMPUTATIONAL THINKING QUIZ
10 questions. Type a, b, or c, then Enter. Explanations follow each answer.
Type review for all worked answers; quiz to restart; topics to switch.
 
Question 1/10: Which searching method can examine an unsorted list directly?
a) Binary search only
b) Linear search
c) Neither method can search an unsorted list
Type answer a, answer b, or answer c. (A single letter works too.)
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?

  1. a) Binary search only
  2. b) Linear search
  3. 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?

  1. a) The values are sorted in the search order
  2. b) Every value is identical
  3. 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?

  1. a) 12
  2. b) 20
  3. 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?

  1. a) 4
  2. b) 10
  3. c) 6

Answer: b) 10

The loop adds 1 + 2 + 3 + 4 to the initial 0, giving 10.

5. What is decomposition?

  1. a) Breaking a problem into smaller, manageable parts
  2. b) Deleting all the data before solving a problem
  3. 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?

  1. a) Keeping every detail regardless of relevance
  2. b) Choosing a computer's paint colour
  3. 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?

  1. a) 20, 30, 40, 50
  2. b) −1, 0, 120, 121
  3. 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?

  1. a) [1, 4, 2, 5]
  2. b) [1, 2, 4, 5]
  3. 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?

  1. a) To store a website's colour palette
  2. b) To guarantee that every possible input works
  3. 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?

  1. a) The loop never runs
  2. b) It tries to access an index outside the array
  3. 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