The variables A and B are used in a program. A holds a whole number and B holds text.
- (a)Write pseudocode statements to declare the variables A and B[2]
- (b)The function Odds (X) returns 'Odd' if the value of x is an odd number and returns 'Even' if the value of x is an even number. Write pseudocode statements to: • define the function • call the function using parameter A and store the return item in variable B Function definition Function call[6]
Mark scheme
Marking points from the official mark scheme (May/June 2025). The mark or mark type is shown in brackets.
- [1] (a) DECLARE A: INTEGER
- [1] (a) DECLARE B: STRING
- [1] (b) One mark for using FUNCTION and ENDFUNCTION and RETURNS STRING
- [1] (b) One mark for naming the function Odds.
- [1] (b) One mark for defining the parameter correctly.
- [1] (b) One mark for determining if odd/even using MOD/DIV/ROUND using parameter.
- [1] (b) One mark for correctly returning 'Odd' and 'Even'.
- [1] (b) One mark for correct function call
- Example (b): FUNCTION Odds(X: INTEGER) RETURNS STRING IF MOD(X, 2) = 0 THEN RETURN "Even" ELSE RETURN "Odd" ENDIF ENDFUNCTION B ← Odds (A)
Write your answer and get it marked
On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.
Sign up free →