Skip to main content
A-LevelComputer ScienceProgramming9618/21 · May/June 2022 · Q69 Marks

An algorithm will: • output each integer value between 100 and 200 that ends with the digit 7, for example, 107 • output a final count of the number of values that are output. Write pseudocode for this algorithm. Any variables used must be declared.

  1. (a)An algorithm will: • output each integer value between 100 and 200 that ends with the digit 7, for example, 107 • output a final count of the number of values that are output. Write pseudocode for this algorithm. Any variables used must be declared.[5]
  2. (b)Study the following pseudocode. CASE OF MySwitch 1: ThisChar ← 'a' 2: ThisChar ← 'y' 3: ThisChar ← '7' OTHERWISE: ThisChar ← '*' ENDCASE Write pseudocode with the same functionality without using a CASE structure.[4]

Mark scheme

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

  1. [5] (a) DECLARE ThisInt, Count : INTEGER Count ← 0 FOR ThisInt ← 100 TO 200 IF ThisInt MOD 10 = 7 THEN OUTPUT ThisInt Count← Count + 1 ENDIF NEXT ThisInt OUTPUT Count
  2. [5] (a) Mark as follows: 1 Declare loop variable and counter as integers, counter initialised
  3. [5] (a) Mark as follows: 2 Loop 100 to 200, no step defined
  4. [5] (a) Mark as follows: 3 Test value in a loop
  5. [5] (a) Mark as follows: 4 Output selected value and incrementing a counter in a loop
  6. [5] (a) Mark as follows: 5 Output the counter, following a reasonable attempt, after the loop
  7. [5] (a) Alternative Solution: DECLARE ThisInt, Count : INTEGER Count ← 0 FOR ThisInt ← 107 TO 197 STEP 10 OUTPUT ThisInt Count← Count + 1 NEXT ThisInt OUTPUT Count
  8. [5] (a) Mark as follows: 1 Declare loop variable and counter as integers,, counter initialised
  9. [5] (a) Mark as follows: 2 Loop (107 to 197)
  10. [5] (a) Mark as follows: 3 STEP 10 or explicit increment if conditional loop used
  11. [5] (a) Mark as follows: 4 Output each value and incrementing a counter in a loop
  12. [5] (a) Mark as follows: 5 Output the counter, following a reasonable attempt, after the loop
  13. [4] (b) IF MySwitch = 1 THEN ThisChar ← 'a' ELSE IF MySwitch = 2 THEN ThisChar ← 'y' ELSE IF MySwitch = 3 THEN ThisChar← '7' ELSE ThisChar ← '*' ENDIF ENDIF ENDIF
  14. [4] (b) Mark as follows: 1. ANY test of MySwitch = 1, 2 or 3
  15. [4] (b) Mark as follows: 2. All three comparisons and corresponding assignments
  16. [4] (b) Mark as follows: 3. OTHERWISE, or initial assignment of default value
  17. [4] (b) Mark as follows: 4. Completely correct IF...THEN...ELSE...ENDIF syntax

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, May/June 2022 Paper 2 Variant 1, 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