Past-paper question · 2021 May-June · Paper 22 · Q5(b)(ii)

Question 5(b)(ii) 2021 · May-June · Paper 22 · 6 marks

Original past-paper question for 5(B)(II)
Original past-paper question for 5(B)(II)
Reveal official mark-scheme answer Official mark-scheme answer for 5(B)(II)

Official answer for Question 5

Part (b)

(ii)

✓
'Pseudocode' solution included here for development and clarification of

Question 6

✓
mark scheme.
✓
Programming language example solutions appear in the Appendix.
✓
FUNCTION Verify(UserID : STRING) RETURNS BOOLEAN
✓
DECLARE Count : INTEGER
✓
DECLARE Response : BOOLEAN
✓
DECLARE Password : STRING
✓
Count ← 1
✓
Response ← FALSE
✓
IF UserID = "Guest" THEN
✓
Response ← TRUE
✓
ENDIF
✓
WHILE Response = FALSE AND Count < 4
✓
OUTPUT "Please input your password: "
✓
INPUT Password
✓
Response ← Validate(UserID, Password) AND TODAY()
✓
IF Response = FALSE THEN
✓
IF Count < 3 THEN
✓
OUTPUT "Incorrect password – please try again"
✓
ENDIF
✓
Count ← Count + 1
✓
ENDIF
✓
ENDWHILE
✓
RETURN Response
✓
ENDFUNCTION
✓
1 mark for each of the following:

Question 1

✓
If parameter matches "Guest" then skip to Return (MP7)

Question 2

✓
Loop for max 3 attempts and terminate if valid password input

Question 3

✓
Prompt and Input first password attempt

Question 4

✓
Evaluate result of Validate() AND TODAY() in a loop...

Question 5

✓
Test result and increment count for incorrect password in a loop...

Question 6

✓
...output 'try again' message and re-input password in a loop...

Question 7

✓
Return Boolean (correctly in all 3 cases)
✓
Note: Max 6 marks
✓
9608/22
✓
Cambridge International AS & A Level – Mark Scheme
✓
May/June 2021
✓
PUBLISHED
✓
Question
✓
Answer
✓
Marks

Mark scheme 9608_s21_ms_22.pdf →

Show text version of question

Question 5

Part (b)

(ii)

(ii)

The function, Verify(), is to be amended as follows:

  • if the UserID is "Guest", a password is not required and TRUE should be returned
  • output a message to try again if the password entered is not valid
  • return FALSE if the number of attempts to enter a valid password exceeds three.

Write program code for the amended function Verify().

Visual Basic and Pascal: You should include the declaration statements for variables. Python: You should show a comment statement for each variable used with its data type.

Programming language ......................................................................................................

Program code

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[6]

Question 12

Topic relevance

Why this question appears here

72% assigned-topic match · Data types and structures › Data types and records

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 9608_s21_qp_22.pdf

Keep practising this topic