Skip to main content
A-LevelComputer ScienceProgramming9618/22 · May/June 2022 · Q67 Marks

A string represents a series of whole numbers, separated by commas. For example: "12,13,451,22" Assume that: • the comma character ',' is used as a separator • the string contains only the characters '0' to '9' and the comma character ','. A procedure Parse will: • take the string as a parameter • extract each number in turn • calculate the total value and average value of all the numbers • output the total and average values with a suitable message.

  1. (a)Write pseudocode for the procedure. PROCEDURE Parse(InString : STRING) ENDPROCEDURE[7]

Mark scheme

Marking points from the official mark scheme (May/June 2022). The mark or mark type is shown in brackets.

  1. [7] Marks as follows:
  2. 1 Declare and initialise Count, Total and NumString
  3. 2 Loop for number of characters in InString
  4. 3 Extract a character and test for comma in a loop
  5. 4 If comma, convert NumString to integer and update Total and Count
  6. 5 and reset NumString
  7. 6 Otherwise append character to NumString
  8. 7 Calculate average AND final output statement(s) outside the loop

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, 7 marks.
Source
A-Level Computer Science, May/June 2022 Paper 2 Variant 2, question 6.

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