Question 4(a) 2019 · October-November · Paper 23 · 3 marks
Reveal official mark-scheme answer
Official answer for Question 4
Part (a)
Question 3
Show text version of question
Question 4
Part (a)
Question 4
The following pseudocode algorithm checks whether a string is a valid email address.
FUNCTION Check(InString : STRING) RETURNS BOOLEAN
DECLARE Index : INTEGER DECLARE NumDots : INTEGER DECLARE NumAts : INTEGER DECLARE NextChar : CHAR DECLARE NumOthers : INTEGER
NumDots 0 NumAts 0 NumOthers 0
FOR Index 1 TO LENGTH(InString)
NextChar MID(InString, Index, 1) CASE OF NextChar '.': NumDots NumDots + 1 '@': NumAts NumAts + 1 OTHERWISE NumOthers NumOthers + 1 ENDCASE
ENDFOR
IF (NumDots >= 1 AND NumAts = 1 AND NumOthers > 5) THEN RETURN TRUE ELSE RETURN FALSE ENDIF
ENDFUNCTION
Part (a)
Describe the validation rules that are implemented by this pseudocode. Refer only to the
contents of the string and not to features of the pseudocode.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................
Question 9
Why this question appears here
71% assigned-topic match · Hardware › Logic gates and logic circuits
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_23.pdf
