Computer Science · Oct / Nov 2025 · Paper 22 · Question 4
0478
As printed in the paper
Show the answer and mark scheme
4(a)[1]
To check that the data entered has the required number of characters.
4(b)[6]
One mark per mark point, max six
MP1
Initialisation of variables – start location for checking and flag, if used
MP2
Input of email address into appropriate variable
MP3
Working condition-controlled loop present
MP4
Correct use of SUBSTRING
MP5
Use of condition for checking value extracted from SUBSTRING / '@'
MP6
Appropriate action if '@' found – loop termination
MP7
Appropriate action if '@' NOT found – check the next character and loop termination if no more characters MP8
Output that only shows when the email address is valid or invalid. Both cases required.
Example:
// Variable declarations are not required
INPUT EmailAddress
Start ← 1
Valid ← FALSE
REPEAT
IF SUBSTRING(EmailAddress, Start, 1) = '@'
THEN
Valid ← TRUE
ELSE
Start ← Start + 1
ENDIF
UNTIL Start > LENGTH(EmailAddress) OR Valid
IF Valid
THEN
OUTPUT EmailAddress, " is valid"
ELSE
OUTPUT EmailAddress, " is NOT valid"
ENDIF
Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.

