AQA GCSE Computer Science Paper 1 (1B), June 2025: Question 4

13 marks · Medium difficulty · Programming

Answer multiple-choice and short-answer questions on data validation and test data, write a Python validation routine for name length, and complete a flowchart using algorithm statements to generate a username.

Practise this question

Question

Question 4 contains six sub-questions: 04.1 is a multiple-choice question asking for the purpose of validation. 04.2 asks students to write a Python program to repeatedly get a first name until it has more than 1 and fewer than 15 characters, outputting appropriate acceptance messages, with an answer grid showing indentation guide lines. 04.3 is a multiple-choice question defining boundary test data. 04.4 and 04.5 refer to a test plan table (Figure 3), asking for the number of characters in a string used as boundary test data for 'Name not accepted', and naming the missing test data type. 04.6 gives a username generation specification alongside Figure 4 listing six labelled statements (L1 to L6) and instructs students to complete a flowchart.
Question text

04 A programmer is developing a system to register users for an app. The program

needs to validate the first name of the user.

04.1 Identify the purpose of validation.

Shade one lozenge.

[1 mark]

A Checks that the user is human

B Checks that the user is who they say they are

C Checks that the input is a name

D Checks that the input is reasonable

04.2 Write a Python program to check the user’s first name.

Your program should:

• get the user’s first name

• check that the first name has more than one character and fewer than 15

characters:

o if it has, output the message Name accepted

o if it has not, output the message Name not accepted

• repeat until the name entered has a specified length.

You should use indentation as appropriate, meaningful variable name(s) and Python

syntax in your answer.

The answer grid below contains vertical lines to help you indent your code.

[6 marks]

04.3 Which of the following statements best describes boundary test data?

*08*Shade one lozenge.

[1 mark]

A Data that is not of the allowed data type

B Data that is at the limits of the allowed range

C Data that is expected by the program

D Data that will cause a syntax error

04.4 The programmer has started planning the tests that will be used to check the program

is working correctly.

The program should:

• check that the first name has more than one character and fewer than 15

characters:

o if it has, then output the message Name accepted

o if it has not, then output the message Name not accepted

The start of the test plan is shown in Figure 3.

Figure 3

Test Type of

Test data Expected result

number test data

1 Thomas Normal Name accepted

2 Boundary Name not accepted

State the number of characters that a string used for test number 2 in Figure 3 could

contain.

[1 mark]

04.5 Normal and boundary are two types of test data.

State one type of test data that has not been used in Figure 3.

[1 mark]

04.6 A programmer is designing an algorithm to generate usernames for users.

The algorithm should:

• ask the user to input their first name and their last name

*10*•create a username:

o if their first name has more than three characters, their username will consist of

the first three characters of their first name followed by their last name

o if their first name has three or fewer characters, their username will consist of

their full first name followed by their last name

• output the username.

Figure 4 contains the statements required to implement a version of this algorithm.

Figure 4

firstName USERINPUT

LEN(firstName) > 3

username firstName + lastName

OUTPUT username

username SUBSTRING(0, 2, firstName) + lastName

lastName USERINPUT

Using the labels ( to ) shown in Figure 4, complete the flowchart to implement

the algorithm.

[3 marks]

Mark scheme

Show the mark scheme Mark scheme for Question 4: 04.1 awards 1 mark for option D (Checks that the input is reasonable). 04.2 awards 6 marks (1 for design loop structure, 5 for logic: finding length, condition checks, re-input, outputs). Multiple example implementations are shown in C#, Python, and VB.NET. 04.3 awards 1 mark for option B (Data that is at the limits of the allowed range). 04.4 awards 1 mark for 1 or 15. 04.5 awards 1 mark for Erroneous (or Invalid). 04.6 awards 3 marks for correctly placing labels into the flowchart: L1 and L6 in the first two input parallelograms, L2 in the decision diamond, L3 and L5 in the process rectangles, and L4 in the output parallelogram.

Total

Question Part Marking guidance

marks

04 1 Mark is for AO1 (recall) 1

D Checks that the input is reasonable;

R. If more than one lozenge shaded

Total

Question Part Marking guidance

marks

04 2 1 mark for AO3 (design), 5 marks for AO3 (program) 6

Program Design

Note that AO3 (design) marks are for selecting appropriate techniques to

use to solve the problem, so should be credited whether the syntax of

programming language statements is correct or not and regardless of

whether the solution works.

Mark A for the use of an iteration structure that exists within their language,

which attempts to repeat until a first name with a valid length is entered;

Program Logic

Mark B for finding the length of at least one string correctly;

Mark C for one Boolean condition that attempts to check the first name or

length of first name entered against one of the two required conditions (even

if the length usage is incorrectly coded or missing);

A. if the only error is quotes included around numeric values;

Mark D if all required checks on the length of the first name have been

carried out and combined correctly;

R. if any quotes included around numeric values

Mark E for code that allows the re-inputting of a first name within an iteration

structure;

Mark F for a structure that would output either Name accepted or Name

not accepted correctly in all circumstances; A. if conditions are

not fully correct; A. equivalent messages;

I. Case

I. Messages or no messages with input statements

I. Gaps/spaces throughout the code, except where to do so would explicitly

alter the logic of the code in a way that makes it incorrect.

Maximum 5 marks if any errors in code.

Note to examiners

In C#/VB.NET examples, explicit variable declarations are not shown. Refer

to the specific language type issues section of the appropriate Marking

Guidance document. Any correct variable declarations in student answers

should be accepted.MARK SCHEME – – –

C# Example 1 (fully correct)

The design mark is achieved (Mark A)

name = Console.ReadLine();

while (name.Length < 2 || name.Length > 14) { BCD, Part E

Console.WriteLine("Name not accepted"); Part F

name = Console.ReadLine(); Part E

}

Console.WriteLine("Name accepted"); Part F

A. Write in place of WriteLine

I. missing Console.

Python Example 1 (fully correct)

The design mark is achieved (Mark A)

name = input()

while len(name) < 2 or len(name) > 14: BCD, Part E

print("Name not accepted") Part F

name = input() Part E

print("Name accepted") Part F

Python Example 2 (fully correct)

The design mark is achieved (Mark A)

check = False Part E

while check == False: Part E

name = input() Part E

if len(name) > 1 and len(name) < 15: BCD

print("Name accepted") Part F

check = True

else:

print("Name not accepted") Part F

Python Example 3 (fully correct)

The design mark is achieved.

Check that all pathways are covered when using nested if statements and

all required messages are included.

while True: Part E

name = input()

if len(name) > 1: BC

if len(name) < 15: D

print("Name accepted") Part F

break

else:

print("Name not accepted") Part F

else:

print("Name not accepted") Part F

VB.NET Example 3 (fully correct)

The design mark is achieved.

Check that all pathways are covered when using nested if statements and

all required messages are included.

While True Part E

name = Console.ReadLine()

If Len(name) > 1 Then BC

If Len(name) < 15 Then D

Console.WriteLine("Name accepted") Part F

Exit While

Else

Console.WriteLine("Name not accepted") Part F

End If

Else

Console.WriteLine("Name not accepted") Part F

End If

End While

A. Write in place of WriteLine;

I. missing Console.

Total

Question Part Marking guidance

marks

04 3 Mark is for AO1 (recall) 1

B Data that is at the limits of the allowed range;

R. If more than one lozenge shaded

Total

Question Part Marking guidance

marks

04 4 Mark is for AO3 (test) 1

1 // 15;

A. if both correct answers are given;

Total

Question Part Marking guidance

marks

04 5 Mark is for AO1 (recall) 1

Erroneous;

A. Invalid;

A. Description of a type of erroneous test data e.g. data of the wrong type;

I. Minor spelling mistakes

R. Typical

R. Extreme

R. Boundary

R. Normal

Total

Question Part Marking guidance

marks

04 6 3 marks for AO3 (design) 3

MP1: for L1, L6 (I. Order of L1 and L6) and L4;

MP2: for L2;

MP3: for L3 and L5;

I. any pseudocode if labels are given

A. The exact given pseudo-code statements if labels are omitted;

How to answer it

Input Validation, Testing & Algorithms Study Guide

📋 What this question tests

Core skills and knowledge assessed in Question 04:

  • Validation: Understanding the true definition/purpose of input validation (reasonable data check vs authentication/verification).
  • Programming logic (Python): Implementing defensive design using a validation loop ( while ), length check ( len() ), Boolean comparison operators ( > , < ), and selection.
  • Testing types: Distinguishing between normal, boundary (extreme limits), and erroneous/invalid test data.
  • Flowcharts & Algorithms: Matching flowchart symbols (Input/Output parallelogram, Decision diamond, Process rectangle) to pseudocode logic.

Question 04.1: Purpose of Validation

Multiple Choice (1 mark)

✅ Correct Answer

D – Checks that the input is reasonable

💡 Key Knowledge

  • Validation: An automated check carried out by a computer to ensure data is sensible and reasonable before processing.
  • It does not check whether data is actually correct, true, or that the user is real.

❌ Common Errors

  • Confusing validation with authentication (checking identity, option B) or CAPTCHA (checking if human, option A).
  • Option C is too narrow: validation checks rules (format, length, range), not identity of names.
Mark Scheme Breakdown: 1 mark for shading D. 0 marks if more than one lozenge is shaded.

Question 04.2: Writing a Validation Program in Python

Coding Problem – While Loop & String Length Check (6 marks)

✅ Full Mark Python Solution (Example 1: While with Inverted Condition)

name = input() while len(name) <= 1 or len(name) >= 15: print("Name not accepted") name = input() print("Name accepted")

✅ Alternative Full Mark Python Solution (Example 2: Flag / While True)

valid = False while not valid: name = input() if len(name) > 1 and len(name) < 15: print("Name accepted") valid = True else: print("Name not accepted")

🧠 Mark Breakdown (How to get all 6 marks)

  • Mark A (AO3 Design): Using an iteration structure ( while ) that attempts to repeat until a valid name is entered.
  • Mark B: Correctly finding string length using len(name) .
  • Mark C: Testing one valid length condition (e.g. len(name) > 1 or len(name) < 15 ).
  • Mark D: Combining both conditions correctly using and / or without quote marks around numbers.
  • Mark E: Allowing re-input of name inside the loop.
  • Mark F: Correctly outputting "Name accepted" and "Name not accepted" in the right logic paths.

❌ Common Traps

  • Quoting numbers: Writing len(name) > "1" loses Mark D. Numbers must be integers.
  • Off-by-one errors: The question states "more than 1" (> 1, so minimum valid is 2) and "fewer than 15" (< 15, so maximum valid is 14).
  • Forgetting re-input: An infinite loop occurs if you don't call input() again inside the loop body (loses Mark E).
Examiner Insight: Maximum 5 marks if there are any syntax errors in code. Keep variable names consistent and remember Python indentation!

Question 04.3: Understanding Boundary Test Data

Multiple Choice (1 mark)

✅ Correct Answer

B – Data that is at the limits of the allowed range

💡 Key Knowledge

  • Boundary data: Values sitting right on the edge of what is accepted and rejected (e.g. minimum and maximum allowed limits).
  • For a rule 1 < length < 15 , the boundary values are 1, 2, 14, and 15.

❌ Other Options Explained

  • A: Data of the wrong type = Erroneous test data.
  • C: Expected data = Normal test data.
  • D: Syntax errors occur during code compilation/interpretation, not from data input.
Mark Scheme: 1 mark for shading B.

Questions 04.4 & 04.5: Test Plans & Test Data Types

Data Identification (2 marks total)

📐 04.4: Boundary Character Count Calculation

Rule: more than 1 and fewer than 15 characters.

  • Valid range: 2 to 14 characters → outputs Name accepted .
  • Test 2 expects: Name not accepted.
  • Therefore, boundary values that are not accepted are the immediate outer limits: 1 or 15.

Accepted Answer: 1 OR 15 (accept both).

✅ 04.5: Third Type of Test Data

The table has Normal and Boundary.

Correct Answer:

  • Erroneous (or Invalid)
  • Also accepted: A description of erroneous data, e.g. "data of the wrong type".

❌ What will NOT get marks in 04.5

The mark scheme explicitly rejects: Typical, Extreme, Boundary, or Normal.

Mark Scheme: 1 mark for 04.4 (1 or 15); 1 mark for 04.5 (Erroneous / Invalid).

Question 04.6: Flowchart Algorithm Completion

Matching Pseudocode Labels (3 marks)

🧠 Step-by-Step Flowchart Trace

  1. Start → First input box (parallelogram): needs user inputs.
    First box = L1 ( firstName ← USERINPUT )
    Second box = L6 ( lastName ← USERINPUT )
    (Note: L1 and L6 can be in either order).
  2. Decision Diamond: Checks condition → L2 ( LEN(firstName) > 3 ).
  3. "No" branch (False branch): When length is ≤ 3, rule says full first name + last name → L3 ( username ← firstName + lastName ).
  4. "Yes" branch (True branch): When length > 3, rule says first 3 chars + last name → L5 ( username ← SUBSTRING(0, 2, firstName) + lastName ).
  5. Final Output parallelogram: Prints generated username → L4 ( OUTPUT username ) before Stop.

✅ Final Placements in Flowchart

  • 📥 Upper Parallelogram 1: L1 (or L6)
  • 📥 Upper Parallelogram 2: L6 (or L1)
  • 🔶 Decision Diamond: L2
  • ⚙️ Process Box (branch 'N'): L3
  • ⚙️ Process Box (branch 'Y'): L5
  • 📤 Lower Parallelogram: L4
Mark Scheme MP breakdown:
• MP1: L1 and L6 in the first two input boxes (either order) AND L4 in the output box.
• MP2: L2 in the decision diamond.
• MP3: L3 and L5 correctly placed on the 'N' and 'Y' branches respectively.

Topics

3.1 Fundamentals of algorithms · 3.2 Programming · 3.1.1 Representing algorithms · 3.2.2 Programming concepts · 3.2.7 Input/output · 3.2.8 String handling operations in a programming language · 3.2.11 Robust and secure programming

Question and mark scheme from the AQA GCSE Computer Science examination, Paper 1 (1B), June 2025. QuestionVault is an independent revision resource; questions remain the copyright of the awarding body.