Edexcel 1CP2 6.4.3: Validation
The free BugBot lesson that teach this point, a robot to try it on, and the past-paper questions that test it.
What it covers
Every program so far has trusted its user. Type twenty where a number is wanted and it crashes; type 500 and the robot drives off the table. Real users mistype, misunderstand, and sometimes try to break things on purpose. Defensive design means writing programs that expect this and cope with it. The first line of defence is validation: checking input before using it.
- What goes wrong without it
- The validation checks
- Checking in order
- Asking until it is valid
- Length, format and look-up
- Anticipating misuse
Or do it in the simulator, with tasks that mark themselves
Lessons that teach it
- F6.1 Defensive design and validation Robust programs
Anticipating misuse; presence, type, range, length, format and look-up checks.
Try it on a robot
The task from F6.1 Defensive design and validation, 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 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 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 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
- OCR J277 Sample Paper 2, Question 8(b) to (d): A range check with OR and its tests, index a 2D array, refine repeated lines into a loop 10 marks
- Edexcel 1CP2 June 2025 Paper 2, Question 2: A rocket countdown with validation and time.sleep 10 marks
- Edexcel 1CP2 June 2025 Paper 2, Question 6: Validate keys with a check digit and signal readings, with a subprogram 15 marks
The specification is Edexcel's own document; this page says which of our lessons teach point 6.4.3 and is not endorsed by the board.