O Level / IGCSE Computer Science chapter 7: Algorithm design and problem-solving MCQs with answers

By Team Megalecture · Updated 4 Nov 2026

41 exam-style questions on Algorithm design and problem-solving, each with the answer and a short explanation. Ten of them are below to try. The chapter test draws ten fresh questions each time and is marked the moment you finish, with your score by topic.

41 questions · 4 topics · 10 per test

Test this chapter freeAll O Level / IGCSE Computer Science chapters

What chapter 7 covers

Ten Algorithm design and problem-solving questions with answers

Try each one, then open the answer. These ten stay the same; the test draws new ones every time.

1. What is output by this algorithm?
X ← 1
Y ← 0
WHILE X < 20 DO
    Y ← Y + X
    X ← X * 3
ENDWHILE
OUTPUT Y

  1. A
    13
  2. B
    27
  3. C
    40
  4. D
    4
Show answer

Answer: A. Trace: X=1, Y=1, X=3; X=3, Y=4, X=9; X=9, Y=13, X=27; now X < 20 is false, so the loop ends and 13 is output. 40 wrongly adds 27 as well.

2. What does a structure diagram show?

  1. A
    the exact order in which each line of the program code is run by the computer
  2. B
    the values of variables at each step
  3. C
    how a system is broken down into sub-systems in a hierarchy
  4. D
    the logic gates in a circuit
Show answer

Answer: C. A structure diagram shows top-down decomposition: the whole system at the top and its sub-systems below. The order of steps is shown in a flowchart or pseudocode.

3. What is the purpose of this algorithm?
Total ← 0
FOR Counter ← 1 TO 20
    INPUT Mark
    Total ← Total + Mark
NEXT Counter
OUTPUT Total / 20

  1. A
    to output the highest of 20 marks
  2. B
    to count how many of 20 marks are entered
  3. C
    to output the average of 20 marks
  4. D
    to output the total of 20 marks
Show answer

Answer: C. The loop inputs 20 marks and adds each to Total; the output is Total divided by 20, which is the mean (average) mark, not the total.

4. A user types their age as 43 instead of 34. The program uses a range check of 0 to 120. What happens?

  1. A
    the data is rejected, because the range check can tell that the age is incorrect
  2. B
    it is accepted, as validation checks data is reasonable, not that it is correct
  3. C
    the verification check corrects it to 34
  4. D
    the program asks for a check digit
Show answer

Answer: B. 43 is within the range, so it passes validation even though it is wrong. Validation cannot tell whether reasonable data is actually correct.

5. A linear search looks for a value in an array of 8 items. The value is at position 5. How many comparisons are made before it is found?

  1. A
    1
  2. B
    4
  3. C
    5
  4. D
    8
Show answer

Answer: C. The search compares positions 1, 2, 3, 4 and 5; it stops when the value is found at position 5, so 5 comparisons.

6. What is meant by abstraction?

  1. A
    removing unnecessary details to focus on the parts of the problem that matter
  2. B
    breaking a problem down into smaller sub-problems that are each easier to solve on their own
  3. C
    testing a program with extreme data
  4. D
    translating code into machine code
Show answer

Answer: A. Abstraction hides or removes detail that is not needed, for example a map for a route planner that keeps roads but omits individual trees. Breaking into parts is decomposition.

7. What is meant by decomposition?

  1. A
    removing errors from a program
  2. B
    breaking down a problem into smaller sub-problems that are easier to solve
  3. C
    converting a flowchart into pseudocode so that it can be written as program code later
  4. D
    reducing the size of a file
Show answer

Answer: B. Decomposition splits a complex problem (or system) into sub-problems (sub-systems), which can themselves be split further.

8. How many asterisks are output by this algorithm?
FOR i ← 1 TO 3
    FOR j ← i TO 3
        OUTPUT "*"
    NEXT j
NEXT i

  1. A
    9
  2. B
    6
  3. C
    3
  4. D
    5
Show answer

Answer: B. The inner loop runs from i to 3: 3 times when i = 1, 2 times when i = 2 and once when i = 3, so 3 + 2 + 1 = 6.

9. Which pseudocode is a length check that makes sure a password has at least 8 characters?

  1. A
    IF Password <> "" THEN
  2. B
    IF LENGTH(Password) >= 8 THEN
  3. C
    IF Password >= 8 THEN
  4. D
    IF LENGTH(Password) > 8 THEN
Show answer

Answer: B. LENGTH returns the number of characters, and at least 8 means >= 8. Using > 8 wrongly rejects an 8-character password; checking for "" is a presence check.

10. An array holds 5, 3, 8, 1, 6. A bubble sort puts it into ascending order. What does the array hold after the first pass?

  1. A
    3, 5, 1, 6, 8
  2. B
    1, 3, 5, 6, 8
  3. C
    3, 5, 8, 1, 6
  4. D
    3, 1, 5, 6, 8
Show answer

Answer: A. Compare adjacent pairs: 5,3 swap → 3,5,8,1,6; 5,8 no swap; 8,1 swap → 3,5,1,8,6; 8,6 swap → 3,5,1,6,8. The largest value has moved to the end. 3, 1, 5, 6, 8 is after the second pass.

Start the chapter testAbout the O Level / IGCSE Computer Science test

Read the notes for this chapter

Ways to practise this chapter

Algorithm design and problem-solving: questions students ask

How many Algorithm design and problem-solving MCQs are there?

41, each with the answer and a short explanation, across 4 topics: Program development life cycle and decomposition, Standard methods of solution, Validation, verification and test data, Trace tables and correcting algorithms. Every chapter test draws ten of them, so you can take it many times.

Is the O Level / IGCSE Computer Science chapter 7 test free?

Yes. The test, the answers and the explanations are free and need no sign-up. Sign in only if you want your scores kept across devices.

How is the chapter test marked?

The moment you press Finish: your score, the right answer and an explanation for every question, and the ones you got wrong saved in My mistakes to retry.

Keep going

← Chapter 6: Automated and emerging technologiesChapter 8: Programming →All chaptersStuck? Ask a question