The shape of the lesson
By the end of the lesson, learners can
- Characters as codes: Type some text into the lab and watch each character become its code and then its binary pattern.
- Working out codes: Because codes run in order (A, B, C... and 0, 1, 2...), one known code unlocks the rest.
- How much space does text take?: Storage for plain text is the number of characters multiplied by the bits per character.
- ASCII: 7 bits, 128 characters; extended ASCII 8 bits, 256 characters.
- Unicode: up to 32 bits, every language and emoji; first 128 codes match ASCII.
- Codes are consecutive: count along from the code you are given; lower case = upper case + 32 in ASCII.
- Storage: number of characters × bits per character.
One picture every idea returns to
A character set is the complete list of characters a computer can represent, with a unique binary code for each one. ASCII uses 7 bits (128 characters: English letters, digits, punctuation and control codes). Extended ASCII uses 8 bits (256 characters), adding accented letters and symbols. Unicode uses up to 32 bits per character so it can represent every writing system and emoji; its first 128 codes match ASCII. Codes for letters are consecutive, so you can work out one code from another.
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, Every letter is a number.. When you press a key, the computer stores a number, not a letter. 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: Characters as codes | Type some text into the lab and watch each character become its code and then its binary pattern. Project tab 1 of the lab (Text and character sets) and let a student drive it while the class predicts. | Whole class, then pairs |
| 13 to 21 min | Teach and check: Working out codes | Because codes run in order (A, B, C... and 0, 1, 2...), one known code unlocks the rest. Model the worked example Counting along on the board, one line at a time. Your turn: Given 'A' = 65, which character has the code 01001011? | Pairs |
| 21 to 30 min | Teach and check: How much space does text take? | Storage for plain text is the number of characters multiplied by the bits per character. Project tab 1 of the lab (Comparing bits per character) and let a student drive it while the class predicts. Model the worked example Extended ASCII or UTF-32 on the board, one line at a time. Your turn: A 500-character text uses UTF-16, with 2 bytes for every character. How many bits is that? | 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, 15 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 How much space does text take?, 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 |
|---|---|
| You will not be asked to memorise codes. | The exam gives you one, such as 'A' = 65, and expects you to work out the others. |
| A digit stored as a character is not the same as the number. | The string "7" is code 55; the integer 7 is 00000111. |
Character sets: ASCII, extended ASCII and Unicode: worksheet
6 questions, 15 marks. Written in the style of the papers; no past paper question is reproduced.
Explain what is meant by a character set.
The ASCII code for 'M' is 77. Give the 8-bit binary codes for 'P' and for 'm'.
The code for the character '0' is 48. (a) Give the 8-bit code for the character '5'. (b) Explain why this is different from storing the integer 5.
A document contains 6000 characters. Calculate the storage needed in KiB if it is stored (a) in extended ASCII and (b) in a Unicode encoding using 4 bytes per character.
Describe the differences between ASCII and Unicode.
A company changes its customer database from extended ASCII to a Unicode encoding. Give one benefit and one drawback of the change.
Answer key and marking notes
- The set of all the characters that a computer can represent / recognise.
- Each character is given a unique binary code.
- 'P' = 80 = 01010000.
- 'm' = 77 + 32 = 109 = 01101101.
- (a) 48 + 5 = 53 = 00110101.
- (b) The integer 5 is stored as 00000101.
- The character code represents a symbol for display; it must be converted before it can be used in calculations.
- (a) 6000 bytes ÷ 1024 = 5.86 KiB (2 d.p.).
- (b) 6000 × 4 = 24 000 bytes.
- 24 000 ÷ 1024 = 23.44 KiB (2 d.p.).
- ASCII uses 7 bits per character; Unicode uses up to 32 bits (e.g. 16 or 32).
- ASCII represents only 128 characters (English letters, digits, punctuation); Unicode represents characters from all languages and emoji.
- Unicode text can take more storage; the first 128 Unicode codes are the same as ASCII.
- Benefit: names and addresses in any language (e.g. Arabic, Chinese) can be stored correctly.
- Drawback: more bits per character, so the database needs more storage and takes longer to transmit.
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.
How many different characters can extended ASCII represent?
- A256
- B128
- C255
- D65 536
The ASCII code for 'A' is 65. What is the 8-bit binary code for 'M'?
- A
01001101 - B
01001110 - C
01101101 - D
01001100
In ASCII the character '0' has the code 48. Which byte stores the character '9' (not the integer 9)?
- A
00111001 - B
00001001 - C
00111000 - D
01001001
Why was Unicode introduced?
- AASCII codes could not represent the characters of many of the world's languages
- BUnicode uses fewer bits per character, so text files are smaller
- CASCII had no codes for the digits 0 to 9
- DUnicode stores characters in hexadecimal, which the processor reads faster
A document contains 3000 characters. How much more storage does it need in UTF-32 (4 bytes per character) than in extended ASCII?
- Aabout 8.79 KiB
- B9 KiB
- Cabout 11.72 KiB
- Dabout 2.93 KiB
In ASCII the code for 'a' is 97. Which character has the code 01011010?
- A'Z'
- B'z'
- C'Y'
- D'X'
Quiz key
Extended ASCII uses 8 bits, giving 28 = 256 codes (0 to 255). 128 is standard 7-bit ASCII, 255 is the largest code rather than the number of codes, and 65 536 would need 16 bits.
M is 12 letters after A, so its code is 65 + 12 = 77 = 64 + 8 + 4 + 1 = 01001101. 01001110 is 78 ('N', counting A as position 1), 01101101 is 109, the code for lower-case 'm', and 01001100 is 76 ('L').
'9' has code 48 + 9 = 57 = 00111001. 00001001 is the integer 9, not the character. 00111000 is 56, the character '8', and 01001001 is 73, the capital letter 'I'.
128 or 256 codes cannot cover scripts such as Chinese, Arabic or Hindi, so Unicode gives every writing system (and emoji) its own code. Unicode often needs more bits per character, not fewer. ASCII already includes the digits, and characters are always stored in binary; hexadecimal is only a way of writing values for people.
UTF-32: 3000 × 4 = 12 000 bytes; extended ASCII: 3000 bytes. The difference is 9000 bytes = 9000 ÷ 1024 = 8.79 KiB. 9 KiB divides by 1000, 11.72 KiB is the whole UTF-32 size, and 2.93 KiB is the whole extended ASCII size.
01011010 = 64 + 16 + 8 + 2 = 90. Capitals are 32 less than lower case, so 'A' = 97 − 32 = 65 and 90 − 65 = 25 letters after 'A', which is 'Z'. 'z' is 122, 'Y' is 89 and 'X' is 88.
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.