These are real past-paper questions. Think of your answer first, then open the explanation.
May/June 2026 · Paper 2 · Algorithm design and problem solving
Tick one box to identify the type of validation check to test whether a number entered into a computer system is between two set values: A length check; B presence check; C type check; D range check. [1]
Show model answer
D (range check).
A range check tests whether a value lies between two limits.
May/June 2026 · Paper 2 · Programming
Identify four operators that are not arithmetic operators from the list: / > <= + * ^ AND DIV MOD NOT. [4]
Show model answer
> ; <= ; AND ; NOT (in any order).
Comparison (>, <=) and logical (AND, NOT) operators are not arithmetic.
May/June 2026 · Paper 2 · Programming
Give programming examples for a count-controlled loop and a post-condition loop. Describe each of the loops. Count-controlled loop: example ..., description ... Post-condition loop: example ..., description ... [4]
Show model answer
Count-controlled loop example: FOR (loop, e.g. FOR Count <- 1 TO 10 ... NEXT Count); description: iterates a pre-determined number of times. Post-condition loop example: REPEAT ... UNTIL; description: checks the condition at the end of the loop, so it will always iterate at least once.
FOR repeats a set number of times; REPEAT-UNTIL tests its condition after the body, so it runs at least once.
May/June 2026 · Paper 2 · Programming
The function Power(FirstNumber, SecondNumber) returns the value of FirstNumber raised to the power of SecondNumber. FirstNumber and SecondNumber are integers. Write pseudocode statements to: define the function; call the function with the variables A and B and store the return value in the variable Value. [5]
Show model answer
Function definition:
FUNCTION Power(FirstNumber : INTEGER, SecondNumber : INTEGER) RETURNS INTEGER
RETURN FirstNumber ^ SecondNumber
ENDFUNCTION
Function call:
Value <- Power(A, B)
(Alternative calculation using a loop: Num <- 1; FOR I <- 1 TO SecondNumber; Num <- Num * FirstNumber; NEXT I; RETURN Num.)
Marks are for the FUNCTION ... RETURNS ... ENDFUNCTION structure, the parameters, the calculation, the RETURN, and the call.