Why input data is validated
An automatic check by the program that input data is reasonable and in the right form. Bad data is rejected with an error message and the user is asked again, so it is never used.
Understanding Why input data is validated in IGCSE Computer Science Paper 2
What it does: The loop repeats the input until the mark is within the valid range, so only reasonable data gets through. The program calculates with the impossible value 800 and produces a wrong average, which validation would have prevented. Validation checks that data is reasonable and in the right form. It cannot know what the user really meant, which is why verification is a separate job. 450 is outside the allowed range, so it is unreasonable. Validation rejects it, shows an error message and the user is asked again. Dividing by zero can crash a program. Validating the input stops this by rejecting the bad value before it is used.
Common mistakes: The age must be read in with INPUT so it can be validated. OUTPUT Age only displays a value and never gets the user's data. It should be INPUT Age. Validation rejects data that is unreasonable or in the wrong form so it is never used. It does not accept bad data. The comment should say rejects.
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 47–57) and word search (Modules 47–70).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
validationFill in the Blanks
Spot the Error
Student with a class code? Join your class →