Validation checks that data is sensible and follows a rule. Verification checks that data matches what was meant to be entered. Validation asks “is this allowed?” and verification asks “is this the same as the source?”
This pair appears in questions about data entry, forms and testing. The wider topic is in validation, verification and testing, and the two ideas are separated in distinguish verification from validation.
A test you can use in the exam
Ask one question about the check: does it need the original?
- If a program can do the check on its own using a rule (a range, a length, a format), it is validation.
- If the check compares the entered data with the original source, or with a second entry of the same data, it is verification.
The word “correct” is the trap. Validation never proves data is correct. It only proves the data is acceptable.
Worked example
A school library form asks for a student’s year group, which must be a whole number from 7 to 13. The student’s real year group is 10.
| What the user types | Validation (range 7 to 13) | Verification (type it twice) |
|---|---|---|
| 10 then 10 | Accepted | Entries match, accepted |
| 1 then 1 | Rejected, out of range | Not reached |
| 12 then 12 | Accepted | Entries match, accepted |
| 10 then 1 | First value accepted | Entries differ, rejected |
Step 1. The value 1 fails validation because the rule says 7 to 13. The program needed no original to decide this.
Step 2. The value 12 passes validation, although the real year group is 10. The rule cannot know the truth.
Step 3. Typing twice does not catch 12 and 12 either, because a person can repeat the same slip. Verification reduces typing errors but is not perfect. Checking the form against the student’s record would catch it.
So: validation caught an impossible value, verification caught a mismatch between two entries, and neither proves the value is true.
The mistake to watch for
Mistaken answer: “Validation checks the data is correct, and verification checks it is entered properly.”
This sounds close but fails on both counts. Validation does not check correctness, as the year 12 example shows. Verification is about agreement with the intended data, not about “entering properly”.
Correction: “Validation checks the data is reasonable and meets a rule, for example a range check that rejects 1. Verification checks the entered data matches the source, for example by entering it twice and comparing.”
How to build the habit
- For each check you meet, write the name (range, length, double entry) and one line: “needs the original: yes or no”.
- Add a scenario of your own, not the textbook one.
- Say the difference aloud in one sentence before you look at the answer.
You can rehearse the step-by-step reasoning on small original examples with the pseudocode trace trainer and the Python reasoning sandbox.
Self-check
1. A sign-up form rejects a username with fewer than 6 characters. Validation or verification, and which check?
Show answer
Validation. It is a length check, because a rule is applied without comparing the input to any original.2. A clerk reads each typed record back against the paper form. Validation or verification?
Show answer
Verification. The entered data is compared with the source document to see whether it matches.3. A user enters their age as 140. Which check stops it, and why might 41 typed by mistake as 14 still get through?
Show answer
A range check stops 140. The value 14 is inside a sensible range, so validation accepts it, even though it is not what the user meant. Only verification against the source would catch it.Where to go next
Practise designing checks in choose a validation rule from a requirement and then design normal, boundary and invalid test data.
For students who want a teacher to correct the wording of their answers as they write them, online one-to-one Computer Science tuition starts with a paid trial lesson from RM80.