Teachers' Portal  /  A-Level Computer Science 9618  /  Information representation  /  Character sets: ASCII, extended ASCII and Unicode
Lesson pack · A-Level Computer Science 9618 · 1.1 · AS Level

Character sets: ASCII, extended ASCII and Unicode

Every letter is a number. When you press a key, the computer stores a number, not a letter.

Student lesson Lab, full screen
At a glance

The shape of the lesson

Topic
Information representation
Syllabus reference
Cambridge International AS and A Level Computer Science 9618, 1.1
Level
AS Level
Duration
45 minutes, lab-led; stretches to a 60 minute block (see the contingency notes)
Position in topic
Lesson 4 of 7 in Information representation; follows Two's complement and binary arithmetic; leads into Bitmap and vector graphics
Central model
Fig. 1: the text "Hi" stored as two character codes
Cooperative structure
Assessment
Stage 1 check and the exam-style plenary from the student lesson, plus the worksheet as the exit task
Learning objectives

By the end of the lesson, learners can

Section by section
  • 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.
Key points to leave on the board
  • 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.
The core visual model

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.

each character is stored as its code in the character set Hi 72105 0100 10000110 1001 charactercode (denary)stored in binary
Fig. 1: the text "Hi" stored as two character codes
Lesson sequence

Forty-five minutes, phase by phase

TimePhaseWhat happens in the roomGrouping
0 to 5 minHook: predictOpen 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 minTeach and check: Characters as codesType 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 minTeach and check: Working out codesBecause 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 minTeach 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 minCheckThe 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 minPlenaryThe 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 minExit and homeworkSet the worksheet below (6 questions, 15 marks). Learners self-assess against the objectives before they leave.Individual
Timing and contingency

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.

Running the cooperative task

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.

Examiner traps to pre-empt

What to head off, and how

Trap learners fall intoTeaching 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.
Worksheet

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.

NameClassDate
Q1 · explain[2 marks]

Explain what is meant by a character set.

Q2 · apply[2 marks]

The ASCII code for 'M' is 77. Give the 8-bit binary codes for 'P' and for 'm'.

Q3 · apply[3 marks]

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.

Q4 · calculate[3 marks]

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.

Q5 · explain[3 marks]

Describe the differences between ASCII and Unicode.

Q6 · analysis[2 marks]

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
Q1 · 2 marks
  • The set of all the characters that a computer can represent / recognise.
  • Each character is given a unique binary code.
Q2 · 2 marks
  • 'P' = 80 = 01010000.
  • 'm' = 77 + 32 = 109 = 01101101.
Q3 · 3 marks
  • (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.
Q4 · 3 marks
  • (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.).
Q5 · 3 marks
  • 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.
Q6 · 2 marks
  • 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.
Quiz

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.

Q11 mark

How many different characters can extended ASCII represent?

  • A256
  • B128
  • C255
  • D65 536
Q21 mark

The ASCII code for 'A' is 65. What is the 8-bit binary code for 'M'?

  • A01001101
  • B01001110
  • C01101101
  • D01001100
Q31 mark

In ASCII the character '0' has the code 48. Which byte stores the character '9' (not the integer 9)?

  • A00111001
  • B00001001
  • C00111000
  • D01001001
Q41 mark

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
Q51 mark

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
Q61 mark

In ASCII the code for 'a' is 97. Which character has the code 01011010?

  • A'Z'
  • B'z'
  • C'Y'
  • D'X'
Quiz key
Q1: A

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.

Q2: A

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').

Q3: A

'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'.

Q4: A

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.

Q5: A

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.

Q6: A

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.

Lab and demo

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

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.

Also for this topic

Everything else you can use

Original work by the TheLucidSTEM team. The worksheet items are written in the style of the papers; no past paper question is reproduced.
Previous lessonTwo's complement and binary arithmetic