Skip to main content
O-LevelComputer ScienceAlgorithm design and problem-solving2210/22 · Oct/Nov 2021 · Q410 Marks

The pseudocode algorithm should work as a calculator and output the result. 1 Continue ← 1 2 WHILE Continue = 0 3 OUTPUT "Enter 1 for +, 2 for -, 3 for * or 4 for /" 4 INPUT Operator 5 OUTPUT "Enter the first value" 6 INPUT Value1 7 OUTPUT "Enter the second value" 8 OUTPUT Value2 9 IF Operator 10 1: Answer ← Value1 + Value2 11 2: Answer ← Value1 - Value2 12 3: Answer ← Value1 * Value2 13 4: Answer ← Value1 / Value2 14 ENDCASE 15 OUTPUT "The answer is ", Value1 16 OUTPUT "Do you wish to enter more values (Yes or No)?" 17 INPUT MoreValues 18 IF MoreValues = "No" 19 THEN 20 Continue ← 1 21 ENDIF 22 UNTIL Continue = 0

  1. (a)Find the five errors in the pseudocode and suggest a correction for each error. Error 1 Correction Error 2 Correction Error 3 Correction Error 4 Correction Error 5 Correction[5]
  2. (b)The algorithm needs changing to allow only the numbers 1, 2, 3, or 4 to be entered for the input variable Operator. Write the pseudocode to perform this task and state where in the algorithm it would be located. Pseudocode Location in algorithm[5]

Mark scheme

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

  1. One mark for error identified and suggested correction (Max three)
  2. Line 8 OUTPUT Value2 - should be INPUT Value2
  3. Line 9 IF Operator – should be CASE OF Operator
  4. Line 15 OUTPUT "The answer is ", Value1 - should be Answer
  5. The loop may be corrected using a number of alternative methods:
  6. One mark for error identified and suggested correction (Max two)
  7. Method 1
  8. Line 1 Continue ← 1 should be Continue ← 0
  9. Line 22 UNTIL Continue = 0 should be ENDWHILE // Line 2 WHILE Continue = 0 should be REPEAT and Line 22 UNTIL Continue = 0 should be Until Continue = 1
  10. OR
  11. Method 2
  12. Line 2 WHILE Continue = 0 should be REPEAT
  13. Line 20 Continue ← 1 should be Continue ← 0 // Line 1 Continue ← 1 should be Continue ← 0 and Line 22 UNTIL Continue = 0 should be Until Continue = 1
  14. OR
  15. Method 3
  16. Line 2 WHILE Continue = 0 should be WHILE Continue = 1
  17. Line 20 Continue ← 1 should be Continue ← 0 and Line 22 UNTIL Continue = 0 should be ENDWHILE
  18. One mark per bullet
  19. MP1 Appropriate loop (begin and end) / otherwise selection
  20. MP2 Testing both ends of condition
  21. MP3 Suitable message
  22. MP4 Input/re-input
  23. WHILE Operator < 1 OR Operator > 4 (DO)
  24. OUTPUT "Enter 1, 2, 3 or 4"
  25. INPUT Operator
  26. ENDWHILE
  27. Alternative answer
  28. REPEAT
  29. IF Operator < 1 OR Operator > 4
  30. THEN
  31. OUTPUT "Enter 1, 2, 3 or 4"
  32. INPUT Operator
  33. ENDIF
  34. UNTIL Operator >= 1 AND Operator <= 4
  35. One mark
  36. After line 4 / between lines 2 and 5

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
Algorithm design and problem-solving, O-Level Computer Science (syllabus 2210). Structured question, 10 marks.
Source
O-Level Computer Science, Oct/Nov 2021 Paper 2 Variant 2, question 4.

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