Computer Science (AS & A Level) · Oct / Nov 2021 · Paper 22 · Question 4
9618
As printed in the paper
The question as text
The following is a procedure design in pseudocode. Line numbers are given for reference only. 10 PROCEDURE Check(InString : STRING) 11 DECLARE Odds, Evens, Index : INTEGER 12 13 Odds ← 0 14 Evens ← 0 15 Index ← 1 16 17 WHILE Index <= LENGTH(InString) 18 IF STR_TO_NUM(MID(InString, Index, 1)) MOD 2 <> 0 THEN 19 Odds ← Odds + 1 20 ELSE 21 Evens ← Evens + 1 22 ENDIF 23 Index ← Index + 1 24 ENDWHILE 25 26 CALL Result(Odds, Evens) 27 ENDPROCEDURE
Read automatically from the paper; the printed page above is exact.
Show the answer and mark scheme
4(a)[5]
4(b)[3]
4(c)(i)[2]
4(c)(ii)[1]
Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.

