Account registration interface and username validation
2025-familiarisation-se-q09 · Multipart · 6 marks
Source: NESA 2025 HSC Software Engineering Familiarisation Q9
Question
An online store allows users to register for an account using their name, phone number and date of birth. Users must also create a username and password.
Each username must satisfy these rules.
- There must be no more than 8 characters.
- Only uppercase and lowercase letters are accepted.
- The character
<is not allowed, to prevent attempts at injecting code through the username.
Part (a) 3 marks
Design a user interface for registering an account. Clearly label all features.
Part (b) 3 marks
Write a function in Python that will check whether a username satisfies the rules.
Reveal answer
Part (a)
A suitable interface includes labelled fields for name, phone number, date of birth, username and password, with a submit/register button and validation feedback.
Part (b)
def valid_username(username):
if len(username) > 8:
return False
for character in username:
if not character.isalpha():
return False
return True
Marking rubric
Part (a)
| Marks | Description |
|---|---|
| 3 | Designs a labelled interface with all required fields and appropriate controls. |
| 2 | Designs an interface with most required fields. |
| 1 | Shows some relevant interface elements. |
Part (b)
| Marks | Description |
|---|---|
| 3 | Provides a correct Python function that checks length and accepted characters. |
| 2 | Provides a mostly correct validation function. |
| 1 | Shows some understanding of validation. |
Explanation
The < character is excluded by allowing only alphabetic characters. A full solution may
also provide feedback explaining why an invalid username was rejected.
Metadata
- Submitter
- Seed data
- Created
- 2026-05-02
- Status
- published
- Syllabus
- y12-project-tools-for-ideas-solutions y12-secure-defensive-input-handling
- Tags
- user interface input validation Python secure input