Most damage to data integrity is not an attack at all: it is a mistyped value or a bit flipped by interference. Validation rejects data that cannot be right; verification checks that data was copied or transmitted exactly. Learn every named check and be ready to carry out each one by hand.
Validation is an automatic check, done by the computer, that data is reasonable and follows set rules: range, format, length, presence, existence and limit checks and check digits. Verification checks that data has been copied correctly: during data entry by a visual check or double entry, and during data transfer by a parity check (byte or block) or a checksum. Both protect data integrity, but neither can prove that data is actually true: a valid, correctly typed date of birth can still be the wrong person's.
In the lab, run each validation routine with normal, abnormal, extreme and boundary data and watch which values are rejected.
| Check | What it does | Example |
|---|---|---|
| Range check | Data lies between a lower and an upper limit | An exam mark from 0 to 100 |
| Limit check | Data is checked against one limit only | Quantity ordered must be 1 or more |
| Format check | Data follows a set pattern of characters | A student ID of two letters then four digits, e.g. AB1234 |
| Length check | Data has a set number of characters, or a number within limits | A password of at least 10 characters |
| Presence check | Data has been entered: the field is not empty | Surname must be filled in |
| Existence check | Data matches a value that already exists, for example in a file or table | A product code must be in the product table |
| Check digit | An extra digit calculated from the other digits is recalculated and compared | ISBNs and bar codes |
DECLARE Mark : INTEGER
REPEAT
OUTPUT "Enter the mark (0 to 100)"
INPUT Mark
IF Mark < 0 OR Mark > 100 THEN
OUTPUT "Invalid: the mark must be from 0 to 100"
ENDIF
UNTIL Mark >= 0 AND Mark <= 100
ValidID that returns TRUE only if its parameter is exactly six characters: two upper-case letters followed by four digits.FUNCTION ValidID(ID : STRING) RETURNS BOOLEAN
DECLARE Valid : BOOLEAN
DECLARE Index : INTEGER
DECLARE Ch : STRING
Valid ← TRUE
IF LENGTH(ID) <> 6 THEN
Valid ← FALSE
ELSE
FOR Index ← 1 TO 6
Ch ← MID(ID, Index, 1)
IF Index <= 2 THEN
IF Ch < "A" OR Ch > "Z" THEN
Valid ← FALSE
ENDIF
ELSE
IF Ch < "0" OR Ch > "9" THEN
Valid ← FALSE
ENDIF
ENDIF
NEXT Index
ENDIF
RETURN Valid
ENDFUNCTIONValidation cannot tell you the data is correct, only that it is reasonable. A mark of 67 typed instead of 76 passes a 0 to 100 range check.
A check digit is calculated from the other digits of a code and added to the end. When the code is entered, the computer repeats the calculation. A common 9618 method is modulo 11 with weights; the lab shows the ISBN-13 method, which uses weights 1 and 3 and modulo 10.
Four quick checks. Each correct answer earns XP and records this skill on your profile.
Which check would reject a date of birth field left blank?
In the lab, with even parity, which received byte shows an error?
What is the main purpose of verification during data entry?
Using weights 5, 4, 3, 2 and modulo 11, what is the check digit for 1234?
In the lab, flip a bit in a parity block and see how the failing row and the failing column meet at the changed bit.
| Method | When | How it works |
|---|---|---|
| Visual check | Data entry | The user compares the data on screen with the source document and corrects any differences |
| Double entry | Data entry | Data is entered twice (often by two people); the computer compares the two and reports any mismatch |
| Parity byte | Data transfer | Sender and receiver agree on even or odd parity; a parity bit makes the count of 1s in each byte even (or odd); the receiver recounts |
| Parity block | Data transfer | A parity bit on each byte and a parity byte for each column of a block; a single wrong bit is found where the failing row and column cross, so it can be corrected |
| Checksum | Data transfer | The sender calculates a value from the block (e.g. the sum of the bytes, ignoring overflow) and sends it; the receiver recalculates and compares |
A parity check misses an even number of changed bits in the same byte, because the count stays even. And neither validation nor verification can tell if the source document itself was wrong.
Unlocks once the four checks above are done. Worth more XP, written to AS Paper 1 and Paper 2 standard.
A field must hold a code that is already stored in the customer table. Which validation check is this?
Which statement about a parity block is correct?
A 7-bit code 1100101 is sent with odd parity, the parity bit added on the left. What byte is sent?
An operator types a quantity of 15 instead of 51. Which check is most likely to detect this?
This skill is now recorded on your profile. Keep the chain going.