Round and round.

Six original Cambridge-style questions on iteration, with trace tables and mark points.

Original questions All questions on this page are original work, written in the Cambridge IGCSE style. They are not from past papers. They test the same concepts and skills the syllabus rewards.
Keep these straight

Know when it stops.

01
Recall
[3 marks]

Describe the three types of loop used in pseudocode.

  • Count-controlled (FOR): repeats a set number of times. ✓
  • Pre-condition (WHILE): the condition is tested before each pass, so it may not run at all. ✓
  • Post-condition (REPEAT ... UNTIL): the condition is tested after each pass, so it runs at least once. ✓
02
Trace
[4 marks]

Complete a trace table for this pseudocode and state the output.

Total ← 0
Number ← 1
WHILE Total < 20 DO
    Total ← Total + Number
    Number ← Number + 2
ENDWHILE
OUTPUT Total, " ", Number
  • Total: 0, 1, 4, 9, 16, 25. ✓
  • Number: 1, 3, 5, 7, 9, 11. ✓
  • The loop stops when Total is 25 (25 < 20 is FALSE). ✓
  • Output: 25 11 ✓
03
Write
[4 marks]

Write pseudocode that uses a FOR loop to input 10 numbers, then outputs their total and their average.

  • Total ← 0 before the loop ✓
  • FOR Count ← 1 TO 10 ... NEXT Count ✓
  • INPUT Number and Total ← Total + Number inside the loop ✓
  • After the loop: OUTPUT Total, Total / 10 ✓
04
Write
[3 marks]

Write pseudocode using a REPEAT ... UNTIL loop that makes the user enter a number from 1 to 10 inclusive.

  • REPEAT ✓
  • INPUT Number (with a prompt) ✓
  • UNTIL Number >= 1 AND Number <= 10 ✓
05
Explain
[2 marks]

Explain the difference between a pre-condition loop and a post-condition loop.

  • A pre-condition loop tests the condition before the body, so the body may run zero times. ✓
  • A post-condition loop tests the condition after the body, so the body always runs at least once. ✓
06
Analysis
[2 marks]

This loop should output the numbers 1 to 5 but never stops. Explain why and correct it.

Count ← 1
WHILE Count <= 5 DO
    OUTPUT Count
ENDWHILE
  • Count is never changed inside the loop, so Count <= 5 is always TRUE. ✓
  • Add Count ← Count + 1 inside the loop, after the OUTPUT. ✓

Mark this once you have attempted all six and checked your working. It records a Practiced badge on the topic and adds a one-time bonus. Revealing the solutions alone does not count.