← IGCSE Computer Science Paper 2

What validation cannot do

Validation only checks data is reasonable and in the right form, so a valid value can still be wrong, e.g. age 15 typed instead of 51. Verification is also needed.

Understanding What validation cannot do in IGCSE Computer Science Paper 2

What it does: This range check accepts any age from 0 to 120. It never checks whether the age is the user's true age. A double entry check compares two entries. If the user typed 15 then 51, the mismatch is spotted, which validation alone would miss. 15 is inside the range 0 to 120, so it passes validation. Validation cannot know the real age is 51. Validation only checks that data is sensible and follows the rules. It cannot prove the data matches the truth. A valid value follows the rules, but it may not be what the user meant to enter.

Common mistakes: An IF statement must be closed with ENDIF, not ENDWHILE. ENDWHILE belongs to a WHILE loop. Note that the range check accepts both 15 and 51, so a typing slip still passes. Validation only shows that a value is reasonable, not that it is correct. 15 typed instead of 51 would pass this check, so the message should say the age is reasonable.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

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 60–70) 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.

Learning
Duo
A user should type 51 for their age but types 15. A range check allows 0 to 120. What happens?
15 is accepted, but it is wrong15 is rejected as invalid
Matches
A range check on age passed, so the age must be correct.
↓
Passing validation does not prove the data is correct. 15 and 51 both pass a range check of 0 to 120, so a wrong age can still be accepted.
Applying
Meanings
Term
valid but wrong
Meaning
Validation only checks data is reasonable and in the right form, so a valid value can still be wrong, e.g. age 15 typed instead of 51. Verification is also needed.
Practice
// Age 15 is valid even if 51 was meant
Testing
Gaps
Valid ← Age >= 0 Age <= 120
Check Answer
Spots
3 THEN OUTPUT "Accepted"
4ENDWHILE

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Narwhal' badge — Unicorn Coder, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. A user should type 51 for their age but types 15. A range check allows 0 to 120. What happens?
A. 15 is rejected as invalid
B. 15 is accepted, but it is wrong ✓
15 is inside the range 0 to 120, so it passes validation. Validation cannot know the real age is 51.
2. Which statement about validation is correct?
A. It checks data is reasonable and in the right form ✓
B. It proves the data is correct
Validation only checks that data is sensible and follows the rules. It cannot prove the data matches the truth.
3. A student's real date of birth is 04/09/2010. They type 14/09/2010. A format check expects DD/MM/YYYY. What is the result?
A. It passes the format check but is wrong ✓
B. The format check finds the wrong day
The date is in the correct format, so it passes. A format check cannot tell whether the date is the person's real date of birth.
4. Which is true of a valid value?
A. It can still be wrong ✓
B. It is always correct
A valid value follows the rules, but it may not be what the user meant to enter.
5. Which check is also needed to help catch a typing mistake such as 15 instead of 51?
A. A second range check
B. Verification, such as a double entry check ✓
Verification checks that the data entered matches what was intended. A double entry check would show 15 does not match 51.

Match the Pairs

Age: 15 typed instead of 51 (range check 0-120 passes) → The value is valid because it is in the allowed range, but it is still wrong. Validation cannot tell it is the wrong number.
DOB: 12/04/2008 typed instead of 12/04/2006 (format check passes) → The date is in the correct format, so validation accepts it, but it is not the person's real date of birth.
Validation checks that data is reasonable and in the right form, not that it is correct → IF Age >= 0 AND Age <= 120 THEN OUTPUT "Accepted" ENDIF
Verification is also needed to catch valid but wrong data, for example by entering the data twice and comparing → IF Age1 <> Age2 THEN OUTPUT "Please re-enter" ENDIF
A range check on age passed, so the age must be correct. → Passing validation does not prove the data is correct. 15 and 51 both pass a range check of 0 to 120, so a wrong age can still be accepted.
Validation is enough because it stops all typing mistakes. → Validation only rejects unreasonable data. Typing mistakes that give a reasonable value, such as 15 for 51, get through, so verification is also needed.

Key Term

valid but wrong
Validation only checks data is reasonable and in the right form, so a valid value can still be wrong, e.g. age 15 typed instead of 51. Verification is also needed.

Fill in the Blanks

1. Age ← 15 // meant to type 51 Valid ← Age >= 0 AND Age <= 120 OUTPUT Valid // TRUE but still wrong
Hint: Type the logical operator that requires both range limits to be satisfied
2. DOB ← "05/11/2008" // typed wrong date Valid ← LENGTH(DOB) = 10 // length check OUTPUT Valid // TRUE even if date is wrong
Hint: Type the function that returns the number of characters in a string
3. DECLARE Age : INTEGER Age ← 15 // type check passes OUTPUT Age // but 51 was meant
Hint: Type the data type keyword for whole numbers like an age
4. OUTPUT "You entered ", Age OUTPUT "Is this correct? Y/N" INPUT Confirm
Hint: Type the command that reads the user's reply in a visual check
5. INPUT Age INPUT AgeAgain Matches ← Age = AgeAgain // double entry
Hint: Type the relational operator that tests whether both entries are equal

Spot the Error

Question 1
A INPUT Age
B IF Age >= 0 AND Age <= 120
C THEN OUTPUT "Accepted"
D ENDWHILE
E OUTPUT "Check 15 or 51?"
Line D — An IF statement must be closed with ENDIF, not ENDWHILE. ENDWHILE belongs to a WHILE loop. Note that the range check accepts both 15 and 51, so a typing slip still passes.
Question 2
A INPUT Age
B IF Age >= 0 AND Age <= 120
C THEN
D OUTPUT "Age is correct"
E ENDIF
Line D — Validation only shows that a value is reasonable, not that it is correct. 15 typed instead of 51 would pass this check, so the message should say the age is reasonable.
Question 3
A # Format check on DOB
B INPUT DOB
C IF LENGTH(DOB) = 10
D THEN OUTPUT "Format OK"
E ENDIF
Line A — Cambridge pseudocode comments start with //, not #. The comment should be // Format check on DOB. The check only tests the format, so a wrong date can still pass.
Question 4
A INPUT Age1
B INPUT Age2
C IF Age1 <> Age2
D THEN OUTPUT "Entries match"
E ELSE OUTPUT "Re-enter"
F ENDIF
Line C — A double entry check accepts the data when both entries are equal. Using <> would say 'Entries match' when they differ. It should be IF Age1 = Age2. This is verification, which catches errors that validation misses.
Question 5
A OUTPUT "Enter your age"
B INPUT Age
C WHILE Age < 0 AND Age > 120 DO
D INPUT Age
E ENDWHILE
Line C — No number is both below 0 and above 120, so AND makes the condition always false. It must be OR so that invalid ages are rejected. Even so, a valid but wrong age such as 15 for 51 still gets through.

Student with a class code? Join your class →