Skip to main content
A-LevelComputer ScienceFurther programming9618/21 · Oct/Nov 2023 · Q49 Marks

4 A global array is declared in pseudocode as follows: DECLARE Data : ARRAY[1:150] OF STRING A function TooMany() will: 1. take two parameters: • a string (the search string) • an integer (the maximum value) 2. count the number of strings in the array that exactly match the search string 3. return TRUE if the count is greater than the maximum value, otherwise will return FALSE

  1. (a)Write pseudocode for the function TooMany().[6]
  2. (b)The global array is changed to a 2D array, organised as 150 rows by 2 columns. It is declared in pseudocode as follows: DECLARE Data : ARRAY[1:150, 1:2] OF STRING The algorithm for the function in part (a) is changed. Strings will only be counted if both of the following conditions are true: : The current row is an even number. The search string exactly matches the value in either column. Write pseudocode to check these conditions. Assume that the row index is contained in variable Row and the search string in variable Search.[3]

Mark scheme

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

  1. [1] Function heading `FUNCTION TooMany(Search : STRING, Max : INTEGER) RETURNS BOOLEAN` and `ENDFUNCTION`
  2. [1] Declare `Count` and `Index` as INTEGER
  3. [1] Initialise `Count` to 0
  4. [1] Loop (e.g., `FOR Index ← 1 TO 150` or `WHILE` loop) for 150 iterations
  5. [1] Inside loop: `IF Data[Index] = Search THEN Count ← Count + 1 ENDIF`
  6. [1] Outside loop: `IF Count > Max THEN RETURN TRUE ELSE RETURN FALSE ENDIF`
  7. [1] Test for row being an even number (e.g., `Row MOD 2 = 0`)
  8. [1] Test for either column value matching `Search` (e.g., `Data[Row, 1] = Search OR Data[Row, 2] = Search`)
  9. [1] Correctly formed selection structure (e.g., `IF Row MOD 2 = 0 AND (Data[Row, 1] = Search OR Data[Row, 2] = Search) THEN` OR nested IFs OR FOR loop with STEP 2)

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
Further programming, A-Level Computer Science (syllabus 9618). Structured question, 9 marks.
Source
A-Level Computer Science, Oct/Nov 2023 Paper 2 Variant 1, question 4.

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