Computer Science · May / June 2026 · Paper 21 · Question 5
0478
As printed in the paper
The question as text
A computer system automatically creates usernames for new users. A new user enters their first name and their last name. The system: • takes the first letter of the first name • takes the first two letters of the last name • converts all the letters to upper case • generates a random whole number between 1 and 1000 inclusive. For the following example: The first name is ® The last name is ° The generated number is ´ The username will be °{´
Read automatically from the paper; the printed page above is exact.
Show the answer and mark scheme
5(a)[2]
One mark for correct use of RANDOM() * 999 + 1
One mark for assignment to GeneratedNumber in attempt to randomise number
GeneratedNumber ← RANDOM() * 999 + 1
5(b)[3]
One mark for correct use of UCASE
One mark for correct use of SUBSTRING
One mark for assignment to Temp of attempt to extract from LastName and/or convert to upper case Temp ← UCASE(SUBSTRING(LastName, 1, 2))
Temp ← SUBSTRING(LastName, 1, 2)
OR
Temp ← UCASE(Temp)
5(c)[3]
One mark for each mark point
Correct opening of fileCorrect writing to fileCorrect closing of fileOPENFILE "Username.txt" FOR WRITE
WRITEFILE "Username.txt", NewUsername
CLOSEFILE "Username.txt"
5(d)[4]
One mark for each correct identification and one for each correct description
Double entry (1) enter data twice and only accept identical value/automatic check by computer (1)Visual check (1) looks at the data that has been entered and confirm it matches (1)
Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.

