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).
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
| Rule | What it checks | Example |
|---|---|---|
| Presence | A required field is not left blank | Surname must be entered |
| Range | A value lies between a lower and an upper limit | Exam mark >= 0 and <= 80 |
| Lookup | A value exists in another table or file | TutorID must exist in the TUTOR table |
| List | A value is one of a short fixed set | Size is S, M, L or XL |
| Length | The number of characters is allowed | Password at least 8 characters; phone number exactly 11 digits |
| Format | The data matches a pattern | Student ID is LLNNNN (2 letters, 4 digits); date DD/MM/YYYY |
| Check digit | An extra digit calculated from the others matches | Last 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:
- Normal: typical valid data (20) that should be accepted.
- Boundary (extreme): values at the edges (16 and 25 accepted; 15 and 26 rejected).
- Erroneous (invalid): data that should be rejected (-3, 'twenty', blank).
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.
- Weights 1,3,1,3...: products 9, 21, 8, 3, 8, 18, 1, 27, 7, 24, 7, 18
- Sum = 151
- 151 mod 10 = 1
- Check digit = 9
Answer: The check digit is 9
Check yourself
- Calculate the ISBN-13 check digit for the first 12 digits 978014103614.
Show answer
4. Weighted sum = 86; remainder 6; check digit = 4.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
Sources
- Pearson Edexcel International Advanced Level in Information Technology specification (first teaching 2018), Issue 2, February 2021
- Pearson Edexcel IAL Information Technology: scheme of work for Unit 3
- International ISBN Agency: ISBN Users' Manual, Appendix 1, calculating the check digit
Last updated 8 November 2026. Spotted a mistake? Tell us.