Skip to main content
A-LevelComputer ScienceProgramming9618/22 · May/June 2021 · Q68 Marks

A procedure CountVowels () will: • be called with a string containing alphanumeric characters as its parameter • count and output the number of occurrences of each vowel (a, e, i, o, u) in the string • count and output the number of occurrences of the other alphabetic characters (as a single total). The string may contain both upper and lower case characters. Each count value will be stored in a unique element of a global 1D array CharCount of type INTEGER. The array will contain six elements. Write pseudocode for the procedure CountVowels().

  1. Write pseudocode for the procedure CountVowels().[8]

Mark scheme

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

  1. [1] PROCEDURE CountVowels(ThisString : STRING)
  2. [1] DECLARE Index : INTEGER
  3. [1] DECLARE ThisChar : CHAR
  4. [1] FOR Index ← 1 to 6
  5. [1] CharCount[Index] ← 0 //initialise elements
  6. [1] NEXT Index
  7. [1] Index ← 1
  8. [1] FOR Index ← 1 TO LENGTH(ThisString)
  9. [1] ThisChar ← LCASE(MID(ThisString, Index, 1))
  10. [1] CASE OF ThisChar
  11. [1] 'a' : CharCount [1] ← CharCount [1] + 1
  12. [1] 'e' : CharCount [2] ← CharCount [2] + 1
  13. [1] 'i' : CharCount [3] ← CharCount [3] + 1
  14. [1] 'o' : CharCount [4] ← CharCount [4] + 1
  15. [1] 'u' : CharCount [5] ← CharCount [5] + 1
  16. [1] 'a' TO 'z': CharCount (6) ← CharCount [6] + 1
  17. [1] ENDCASE
  18. [1] NEXT Index
  19. [1] FOR Index ← 1 to 6
  20. [1] OUTPUT CharCount [Index] //output results
  21. [1] NEXT Index
  22. [1] ENDPROCEDURE

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, 8 marks.
Source
A-Level Computer Science, May/June 2021 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