IGCSE · Practice questions · Sequence and selection: IF and CASE

Pick the right branch.

Six original Cambridge-style questions on sequence and selection, with 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

Condition, then branch.

01
Explain
[2 marks]

Describe what is meant by selection and name two types of selection statement.

  • Selection: the program tests a condition and chooses which statements to run depending on whether it is TRUE or FALSE. ✓
  • IF statements and CASE statements. ✓
02
Write
[4 marks]

Write pseudocode that inputs a temperature and outputs "Freezing" if it is below 0, "Cold" if it is from 0 to 15, and "Warm" if it is above 15.

  • INPUT Temp ✓
  • IF Temp < 0 THEN OUTPUT "Freezing" ✓
  • ELSE IF Temp <= 15 THEN OUTPUT "Cold" ELSE OUTPUT "Warm" (nested IF) ✓
  • Correct ENDIF for each IF and THEN/ELSE structure ✓
03
Trace
[3 marks]

State the output of this pseudocode when X is (a) 12 (b) 5 (c) 20.

IF X > 10
  THEN
    IF X > 15
      THEN
        OUTPUT "Large"
      ELSE
        OUTPUT "Medium"
    ENDIF
  ELSE
    OUTPUT "Small"
ENDIF
  • (a) 12 > 10 TRUE, 12 > 15 FALSE: Medium ✓
  • (b) 5 > 10 FALSE: Small ✓
  • (c) 20 > 10 TRUE, 20 > 15 TRUE: Large ✓
04
Write
[4 marks]

Write a CASE statement that inputs a grade (a single character) and outputs "Excellent" for 'A', "Good" for 'B', "Fair" for 'C' and "Not recognised" for anything else.

  • INPUT Grade and CASE OF Grade ✓
  • 'A' : OUTPUT "Excellent", 'B' : OUTPUT "Good" ✓
  • 'C' : OUTPUT "Fair" ✓
  • OTHERWISE OUTPUT "Not recognised" then ENDCASE ✓
05
Explain
[2 marks]

Explain why a programmer includes an OTHERWISE clause in a CASE statement.

  • It runs when the value matches none of the listed cases. ✓
  • So unexpected or invalid values are still handled, e.g. with an error message. ✓
06
Analysis
[3 marks]

This code should output "Merit" for marks of 60 or more and "Pass" for marks of 40 to 59. Identify the error and correct it.

IF Mark >= 40
  THEN
    OUTPUT "Pass"
  ELSE
    IF Mark >= 60
      THEN
        OUTPUT "Merit"
    ENDIF
ENDIF
  • The conditions are in the wrong order: any mark of 60 or more is caught by Mark >= 40 and outputs Pass. ✓
  • Merit can never be output (the inner IF only runs for marks below 40). ✓
  • Correction: test Mark >= 60 first (output Merit), then in the ELSE test Mark >= 40 (output Pass). ✓

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.