Past-paper question · 2019 October-November · Paper 22 · Q2

Question 2 2019 · October-November · Paper 22 · 4 marks

Original past-paper question for 2
Reveal official mark-scheme answer Official mark-scheme answer for 2

Official answer for Question 2

✓
One mark for each error identified and suggested correction:

Question 4

  • IF TotalTry > Number should be IF Guess > Number
  • IF Guess > Number should be IF Guess < Number
  • TotalTry ← Guess + 1 should be TotalTry ← TotalTry + 1
  • UNTIL Guess <> Number should be UNTIL Guess = Number
✓
Questio
✓
Answer
✓
Mark
✓
n
✓
s

Mark scheme 2210_w19_ms_22.pdf →

Show text version of question

Question 2

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.

Error 1 ..............................................................................................................................................

Correction .........................................................................................................................................

..........................................................................................................................................................

Error 2 ..............................................................................................................................................

Correction .........................................................................................................................................

..........................................................................................................................................................

Error 3 ..............................................................................................................................................

Correction .........................................................................................................................................

..........................................................................................................................................................

Error 4 ..............................................................................................................................................

Correction .........................................................................................................................................

..........................................................................................................................................................

[4]

Question 8

Topic relevance

Why this question appears here

98% assigned-topic match · Programming › Programming concepts

Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.

Permanent source page: Educate A Change · From 2210_w19_qp_22.pdf

Keep practising this topic