Computer Science · Oct / Nov 2025 · Paper 22 · Question 2
0478
As printed in the paper
The question as text
This pseudocode algorithm is intended to input a first name from a user and search for it in a two-dimensional (2D) array. If the name is found, the algorithm outputs all the remaining details for that name. The algorithm will continue to allow other names to be entered for searching, until the user input stops it. uv xyz{|}y z~ |}}| vuu v }y|{ u xyz{|}y }~ yy} u xyz{|}y z~ yy} u xyz{|}y z~ {y| u xyz{|}y ~ {y| u xyz{|}y } u z~ }y u ~ |{y u¡ ¢£{y z~ vu }~ v vv ¤ ¥y ¦ ¥ v ¤ v }y¤y| v z~ }~ v § v £y v } z~ v v ¤ z~ }~ v v y¨ z~ v¡ ~ }y u y{y v }~ }~ © v yx y¨ ~ } }~ ª uu ¤ ¥« ¦~ ~« ¬ ~ ®¥ ¤ | | § ¯¯ } | § ¯ ¯ £y z~ }y ¡ yx u yx¢£{y
Read automatically from the paper; the printed page above is exact.
Show the answer and mark scheme
2(a)[5]
One mark per mark point, max five
Line 01 / DECLARE Contacts : ARRAY[1:500, 1:4] OF REALshould be DECLARE Contacts : ARRAY[1:500, 1:4] OF STRING
Line 12 / OUTPUT FirstNameshould be INPUT FirstName
Line 17 / OUTPUT Contacts[Row, 1]should be OUTPUT Contacts[Row, Column]
Line 23 / NEXT Stop OR Row > 500should be UNTIL Stop OR Row > 500
Line 25 / 26 / Answer variable not declaredshould be DECLARE Answer : CHAR before line 25
Line 28 / Continue ← TRUEshould be Continue ← FALSE
2(b)(i)[4]
One mark per mark point, max four
MP1
Appropriate parameter in PROCEDURE line
MP2
Correct index outer loop termination value; must use Number as stated in question
MP3
Correct array reference in INPUT
MP4
Correct termination of both loops.
Example:
PROCEDURE NewData(Number : INTEGER)
FOR Row ← 1 TO Number
FOR Column ← 1 TO 4
INPUT Contacts[Row, Column]
NEXT Column
NEXT Row
ENDPROCEDURE
2(b)(ii)[2]
One mark per mark point, max two
MP1
Correct input statement
MP2
Correct call statement for NewData
Example:
INPUT MyNumber
CALL NewData(MyNumber)
2(c)(i)[2]
One mark per mark point, max two
MP1
There may be more than one person with the given first name // The name may not exist/found in the array MP2
The search will stop at the first occurrence and output the data for the wrong person
MP3
If the name is not present there could be no output / the loop will continue.
2(c)(ii)[2]
One mark per mark point, max two
MP1
Introduce additional search criteria into the algorithm to make the search more specific to each person in the array
MP2
… such as the last name to go with the first name // … such as some form of ID number / date of birth / contact number / post code
MP3
The algorithm should be able to search the whole array to find all available matches
MP4
… by removing the stop variable
MP5
Use selection to confirm the name has not been found in the whole array
MP6
If the name is not present, output an appropriate message.
Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.

