Skip to main content
A-LevelComputer ScienceProgramming9618/22 · Oct/Nov 2024 · Q29 Marks

A program is being developed to process bank card information. When a card number is displayed, all the characters except the last four are replaced with the asterisk character '*'. Card numbers are stored as strings. The strings are between 10 and 20 characters in length. The function Conceal() will take a string representing a card number and return a modified string. Example strings: | Original string | Modified string | |------------------------|------------------------| | "1234567890" | "******7890" | | "1234567897652" | "*********7652" | | "1234567890123456" | "************3456" |

  1. (a)The function Conceal() will: • take a numeric string as a parameter representing the card number • return a string in which the asterisk character replaces all except the last four characters of the card number parameter. Write pseudocode for the function Conceal().[6]
  2. (b)(i)The requirements have been changed. Conceal() will now be written as a procedure which will process 100 card numbers each time it is called. The card numbers will be stored in a 2D array CardNumber. The original string will be stored in column one and the modified string in column two. Write pseudocode to declare the array.[2]
  3. (b)(ii)The new procedure Conceal() will write the modified string to the corresponding element in column two. The array CardNumber is passed as a parameter to the new procedure Conceal(). Identify how this parameter should be specified in the new procedure header.[1]

Mark scheme

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

  1. [1] FUNCTION Conceal (CardNumber : STRING) RETURNS STRING
  2. [1] DECLARE MaskedString : STRING
  3. [1] DECLARE Count : INTEGER
  4. [1] CONSTANT Asterisk = '*'
  5. [1] MaskedString ← RIGHT(CardNumber, 4)
  6. [1] FOR Count ← 1 TO LENGTH(CardNumber) - 4
  7. [1] MaskedString ← Asterisk & MaskedString
  8. [1] NEXT Count
  9. [1] RETURN MaskedString
  10. [1] ENDFUNCTION
  11. [1] DECLARE CardNumber : ARRAY [1:100, 1:2] OF STRING
  12. [1] Correct dimensions
  13. [1] All other parts of the statement correct
  14. [1] Any reference to BYREF // 'by reference'

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
Programming, A-Level Computer Science (syllabus 9618). Structured question, 9 marks.
Source
A-Level Computer Science, Oct/Nov 2024 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