A length check is a type of validation check. State the purpose of a length check.
- (a)A length check is a type of validation check. State the purpose of a length check.[1]
- (b)An email address can be validated by checking that it contains an @ symbol. Write the pseudocode for an algorithm that will allow an email address to be input and check whether or not it contains an @ symbol. Output a suitable message with the result. Use the string function SUBSTRING(EmailAddress, Start, 1) in your solution to return a string of length 1 character, starting at position Start, where EmailAddress is the identifier representing your input. You do not need to declare any variables for this algorithm, but variables must be initialised as necessary. Assume there will not be more than one @ symbol in the email address input.[6]
Mark scheme
Marking points from the official mark scheme (Oct/Nov 2025). The mark or mark type is shown in brackets.
- [1] To check that the data entered has the required number of characters.
- [1] MP1 Initialisation of variables – start location for checking and flag, if used
- [1] MP2 Input of email address into appropriate variable
- [1] MP3 Working condition-controlled loop present
- [1] MP4 Correct use of SUBSTRING
- [1] MP5 Use of condition for checking value extracted from SUBSTRING / '@'
- [1] MP6 Appropriate action if '@' found – loop termination
- [1] MP7 Appropriate action if ' @ ' NOT found – check the next character and loop termination if no more characters
- [1] MP8 Output that only shows when the email address is valid or invalid. Both cases required.
- [6] 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
Write your answer and get it marked
On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.
Sign up free →