SLIDE 1
CSZone.co.uk
Click to advance · Arrow keys also work
Cambridge IGCSE 0478 · Topic 7 · 7.3c

Validation &
Verification

Validation Checks · Verification Methods · Trace Tables · Testing Strategies

CSZoneCambridge IGCSE Computer Science 0478
Validation vs Verification

Two Different Checks

Validation: automatically checking that input data is reasonable, complete, and in the correct format — does not check if it is correct. Performed by the computer program.
Verification: checking that data has been entered correctly — is it the same as the original source? Performed by a human or double-entry. Data can be valid but still wrong.
Example: a patient's age of 200 is invalid (range check fails); an age of 25 when the real age is 52 is valid but wrong — only verification catches this
Types of Validation Checks

Six Checks to Know

Range check: is the value within an acceptable range? e.g. age must be 0–120
Type check: is the data the correct data type? e.g. age must be an integer, not text
Length check: is the data the correct number of characters? e.g. password must be 8–20 chars
Presence check: has the required field been filled in? e.g. name cannot be empty
Format check: does data match a required pattern? e.g. date must be DD/MM/YYYY
Check digit: final digit calculated from other digits — detects transcription errors (e.g. ISBN, barcode)
Testing & Trace Tables

Verifying Algorithm Correctness

Trace table: manually step through an algorithm recording variable values at each step — identifies logic errors. Use Normal, Boundary, and Erroneous test data.
Test data types: Normal (typical valid input), Boundary (at the limits, e.g. 0 and 120 for age), Erroneous (invalid, e.g. letters for an age field — should be rejected).
A program with valid data that still produces wrong output has a logic error; if it crashes with an error message, it may have a runtime error
Exam Practice

Have a go at this question

Cambridge IGCSE 0478 style
A form asks for a student's exam score (0–100). State three different validation checks that could be applied to this field and give an example of data that would fail each check.
6 marks
Range check: score must be between 0 and 100 [1] — data failing: 150 or -5 [1]. Type check: score must be an integer [1] — data failing: "abc" or 72.5 [1]. Presence check: the field cannot be left blank [1] — data failing: leaving the box empty [1].
Key Takeaways

What to Remember

Validation: computer checks data is reasonable/correct format. Verification: human checks data matches source
6 validation checks: range, type, length, presence, format, check digit
Test data: Normal (typical), Boundary (at limits), Erroneous (invalid — should be rejected)
Trace table: step through algorithm manually, record variable values — finds logic errors