Note AcademyNote Academy

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~ €‚€ƒ „ |}}| †v„‡uuˆ v„‰Š ‹Œ }y|{ u xyz{|}y }~Ž „ ‘y’y} u“ xyz{|}y z~”•– „ ‘y’y} 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  yxŒ “ y¨‘ š€~› ‹} }~Ž ª ‡uu ‰ ‹Ÿ‘¤Ÿ‘ ¥š˜‚« ¦~  ~€«˜ –˜¬ ­ ~ ®¥ ‡ ¤Ÿ‘ | ƒŽ˜ œ Œ | ƒŽ˜ § ¯¯ ‹} | ƒŽ˜ § ¯ ¯ ž ‘£y  z~ €— •˜ ‘}Ÿy ¡ yxŒ “u yx¢£{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 REAL

    should be DECLARE Contacts : ARRAY[1:500, 1:4] OF STRING

    Line 12 / OUTPUT FirstName

    should be INPUT FirstName

    Line 17 / OUTPUT Contacts[Row, 1]

    should be OUTPUT Contacts[Row, Column]

    Line 23 / NEXT Stop OR Row > 500

    should be UNTIL Stop OR Row > 500

    Line 25 / 26 / Answer variable not declared

    should be DECLARE Answer : CHAR before line 25

    Line 28 / Continue ← TRUE

    should 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.