All subjects · Information Technology · WIT13 2 hour written exam on data, enabling technologies and systems development

Data validation and validation rules

Edexcel IAL Information Technology · WIT13 2 hour written exam on data, enabling technologies and systems development

Validation is the automatic check a system makes that input data is sensible and allowed before it is accepted. You must be able to interpret and design presence, range, lookup, list, length, format and check digit rules (spec 12.1.4 and 12.1.5).

Practise this in the app: instant marking and a fix for every mistake. Free, no email needed to start.

Practise this lesson

Validation and why it is needed

Validation is an automatic check, carried out by software as data is entered or imported, that the data is reasonable, sensible and within allowed limits.

Why it is needed: it stops obviously wrong data entering the system, so reports, calculations and decisions are more reliable; it reduces the cost of correcting errors later; it gives users immediate feedback.

Limit: validation cannot prove data is correct. A date of birth of 03/04/2008 passes a range check even if the real date is 04/03/2008. Verification (double entry, visual checking against the source) checks that data has been copied accurately.

The seven rules

RuleWhat it checksExample
PresenceA required field is not left blankSurname must be entered
RangeA value lies between a lower and an upper limitExam mark >= 0 and <= 80
LookupA value exists in another table or fileTutorID must exist in the TUTOR table
ListA value is one of a short fixed setSize is S, M, L or XL
LengthThe number of characters is allowedPassword at least 8 characters; phone number exactly 11 digits
FormatThe data matches a patternStudent ID is LLNNNN (2 letters, 4 digits); date DD/MM/YYYY
Check digitAn extra digit calculated from the others matchesLast digit of an ISBN or barcode

Check digits

A check digit is calculated from the other digits by an agreed formula and stored as the last digit. When the code is re-entered or scanned, the system recalculates it; a mismatch means an error.

ISBN-13 / barcode method (modulo 10): multiply the 12 digits alternately by 1 and 3, add the products, find the remainder when divided by 10; if it is 0 the check digit is 0, otherwise it is 10 minus the remainder.

A modulus 11 method: multiply the digits by weights that start at 2 for the right-hand digit and go up by 1 for each digit to the left, add, find the remainder when divided by 11, and subtract it from 11 (11 becomes 0, 10 is written X).

Check digits catch the commonest keying errors: single-digit errors and transpositions (two digits swapped). The ISBN-13 method detects every single-digit error and most transpositions of neighbouring digits (it misses a swap of two digits that differ by 5); the modulus 11 method detects both kinds of error.

Designing and testing rules

To design a rule, state the field, the rule type, the exact condition and the error message, for example: 'Age: range check, >= 16 and <= 25; message: Age must be between 16 and 25'.

Test every rule with three kinds of data:

Choose the rule that matches the field: a fixed small set suits a list; a set that changes or is long suits a lookup table.

Worked example

Calculate the ISBN-13 check digit for the first 12 digits 978186197876.

  1. Weights 1,3,1,3...: products 9, 21, 8, 3, 8, 18, 1, 27, 7, 24, 7, 18
  2. Sum = 151
  3. 151 mod 10 = 1
  4. Check digit = 9

Answer: The check digit is 9

Key idea: Validation = automatic check that data is sensible (not that it is correct). Seven rules: presence, range, lookup, list, length, format, check digit. Test with normal, boundary and erroneous data.

Check yourself

  1. Calculate the ISBN-13 check digit for the first 12 digits 978014103614.
    Show answer

    4. Weighted sum = 86; remainder 6; check digit = 4.

  2. Using weights 6, 5, 4, 3, 2, find the modulus 11 check digit for the code 40372. (Check = 11 minus the remainder of the weighted sum divided by 11; 11 becomes 0.)
    Show answer

    5. Weighted sum = 61; 61 mod 11 = 6; check = 11 - 6 = 5.

  3. A field must contain one of the values 'Bronze', 'Silver' or 'Gold'. Which validation rule is most suitable?
    • Range
    • Check digit
    • Length
    • List
    Show answer

    List. A short fixed set of allowed values is a list check.

  4. Why is a lookup check better than a list check for a CourseCode field when the college adds new courses every year?
    • The allowed codes are read from a table, which can be updated without changing the rule
    • Lookup checks are faster to type
    • List checks cannot hold text
    • Lookup checks also prove the code is correct for that student
    Show answer

    The allowed codes are read from a table, which can be updated without changing the rule. Lookup values come from another table, so the set can change.

  5. A range check accepts ages from 16 to 25 inclusive. Which value is boundary data that should be rejected?
    • 25
    • 20
    • 26
    • abc
    Show answer

    26. 26 is just outside the upper limit; 25 is boundary accepted, 20 normal, abc erroneous.

  6. A user types 12/11/2008 instead of 11/12/2008 and it is accepted. Why did validation not catch it?
    • Validation only checks data is sensible, not that it is correct
    • The format check was missing
    • Dates cannot be validated
    • A check digit should have been used
    Show answer

    Validation only checks data is sensible, not that it is correct. Both dates are valid; only verification against the source would catch it.

  7. A Student ID must be two capital letters followed by four digits, such as AB1234. Which rule enforces this?
    • Presence check
    • Range check
    • Format check
    • Lookup check
    Show answer

    Format check. A pattern of character types is a format (picture) check.

  8. Explain how a check digit detects a keying error in a product code.
    Show answer

    The system recalculates the check digit from the other digits entered and compares it with the check digit typed; if they do not match, an error is reported.. Recalculate, compare, flag a mismatch.

Practise with instant feedback

Sources

Last updated 8 November 2026. Spotted a mistake? Tell us.