Computer Science · May / June 2025 · Paper 21 · Question 9
0478
As printed in the paper
The question as text
The variables ¦ and Ë are used in a program. ¦ holds a whole number and Ë holds text.
Read automatically from the paper; the printed page above is exact.
Show the answer and mark scheme
9(a)[2]
One mark for each correct line
DECLARE A: INTEGER
DECLARE B: STRING
9(b)[6]
One mark for using FUNCTION and ENDFUNCTION and RETURNS STRING
One mark for naming the function Odds.
One mark for defining the parameter correctly.
One mark for determining if odd/even using MOD/DIV/ROUND using parameter.
One mark for correctly returning ‘Odd’ and ‘Even’.
One mark for correct function call
Example:
FUNCTION Odds(X: INTEGER) RETURNS STRING
IF MOD(X, 2) = 0
THEN
RETURN "Even"
ELSE
RETURN "Odd"
ENDIF
ENDFUNCTION
B ← Odds(A)
Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.

