OCR J277 2.3.1: Defensive design
The free BugBot lessons that teach this point, a robot to try it on, and the past-paper questions that test it.
Lessons that teach it
- F1.5 Comments and readable code Programming basics
Comments, names, blank lines: code a person can read and change. - F6.1 Defensive design and validation Robust programs
Anticipating misuse; presence, type, range, length, format and look-up checks. - F6.2 Authentication Robust programs
Usernames and passwords, limiting attempts, and stronger ways to prove who someone is.
Try it on a robot
The task from F1.5 Comments and readable code, running here. Change the program and press Run.
Past paper questions on this
Real exam questions that test this, each worked through with a program you can run.
- AQA 8525 June 2025 Paper 1, Question 4: Validate a name by length until it is accepted, test data, and a username flowchart 13 marks
- AQA 8525 June 2024 Paper 1, Question 11: Authenticate against two username and password pairs until valid 7 marks
- AQA 8525 June 2023 Paper 1, Question 4: Trace a Python function with three sets of inputs, then make it robust 4 marks
- AQA 8525 June 2023 Paper 1, Question 6: Fill the gaps in a login routine 4 marks
- AQA 8525 June 2023 Paper 1, Question 13: Validate a grid reference until it is correct 6 marks
- AQA 8525 June 2022 Paper 1, Question 13.1: Keep asking until a number is between 1 and 100 4 marks
- AQA 8525 Sample Paper 1, Question 18: Go-kart braking distance: validate the speed, divide by 5, wet ground 8 marks
- OCR J277 June 2025 Paper 2, Question 1: Normal, boundary and invalid test data, and a 1 to 100 range check 9 marks
- OCR J277 June 2025 Paper 2, Question 5(d): Validate a 4 character PIN that must not be 1234 or 4321 6 marks
- OCR J277 June 2024 Paper 2, Question 8: Maintainability, and a function that moves a character and keeps it in range 10 marks
- OCR J277 June 2024 Paper 2, Question 9(c): A range check that outputs VALID or NOT VALID, and its test data 7 marks
- OCR J277 June 2022 Paper 2, Question 5(b): Validate a booking with three checks, and plan the tests 8 marks
The specification is OCR's own document; this page says which of our lessons teach point 2.3.1 and is not endorsed by the board.