Input Validation

Computer ScienceOCRGCSEUnit: 3.2 Programming
Free taster
5 of 6 sections open
The basics

The Bouncer at the Door

The Bouncer at the Door

Validation is like a bouncer at a club - checking everyone meets the entry requirements before letting them in. You can't have negative age, a 47-character postcode, or £999,999 in a £50 limit account. Validation catches these impossible values *before* they break your program. It doesn't guarantee data is correct (someone could enter age 25 when they're 52), but it ensures data is sensible and won't crash the system.
What is validation?: Checking input data is sensible and follows rules before processing
Key terms

Computer Science glossary

What is validation?
Checking input data is sensible and follows rules before processing
What is a type check?
Checking data is the correct data type (e.g., integer not text)
Exam tip

Earn the mark scheme marks

Exam Tips

  • Validation ≠ Verification: Validation checks data is sensible; verification checks it's what user intended (e.g., enter twice)
  • Doesn't prove accuracy: Data can be valid but wrong (fake name passes validation)
  • Combine checks: Often need multiple validation types for one field

Now try it yourself

Quiz · Question 1 of 15

A program asks the user to enter a score between 1 and 10. Which validation check should be used to ensure the number is within this range?

Tap an answer to check it

Revise every Computer Science topic, free during alpha

Input Validation is one of 60 topics on PrepWise — all aligned to your exam board.

Start revising free →