Skip to main content
O-LevelComputer ScienceAlgorithm design and problem-solving2210/22 · Oct/Nov 2025 · Q215 Marks

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. 01 DECLARE Contacts : ARRAY[1:500, 1:4] OF REAL 02 DECLARE Row : INTEGER 03 DECLARE Column : INTEGER 04 DECLARE Continue : BOOLEAN 05 DECLARE Stop : BOOLEAN 06 DECLARE FirstName : STRING 07 Continue ← TRUE 08 Stop ← FALSE 09 WHILE Continue 10 Row ← 1 11 OUTPUT "Enter a first name " 12 OUTPUT FirstName 13 REPEAT 14 IF Contacts[Row, 1] = FirstName 15 THEN 16 FOR Column ← 1 TO 4 17 OUTPUT Contacts[Row, 1] 18 NEXT Column 19 Stop ← TRUE 20 ELSE 21 Row ← Row + 1 22 ENDIF 23 NEXT Stop OR Row > 500 24 OUTPUT "Search for another name? (Y or N)" 25 INPUT Answer 26 IF Answer = 'N' OR Answer = 'n' 27 THEN 28 Continue ← TRUE 29 ENDIF 30 ENDWHILE

  1. (a)Identify the line numbers of five errors in the pseudocode and suggest a correction for each error. Error 1 line number ................................................................................................... Correction .............................................................................................................[5]
  2. (b)(i)Complete the pseudocode for PROCEDURE NewData PROCEDURE NewData(.. .) FOR RoW 1 ΤΟ FOR Column ← 1 TO 4 INPUT ENDPROCEDURE[4]
  3. (b)(ii)Write the pseudocode to input the number of new contacts and to use procedure NewData. A variable declaration is not required.[2]
  4. (c)(i)Explain why the given algorithm may not always give the expected results.[2]
  5. (c)(ii)Explain how you could improve the algorithm so that the search is more likely to find the required results.[2]

Mark scheme

Marking points from the official mark scheme (Oct/Nov 2025). The mark or mark type is shown in brackets.

  1. [1] Line 01 / DECLARE Contacts : ARRAY[1:500, 1:4] OF REAL should be DECLARE Contacts : ARRAY[1:500, 1:4) OF STRING
  2. [1] Line 12 / OUTPUT FirstName should be INPUT FirstName
  3. [1] Line 17/OUTPUT Contacts[Row, 1] should be OUTPUT Contacts[Row, Column]
  4. [1] Line 23 / NEXT Stop OR Row > 500 should be UNTIL Stop OR Row > 500
  5. [1] Line 25/26 / Answer variable not declared should be DECLARE Answer : CHAR before line 25
  6. [1] Line 28 / Continue ← TRUE should be Continue ← FALSE
  7. [1] MP1 Appropriate parameter in PROCEDURE line
  8. [1] MP2 Correct index outer loop termination value; must use Number as stated in question
  9. [1] MP3 Correct array reference in INPUT
  10. [1] MP4 Correct termination of both loops.
  11. [4] Example: PROCEDURE NewData (Number : INTEGER) FOR Row ← 1 TO Number FOR Column ← 1 TO 4 INPUT Contacts [Row, Column] NEXT Column NEXT Row ENDPROCEDURE
  12. [1] MP1 Correct input statement
  13. [1] MP2 Correct call statement for NewData
  14. [2] Example: INPUT MyNumber CALL NewData (MyNumber)
  15. [1] MP1 There may be more than one person with the given first name // The name may not exist/found in the array
  16. [1] MP2 The search will stop at the first occurrence and output the data for the wrong person
  17. [1] MP3 If the name is not present there could be no output / the loop will continue.
  18. [1] MP1 Introduce additional search criteria into the algorithm to make the search more specific to each person in the array
  19. [1] 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
  20. [1] MP3 The algorithm should be able to search the whole array to find all available matches
  21. [1] MP4 by removing the stop variable
  22. [1] MP5 Use selection to confirm the name has not been found in the whole array
  23. [1] MP6 If the name is not present, output an appropriate message.

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 →

About this question

Topic
Algorithm design and problem-solving, O-Level Computer Science (syllabus 2210). Structured question, 15 marks.
Source
O-Level Computer Science, Oct/Nov 2025 Paper 2 Variant 2, question 2.

Questions and mark schemes are from past examination papers and remain the copyright of the exam board. How Oracle Prep builds its content

Related Computer Science questions

© 2026 Oracle Prep