Past-paper question · 2021 May-June · Paper 22 · Q4(a)

Question 4(a) 2021 · May-June · Paper 22 · 3 marks

Original past-paper question for 4(A)
Original past-paper question for 4(A)
Reveal official mark-scheme answer Official mark-scheme answer for 4(A)

Official answer for Question 4

Part (a)

✓
One mark for each correct column

Question 3

✓
OUTPUT
✓
Password
✓
PasswordRepeat
✓
(Please enter password)
✓
Secret
✓
(Please enter password)
✓
Secret
✓
(Please enter password)
✓
VerySecret
✓
VerySecret
✓
(Please enter password)
✓
Pa55word
✓
Pa55word
✓
(Please enter password)
✓
999
✓
2210/22
✓
Cambridge O Level – Mark Scheme
✓
May/June 2021
✓
PUBLISHED
✓
Question
✓
Answer
✓
Marks

Mark scheme 2210_s21_ms_22.pdf →

Show text version of question

Question 4

Part (a)

Question 4

This algorithm checks passwords.

  • Each password must be 8 or more characters in length; the predefined function Length
  • returns the number of characters.

  • Each password is entered twice, and the two entries must match.
  • Either Accept or Reject is output.
  • An input of 999 stops the process.

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 (a)

Complete the trace table for the algorithm using this input data:

Secret, Secret, VerySecret, VerySecret, Pa55word, Pa55word, 999, 888

Password PasswordRepeat OUTPUT

[3]

Question 11

Topic relevance

Why this question appears here

98% 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

Keep practising this topic