Skip to main content
O-LevelComputer ScienceAlgorithm design and problem-solving2210/22 · May/June 2019 · Q28 Marks

An algorithm has been written in pseudocode to input 100 numbers, select and print the largest number and smallest number. ``` Count ← 1 INPUT Number High ← Number Low ← Count REPEAT INPUT Number IF Number > High THEN High ← Number ENDIF IF Number > Low THEN Low ← Number ENDIF Count ← Count + 1 UNTIL Count = 99 PRINT "Largest Number is ", Number PRINT "Smallest Number is ", Low ``` Find the four errors in the pseudocode and suggest a correction for each error.

  1. (a)Error 1 Correction Error 2. Correction Error 3... Correction Error 4. Correction[4]
  2. (b)Show how you would change the corrected algorithm to total the numbers and print the total. Use a variable Total.[4]

Mark scheme

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

  1. [4] Low ← Count should be Low ← Number
  2. [4] Number > Low should be Number < Low
  3. [4] UNTIL Count = 99 should be UNTIL Count > 99 or UNTIL Count = 100 or UNTIL Count >= 100 // Count ← 1 should be Count ← 0
  4. [4] PRINT "Largest Number is ", Number should be PRINT "Largest Number is ", High
  5. [4] MP1 Add Total ← 0 // Total ← Number
  6. [4] MP2 Add Total ← Total + Number
  7. [4] MP3 Add PRINT "Total is ", Total
  8. [4] MP4 All positioning explained / seen
  9. [4] (Sample code:) Count ← 1 INPUT Number High ← Number Low ← Number Total ← Number REPEAT INPUT Number Total ← Total + Number IF Number > High THEN High ← Number ENDIF IF Number < Low THEN Low ← Number ENDIF Count ← Count + 1 UNTIL Count > 99 PRINT "Largest Number is ", High PRINT "Smallest Number is ", Low PRINT "Total is ", Total

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, 8 marks.
Source
O-Level Computer Science, May/June 2019 Paper 2 Variant 2, question 2.

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