Past-paper question · 2019 October-November · Paper 21 · Q5(b)(ii)

Question 5(b)(ii) 2019 · October-November · Paper 21 · 2 marks

Original past-paper question for 5(B)(II)
Original past-paper question for 5(B)(II)
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)

✓
One mark per bullet point:

Question 2

✓
•
✓
Returned value is FALSE
✓
•
✓
Digit – Other is not greater than zero // Number of Digit same as
✓
Other
✓
9608/21
✓
Cambridge International AS/A Level – Mark Scheme
✓
October/November
✓
PUBLISHED
✓
2019
✓
Question
✓
Answer
✓
Marks

Mark scheme 9608_w19_ms_21.pdf →

Show text version of question

Question 5

Part (b)

(ii)

Question 5

The following pseudocode checks whether a string is a valid password.

FUNCTION CheckPassword(InString : STRING) RETURNS BOOLEAN

DECLARE Index, Upper, Lower, Digit, Other : INTEGER DECLARE NextChar : CHAR

Upper 0 Lower 0 Digit 0 Other 0

FOR Index 1 TO LENGTH(InString)

NextChar MID(InString, Index, 1) IF NextChar >= 'A' AND NextChar <= 'Z' THEN Upper Upper + 1 ELSE IF NextChar >= 'a' AND NextChar <= 'z' THEN Lower Lower + 1 ELSE IF NextChar >= '0' AND NextChar <= '9' THEN Digit Digit + 1 ELSE Other Other + 1 ENDIF ENDIF ENDIF

ENDFOR

IF Upper > 1 AND Lower >= 5 AND (Digit - Other) > 0 THEN RETURN TRUE ELSE RETURN FALSE ENDIF

ENDFUNCTION

(ii)

State the value returned when the function is called using the expression shown. Justify

your answer.

Value .................................................................................................................................

Justification .......................................................................................................................

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

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

[2]

Question 12

Topic relevance

Why this question appears here

99% 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_w19_qp_21.pdf

Keep practising this topic