Suggesting test data for length, presence and format checks
Test data for a check includes values that pass and fail it: for an 8-character minimum, 8 characters is accepted, 7 is rejected, and an empty string fails a presence check.
Understanding Suggesting test data for length, presence and format checks in IGCSE Computer Science Paper 2
What it does: Seven characters is one less than the minimum of 8, so it is the test value that fails the length check and the expected outcome is rejected. AB123 matches the pattern so it passes, while 1234A has the wrong pattern so it fails. Good test data shows both outcomes. A presence check only makes sure something has been entered. An empty string fails it. One letter passes it. An empty string has 0 characters. It is not present and it is shorter than 8, so both checks reject it.
Common mistakes: The minimum is 8 characters, so a password of exactly 8 must be accepted. > 8 would reject it. The condition should be >= 8. 'abcdefg' has only 7 characters. It is the test value one character too short, so the comment should say (7 chars).
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 71–82) and word search (Modules 71–92).
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
LENGTH(Password) >= 8Fill in the Blanks
Spot the Error
Student with a class code? Join your class →