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

An algorithm has been written in pseudocode to select a random number using the function RandInt(n), which returns a whole number between 1 and the argument n. The algorithm then allows the user to guess the number. Number ← RandInt(100) TotalTry ← 1 REPEAT PRINT "Enter your guess now, it must be a whole number" INPUT Guess IF TotalTry > Number THEN PRINT "Too large try again" ENDIF IF Guess > Number THEN PRINT "Too small try again" ENDIF TotalTry ← Guess + 1 UNTIL Guess <> Number TotalTry ← TotalTry - 1 PRINT "Number of guesses ", TotalTry Find the four errors in the pseudocode and suggest a correction to remove each error.

  1. (a)Find the four errors in the pseudocode and suggest a correction to remove each error.[4]

Mark scheme

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

  1. [4] One mark for each error identified and suggested correction:
  2. ∞ IF TotalTry > Number should be IF Guess > Number
  3. ∞ IF Guess > Number should be IF Guess < Number
  4. ∞ TotalTry ← Guess + 1 should be TotalTry ← TotalTry + 1
  5. ∞ UNTIL Guess <> Number should be UNTIL Guess = Number

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, 4 marks.
Source
O-Level Computer Science, Oct/Nov 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