SLIDE 1
CSZone.co.uk
Click to advance · Arrow keys also work
AQA 8525 · Section 3.2 · 3.2.11b

Robust & Secure
Programming

Input Validation · Error Handling · Authentication · Testing

CSZoneAQA GCSE Computer Science 8525
Input Validation

Checking User Input

Input validation checks that user input is sensible, complete, and within acceptable ranges before processing. It prevents errors and protects the program from bad data.
REPEAT
  age ← INT(USERINPUT)
UNTIL age >= 0 AND age <= 120
OUTPUT 'Valid age: ' + STR(age)
Types of validation:Range check · Type check · Presence check · Length check · Format check
Authentication

Verifying User Identity

PASSWORD CHECK
stored ← 'secret123'
attempts ← 0
REPEAT
  pw ← USERINPUT
  attempts ← attempts + 1
UNTIL pw = stored OR attempts = 3
IF pw = stored THEN
  OUTPUT 'Access granted'
ELSE
  OUTPUT 'Locked out'
ENDIF
AUTHENTICATION METHODS
Username + password
Two-factor authentication (2FA)
Biometrics (fingerprint, face ID)
Security questions
Testing

Making Programs Reliable

Test TypePurposeExample (age 0–120)
NormalTypical valid values25, 60
BoundaryEdges of allowed range0, 1, 119, 120
ErroneousValues that should be rejected-1, 121, 'abc'
Exam Practice

Have a go at this question

AQA-style question
Write pseudocode to ask a user for a score between 0 and 100 and repeat until a valid score is entered. Then output 'Valid score' when accepted.
3 marks
REPEAT
  score ← INT(USERINPUT)
UNTIL score >= 0 AND score <= 100
OUTPUT 'Valid score'
Key Takeaways

What to Remember

Input validation — check data is sensible before using it (range, type, presence)
Authentication — verify who the user is before giving access
Test with normal, boundary, and erroneous data
REPEAT UNTIL is the standard pattern for input validation loops