The shape of the lesson
By the end of the lesson, learners can
- Validation checks: In the lab, run each validation routine with normal, abnormal, extreme and boundary data and watch which values are rejected.
- Check digits: A check digit is calculated from the other digits of a code and added to the end.
- Verification: copied exactly?: 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.
- Validation: automatic check that data is reasonable and follows rules; it cannot prove data is correct.
- Verification: checks data was copied exactly: visual check or double entry at entry; parity or checksum in transfer.
- Check digit: weight, add, MOD 11, subtract from 11 (10 = X, 11 = 0); a valid code totals a multiple of 11.
- Parity block: the failing row and failing column cross at the wrong bit.
One picture every idea returns to
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.
Forty-five minutes, phase by phase
| Time | Phase | What happens in the room | Grouping |
|---|---|---|---|
| 0 to 5 min | Hook: predict | Open with the question in the title, Reasonable is not correct.. Most damage to data integrity is not an attack at all: it is a mistyped value or a bit flipped by interference. Put the figure on the board: it is the one picture every idea in the lesson returns to. | Whole class, then pairs |
| 5 to 13 min | Teach and check: Validation checks | In the lab, run each validation routine with normal, abnormal, extreme and boundary data and watch which values are rejected. Project tab 3 of the lab (Validation and test data) and let a student drive it while the class predicts. Model the worked example A format and length check on the board, one line at a time. | Whole class, then pairs |
| 13 to 21 min | Teach and check: Check digits | A check digit is calculated from the other digits of a code and added to the end. Project tab 4 of the lab (Checksum, echo check and check digit) and let a student drive it while the class predicts. Model the worked example Calculate a check digit on the board, one line at a time. Your turn: Calculate the modulo 11 check digit for 2468, using weights 5, 4, 3, 2. | Pairs |
| 21 to 30 min | Teach and check: Verification: copied exactly? | 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. Project tab 3 of the lab (Parity byte and parity block) and let a student drive it while the class predicts. Model the worked example Parity block on the board, one line at a time. | Think-Pair-Share |
| 30 to 36 min | Check | The four Stage 1 questions from the student lesson, answered on mini whiteboards or by show of fingers. Re-teach the one most get wrong. | Individual, then whole class |
| 36 to 43 min | Plenary | The exam-style questions from Stage 2, one at a time: thirty seconds alone, then a random call. The feedback lines in the key give the examiner's wording. | Individual, random call |
| 43 to 45 min | Exit and homework | Set the worksheet below (6 questions, 20 marks). Learners self-assess against the objectives before they leave. | Individual |
Protect the parts that carry the learning
The sequence carries about fifty minutes of material, so the lab is driven by one student while the class predicts rather than explored freely. Times are a guide.
Protected: the check at 30 minutes. It is the only individual read on whether the key idea landed, and it is not cut.
Cut first if the build overruns: the last check in Verification: copied exactly?, never the check or the plenary.
In a 60 minute block: run worksheet questions 1 to 3 in class as a Rally Coach set and model both the hardest worked example and its check live.
Think-Pair-Share
Pose the question, give thirty seconds of silent thinking, then a minute to compare with a partner before a few pairs share with the class. The silent minute is the part that cannot be cut.
The full structure, with its variations and the other twelve, is on the cooperative-learning page.
What to head off, and how
| Trap learners fall into | Teaching move that pre-empts it |
|---|---|
| Validation 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 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. |
Validation and verification: worksheet
6 questions, 20 marks. Written in the style of the papers; no past paper question is reproduced.
Explain the difference between validation and verification.
A library system records a member ID (format: one letter then five digits), a date of birth and the number of books borrowed (0 to 8). Name and describe a different validation check suitable for each of the three fields, and say why validation alone cannot ensure the data is correct.
A code uses a modulo 11 check digit with weights 5, 4, 3, 2 for the four data digits. (a) Calculate the check digit for 5073. (b) The code is typed as 50373. Show whether it is accepted.
Data is sent using even parity in a parity block. Bit 1 of each byte is the parity bit. The block received is:
| Byte 1 | 10110100 |
|---|---|
| Byte 2 | 01100110 |
| Byte 3 | 11010000 |
| Parity byte | 00000110 |
Identify the bit that is in error and give the corrected byte.
Write pseudocode to input a password and keep asking until it has a length of at least 10 characters and the user then enters the same password a second time. Output a suitable message for each failure.
A file is transferred with a checksum and every byte also has a parity bit. Explain why an error could still go undetected.
Answer key and marking notes
- Validation is an automatic check by the computer that data is reasonable / meets set rules before it is accepted.
- Verification checks that data has been copied or transferred accurately, matching the original source.
- Member ID: format check, first character a letter and the next five digits (or length check of exactly 6 characters).
- Date of birth: range check, for example between 1 January 1910 and today's date (or presence check).
- Books borrowed: range check from 0 to 8.
- Validation only checks data is reasonable; a valid but wrong value (e.g. 3 instead of 5) is still accepted.
- (a) 5 × 5 + 0 × 4 + 7 × 3 + 3 × 2 = 25 + 0 + 21 + 6 = 52; 52 MOD 11 = 8.
- Check digit = 11 − 8 = 3, giving 50733.
- (b) 25 + 0 + 9 + 14 + 3 = 51 using weights 5, 4, 3, 2, 1; 51 MOD 11 = 7, not 0, so the code is rejected.
- Bytes 1, 2, 3 contain 4, 4 and 3 ones: byte 3 fails the even parity check.
- Count each column including the parity byte: only column 6 has an odd number of 1s (1, 1, 0 and parity bit 1 = three).
- The error is byte 3, bit 6: received 0, so byte 3 should be 11010100.
- DECLARE Password, Repeat : STRING and a BOOLEAN flag, e.g. Done ← FALSE.
- REPEAT ... UNTIL Done (or an equivalent condition-controlled loop).
- INPUT Password; IF LENGTH(Password) < 10 THEN OUTPUT a length message (length check).
- ELSE INPUT Repeat; IF Repeat = Password THEN Done ← TRUE (double entry verification).
- ELSE OUTPUT a mismatch message; ENDIF statements correctly closed.
- Two bits changing in the same byte leave the number of 1s even (or odd), so the parity check passes.
- Errors in two bytes could cancel out in the sum, e.g. one byte 1 higher and another 1 lower, giving the same checksum.
- If both happen together, the corrupted data is accepted, so integrity is lost without warning.
6 multiple-choice questions on this lesson
From the topic question bank. Assign them in the app for a marked score in your gradebook, or run the topic as a class game.
Which statement correctly describes the difference between validation and verification?
- AValidation checks that data is reasonable and follows set rules; verification checks that data has been copied or transferred exactly
- BValidation checks that data is correct; verification checks that data is in the right format
- CValidation is carried out by a person; verification is always carried out automatically by the computer
- DValidation only happens during data transfer; verification only happens during data entry
When an order is entered, the product code must match a code already stored in the Product table. Which validation check is this?
- AExistence check
- BFormat check
- CPresence check
- DRange check
Using the modulo 11 method with weights 5, 4, 3, 2, what is the check digit for the code 4073?
- A8
- B3
- C7
- D4
Bytes are sent using even parity. Which received byte must contain an error?
- A
01101101 - B
10110100 - C
11001100 - D
00111001
Using the modulo 11 method with weights 5, 4, 3, 2, what is the check digit for the code 2581?
- AX
- B1
- C10
- D0
Codes have a modulo 11 check digit at the end, with weights 5, 4, 3, 2, 1. A code is accepted if the weighted total MOD 11 is 0. Which of these typed codes is accepted?
- A40738
- B40783
- C04738
- D40728
Quiz key
Validation is an automatic check that data is reasonable; verification checks it is a true copy, at entry (visual check, double entry) or in transfer (parity, checksum). Validation cannot prove data is correct, and format checking is a kind of validation. Validation is automatic, while a visual check is done by a person. Verification happens at both entry and transfer, and validation happens on input.
An existence check confirms that the value already exists, for example in a file or table. A format check tests the pattern of characters, not whether the code is stored. A presence check only tests that something was entered. A range check tests that a value lies between two limits.
4 × 5 + 0 × 4 + 7 × 3 + 3 × 2 = 20 + 0 + 21 + 6 = 47. 47 MOD 11 = 3, and 11 − 3 = 8. The answer 3 is the remainder before subtracting from 11. 7 is just the last digit of the total, 47. 4 comes from applying the weights in reverse order: 3 × 5 + 7 × 4 + 0 × 3 + 4 × 2 = 51, 51 MOD 11 = 7, and 11 − 7 = 4.
01101101 has five 1s, an odd number, so with even parity it must be wrong. 10110100, 11001100 and 00111001 each have four 1s, an even number, so they pass the check (although an even number of flipped bits would also pass).
2 × 5 + 5 × 4 + 8 × 3 + 1 × 2 = 10 + 20 + 24 + 2 = 56. 56 MOD 11 = 1, and 11 − 1 = 10, which is written as X so it fits in one digit position. 1 is the remainder before subtracting. 10 is the right value but needs two digits, so it cannot be used. 0 is only used when the result is 11.
40738: 20 + 0 + 21 + 6 + 8 = 55, and 55 MOD 11 = 0, so it is accepted. 40783 swaps the last two digits: total 60, MOD 11 = 5, rejected. 04738 swaps the first two: total 51, MOD 11 = 7, rejected. 40728 has one wrong digit: total 53, MOD 11 = 9, rejected. This shows the check catches transpositions and single-digit errors.
What to project
The student lesson embeds these tabs. Open them full screen on the projector; every slider has a drag handle on the stage.
Slides for this lesson
A projectable deck for every pack is on the way. Until then, present the student lesson full screen: its sections, figure and lab tabs follow the same order as the plan above.