Skip to main content
A-LevelComputer ScienceProgramming9618/23 · May/June 2023 · Q611 Marks

A procedure Select () will: 1. take two integer values as parameters representing start and end values where both values are greater than 9 and the end value is greater than the start value 2. output each integer value between the start and the end value (not including the start and end values), where the sum of the last two digits is 6, for example, 142.

  1. (a)Write pseudocode for procedure Select(). Parameter validation is not required.[7]
  2. (b)The check performed by procedure Select() on the last two digits is needed at several places in the program and will be implemented using a new function. The new function CheckNum() will: • allow the required sum to be specified (not just 6) • check one number • return an appropriate value. Describe the function interface and two advantages of this modular approach. Interface Advantage 1 Advantage 2[4]

Mark scheme

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

  1. [7] PROCEDURE Select(Start, End : INTEGER)
  2. [7] DECLARE ThisNum, Total: INTEGER
  3. [7] DECLARE ThisString : STRING
  4. [7] DECLARE Char1, Char2 : CHAR
  5. [7] FOR ThisNum ← Start+1 TO End-1
  6. [7] ThisString ← NUM_TO_STR(ThisNum)
  7. [7] Char1 ← RIGHT(ThisString, 1)
  8. [7] Char2 ← LEFT(RIGHT(ThisString, 2), 1)
  9. [7] Total ← STR_TO_NUM(Char1) + STR_TO_NUM(Char2)
  10. [7] IF Total = 6 THEN
  11. [7] OUTPUT ThisString
  12. [7] ENDIF
  13. [7] NEXT ThisNum
  14. [7] ENDPROCEDURE
  15. [7] MP1 Procedure heading and ending
  16. [7] MP2 (Count-controlled) Loop
  17. [7] MP3 ... with correct range from Start+1 to End-1
  18. [7] MP4 Convert ThisNum (loop counter) to a string
  19. [7] MP5 Extract the last two/first/second 'character digit(s)' required in a loop
  20. [7] MP6 Extract the second individual 'character digit' required in a loop
  21. [7] MP7 Calculate the sum of the last two digits
  22. [7] MP8 If sum = 6 then OUTPUT the number (either string or integer) in a loop
  23. [4] Max 4 marks
  24. [4] MP1 The function will take two integer parameters - the number and the (required) total
  25. [4] MP2 ... and return a Boolean
  26. [4] OR: CheckNum(Number,Total : INTEGER) RETURNS BOOLEAN
  27. [4] Two marks for the advantages:
  28. [4] MP3 CheckNum() can be called repeatedly as and when required
  29. [4] MP4 CheckNum() is designed and tested once (then used repeatedly)
  30. [4] MP5 Any subsequent change to CheckNum() needs to be made once only // is easier to maintain/modify

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, 11 marks.
Source
A-Level Computer Science, May/June 2023 Paper 2 Variant 3, 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