Computer Science · May / June 2025 · Paper 21 · Question 4
0478
As printed in the paper
The question as text
A telephone number with 13 characters is input. The first character is a ‘+’, followed by a 2-digit country code, for example: +20xxxxxxxxxx where 20 is the country code and x is a digit between 0 and 9 inclusive. The algorithm includes checks for the country codes: 44 for the UK and 20 for Egypt.
Read automatically from the paper; the printed page above is exact.
Show the answer and mark scheme
4(a)[5]
One mark per bullet point. Max 5
Correct input of numberUse of substring ( )…to extract the correct numberCorrect use of IF statements/Case statement with matching END IF / END CASEOutput of matching locationsOutput of unknownExample
Value ← SUBSTRING(Telephone, 2, 2)
OUTPUT "Please enter a telephone number "
INPUT Telephone
IF Value = "44"
THEN
OUTPUT "UK"
ELSE
IF Value = "20"
THEN
OUTPUT "Egypt"
ELSE
OUTPUT "Unknown"
ENDIF
ENDIF
4(b)[3]
One mark per bullet point. Max 3
Find length of input.Use a suitable loop (repeat/while).Using the correct conditionPrompt for a 13-digit telephone number and input number inside loop.
Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.

