AQA GCSE Computer Science June 2025 Paper 1, Question 4: validating a name

AQA 8525 June 2025 Paper 1, Question 4: write a Python program that repeats until a first name has more than 1 and fewer than 15 characters, choose boundary test data, and order the statements of a username flowchart. Worked through, with both programs to run.

Past paper questionAQA 8525/1BJune 2025 Paper 113 marksWrite a program

Question 4 of the AQA GCSE Computer Science Paper 1 sat on 12 May 2025 (8525/1B, the Python paper) is 13 marks on one theme: registering a user. The big part is a validation program (6 marks). Round it are multiple choice and test data parts (4 marks) and a flowchart to complete (3 marks).

We do not copy the exam paper here. Open it beside this page: AQA June 2025 Paper 1B question paper (PDF). When you have finished, check the mark scheme too.

Part 4.1: the purpose of validation

It checks that the input is reasonable. Not that it is correct, and not that the user is who they say they are: that is authentication.

Part 4.2: the program (6 marks)

Get the user's first name. If it has more than one character and fewer than 15, output Name accepted. If not, output Name not accepted. Repeat until the name has a valid length.

name = input("First name: ")
while len(name) < 2 or len(name) > 14:
    print("Name not accepted")
    name = input("First name: ")
print("Name accepted")

"More than one and fewer than 15" means 2 to 14 characters. Written for good names it is len(name) > 1 and len(name) < 15. Written for bad names, as in the loop above, the comparisons flip and the and becomes or.

The six marks: a loop that repeats until the name is valid (design); finding a length with len; one correct condition; both conditions correct and joined correctly; asking again inside the loop; the two messages right in every case. Any error caps it at 5.

Parts 4.3 to 4.5: test data

  • Boundary test data is data at the limits of the allowed range.
  • Test 2 in the plan is a boundary test with the expected result Name not accepted. So the string could contain 1 character, or 15. Those are the first lengths that fail.
  • A type of test data not used in the plan: erroneous (invalid).

Part 4.6: the username flowchart

The six statements build a username from the first three characters of the first name (or all of it, if it is three or fewer) followed by the last name. In order:

  1. firstName ← USERINPUT and lastName ← USERINPUT (either way round);
  2. the decision LEN(firstName) > 3;
  3. on the Yes branch, username ← SUBSTRING(0, 2, firstName) + lastName. On the No branch, username ← firstName + lastName;
  4. both branches join at OUTPUT username.

SUBSTRING(0, 2, ...) is three characters, because AQA's SUBSTRING includes both ends: positions 0, 1 and 2.

Where the marks are lost

  • An if and no loop. The mark scheme's 4 mark example asks again once and then accepts anything. "Repeat until" needs a while.
  • and in the bad-name condition. No name is both shorter than 2 and longer than 14, so the loop would never run.
  • <= 15, or >= 1. Fifteen characters is too many, and one is too few.
  • name.len() or length(name). In Python it is len(name).
  • 2 or 14 for part 4.4. Those are boundary values that are accepted. The expected result in the plan is not accepted.
  • The branches swapped in the flowchart. More than 3 characters is the branch that needs cutting down with SUBSTRING.

Run it

The validation program, followed by the username algorithm from the flowchart. The robot's light is red until the name is accepted.

Try A (too short), then a 15 letter name, then Thomas. With the last name Shah the username is ThoShah. Try Al and Shah for AlShah.
The program
from bugbot import *
connect()

led("red")
name = input("First name: ")
while len(name) < 2 or len(name) > 14:
    print("Name not accepted")
    name = input("First name: ")
print("Name accepted")
led("green")

lastName = input("Last name: ")
if len(name) > 3:
    username = name[0:3] + lastName
else:
    username = name + lastName
print(username)
Put this demo on your own site

Paste it into a school website, Moodle, Google Sites or a blog. More options on the embed page.

Questions

What is the answer to AQA GCSE Computer Science 2025 Paper 1 Question 4.2?

Input the name. While its length is less than 2 or more than 14, print Name not accepted and input it again. After the loop, print Name accepted.

What is the difference between validation and authentication?

Validation checks that data is reasonable and follows the rules, such as having the right length. Authentication checks that a user is who they claim to be, for example with a password.

What boundary data should I test for a range of 2 to 14?

2 and 14, which should be accepted, and 1 and 15, which should be rejected.

More from this paper

Every AQA 8525 question we have worked

Learn it step by step

  1. F6.1 Defensive design and validation Robust programs
  2. F6.3 Testing and test data Robust programs
  3. F5.2 Flowcharts Algorithms
Open the lessons

This is our own explanation of a published exam question. It is not written or endorsed by AQA, and the question paper and mark scheme remain AQA's copyright. Read them on AQA's site with the links on this page.