Phase 1: Prepare
Step 1 Warm-up recall
From M2.L2: convert 5 to binary.
Private: nothing you type here is sent or stored.
Step 2 Learning goal
By the end of this lesson you can:
- explain why text needs a code table (Foundation);
- encode a short word using ASCII codes (Core);
- estimate the size of a plain text message (Core).
Phase 2: Teach
Step 3 A familiar example
A computer stores only numbers. So how does it store the letter A? Only by agreement: everyone uses the same table that says which number stands for which character.
Step 4 Clear explanation
A character code is an agreed table that gives each character a number. The classic table is ASCII (American Standard Code for Information Interchange), which covers English letters, digits and common punctuation with codes 0 to 127. In ASCII the capital letter A is 65, B is 66 and so on, the lower-case a is 97, and the digit character 0 is 48. Unicode is a much larger table that covers the writing systems of the world; its first 128 codes match ASCII.
| Character | Code (decimal) | Code (8 bits) |
|---|---|---|
| H | 72 | 01001000 |
| i | 105 | 01101001 |
| A | 65 | 01000001 |
| a | 97 | 01100001 |
The word “Hi” is therefore stored as the codes 72 and 105, which are the two bytes 01001000 and 01101001. Plain English text stored with one byte for each character takes one byte per character, so a message of 12 characters, including spaces, takes 12 bytes. Some Unicode encodings, such as UTF-8, use one to four bytes per character, so text in other scripts can take more space. The point of the lesson: the bits are the same, and only the agreed table makes them mean text. See also the entry on the programming language, which uses such codes for strings.
Step 5 Worked example (4 marks)
Encode the word “Hi” in ASCII bits (H = 72, i = 105).
- Convert 72: 64 + 8 gives 01001000. (1 mark)
- Convert 105: 64 + 32 + 8 + 1 gives 01101001. (1 mark)
- Join the bytes: 01001000 01101001. (1 mark)
- Size: 2 characters = 2 bytes = 16 bits. (1 mark)
Phase 3: Practise
Step 6 Learner practice (instant-marked)
1. A character code is:
The table is what makes bits mean text.
2. In ASCII, the capital letter A has the code:
A is 65; lower-case a is 97.
3. A 12-character plain English message at one byte per character takes:
12 characters × 1 byte = 12 bytes.
4. Unicode differs from ASCII mainly because it:
Unicode is a much larger table.
Phase 4: Close
Step 7 Recap
- A code table maps characters to numbers; the numbers are stored as bits.
- ASCII: A = 65, a = 97, digit 0 = 48.
- Plain English text at one byte per character takes one byte per character.
Step 8 Exit ticket (ungraded)
Write the ASCII codes of the letters B and b, given that A is 65 and a is 97.
Private: nothing you type here is sent or stored.
Step 9 Go further (Extension)
Look up the code of one non-English letter in Unicode and note how many bytes it takes in UTF-8.
Common mistakes
| Mistake | Why it fails |
|---|---|
| Treating the digit character 5 as the number 5 | The character 5 has its own code. |
| Forgetting spaces count as characters | Count every character. |
| Assuming one byte per character everywhere | Other scripts can need more. |
Limits. This lesson simplifies Unicode; it does not cover how encodings such as UTF-8 are constructed.