Question 4(b) 2021 · May-June · Paper 22 · 4 marks
Reveal official mark-scheme answer
Official answer for Question 4
Part (b)
Question 4
- Position: before INPUT PasswordRepeat // at start
- …use a (variable) counter (for number of tries) or flag
- … initialise variable counter or flag
Show text version of question
Question 4
Part (b)
Question 4
This algorithm checks passwords.
- Each password must be 8 or more characters in length; the predefined function Length
- Each password is entered twice, and the two entries must match.
- Either Accept or Reject is output.
- An input of 999 stops the process.
returns the number of characters.
REPEAT OUTPUT "Please enter password" INPUT Password IF Length(Password) >= 8 THEN INPUT PasswordRepeat IF Password <> PasswordRepeat THEN OUTPUT "Reject" ELSE OUTPUT "Accept" ENDIF ELSE OUTPUT "Reject" ENDIF UNTIL Password = 999
Part (b)
Explain how the algorithm could be extended to allow three attempts at inputting the matching
password. Any pseudocode statements used in your answer must be fully explained.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................
Why this question appears here
83% assigned-topic match · Algorithm design and problem-solving
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_s21_qp_22.pdf
