Teachers' Portal  /  IGCSE Computer Science 0478  /  Data representation  /  Representing text: ASCII and Unicode
Lesson pack · IGCSE Computer Science 0478 · 1.2 · IGCSE

Representing text: ASCII and Unicode

Letters as numbers. When you press a key, the computer does not store a letter: it stores a number, written in binary.

Student lesson Lab, full screen
At a glance

The shape of the lesson

Topic
Data representation
Syllabus reference
Cambridge IGCSE Computer Science 0478, 1.2
Level
IGCSE
Duration
45 minutes, lab-led; stretches to a 60 minute block (see the contingency notes)
Position in topic
Lesson 6 of 10 in Data representation; follows Two's complement for negative numbers; leads into Representing sound: sample rate and resolution
Central model
Fig. 1: the text Hi! stored as three ASCII 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
  • Text is numbers: Type some text into the lab and watch each character turn into its code and then into binary.
  • ASCII and Unicode: Switch the lab between ASCII and Unicode and add a character from another language or an emoji.
  • How much space does text take?: The storage needed is the number of characters multiplied by the bits per character.
Key points to leave on the board
  • Character set: every character has a unique binary code.
  • ASCII: 7 bits, 128 characters (extended 8 bits, 256): English only.
  • Unicode: many more characters (languages, emojis) but more bits per character.
  • Storage: number of characters × bits per character.
The core visual model

One picture every idea returns to

Text must be converted to binary before a computer can process it. A character set gives every character a unique binary code. ASCII uses 7 bits (128 characters), and extended ASCII 8 bits (256 characters): enough for English letters, digits and symbols. Unicode allows a far greater range of characters and symbols, including different languages and emojis, but it needs more bits per character (up to 32), so the same text takes more storage.

each character has a code in the character set characterASCII codebinary (8 bits) Hi! 7210533 010010000110100100100001
Fig. 1: the text Hi! stored as three ASCII 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, Letters as numbers.. When you press a key, the computer does not store a letter: it stores a number, written in binary. 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: Text is numbersType some text into the lab and watch each character turn into its code and then into binary. Project tab 1 of the lab (Text to binary) and let a student drive it while the class predicts. Model the worked example Codes in sequence on the board, one line at a time. Your turn: The ASCII code for c is 99. Give the denary and binary codes for g.Whole class, then pairs
13 to 21 minTeach and check: ASCII and UnicodeSwitch the lab between ASCII and Unicode and add a character from another language or an emoji. Project tab 1 of the lab (ASCII and Unicode) and let a student drive it while the class predicts.Pairs
21 to 30 minTeach and check: How much space does text take?The storage needed is the number of characters multiplied by the bits per character. Model the worked example Same message, two character sets on the board, one line at a time.Jigsaw
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, 13 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

Jigsaw

Split the content into expert pieces. Expert groups master one piece each, then regroup so every home team has one expert per piece, and each expert teaches their piece to the team.

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
The digit character 7 is not stored as the number 7.In ASCII it is code 55, so text digits cannot be used in a calculation until they are converted.
Saying Unicode is "better" earns nothing.Say it has a greater range of characters (other languages, emojis) but uses more bits per character, so files are bigger.
Worksheet

Representing text: ASCII and Unicode: worksheet

6 questions, 13 marks. Written in the style of the papers; no past paper question is reproduced.

NameClassDate
Q1 · explain[2 marks]

Explain why a computer needs a character set to represent text.

Q2 · convert[2 marks]

The ASCII code for D is 68. Give the 8-bit binary codes for D and F.

Q3 · explain[3 marks]

Compare the ASCII and Unicode character sets.

Q4 · calculate[2 marks]

A text file contains 2048 characters. Calculate its size in KiB if it is stored (a) in 8-bit ASCII and (b) in a 32-bit Unicode encoding.

Q5 · apply[2 marks]

A company is building a chat app for users in China, India and Greece who like to send emojis. State which character set it should use and justify your choice.

Q6 · analysis[2 marks]

A student says "Unicode should always be used because it is newer than ASCII." Give one reason why ASCII may still be chosen for a file containing only English text.

Answer key and marking notes
Q1 · 2 marks
  • Text must be converted to binary to be processed by a computer.
  • A character set gives each character a unique binary code, so all computers using it read the codes as the same characters.
Q2 · 2 marks
  • D: 68 = 01000100.
  • F: 68 + 2 = 70 = 01000110.
Q3 · 3 marks
  • ASCII uses fewer bits per character (7, or 8 for extended ASCII); Unicode uses more bits per character.
  • ASCII represents a small range of characters (128 or 256), mainly English; Unicode represents a much greater range, including other languages and emojis.
  • So the same text takes more storage in Unicode than in ASCII.
Q4 · 2 marks
  • (a) 2048 × 8 bits = 2048 bytes; 2048 ÷ 1024 = 2 KiB.
  • (b) 2048 × 32 bits = 8192 bytes; 8192 ÷ 1024 = 8 KiB.
Q5 · 2 marks
  • Unicode.
  • ASCII cannot represent Chinese, Hindi or Greek characters or emojis; Unicode has codes for all of them.
Q6 · 2 marks
  • ASCII needs fewer bits per character.
  • So the file would be smaller, using less storage and taking less time to transmit, and ASCII already covers all English characters.
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

What is a character set?

  • AA list of characters a computer can represent, each with its own unique binary code
  • BThe font and size used to display text on the screen
  • CThe set of keys available on a particular keyboard
  • DA method of compressing text so it uses fewer bits
Q21 mark

The ASCII code for the letter a is 97. What is the 8-bit binary code for the letter f?

  • A01100110
  • B01100101
  • C01000110
  • D01100111
Q31 mark

Why was Unicode developed when ASCII already existed?

  • ATo represent a far greater range of characters, including other languages and emojis
  • BTo store English text using fewer bits per character than ASCII
  • CTo let computers process text faster than with ASCII
  • DTo remove the need to convert text into binary
Q41 mark

Standard ASCII uses 7 bits for each character. How many different characters can it represent?

  • A128
  • B7
  • C127
  • D256
Q51 mark

A text file contains 1536 characters stored in a 16-bit Unicode encoding. What is its size in KiB?

  • A3 KiB
  • B1.5 KiB
  • C24 KiB
  • D6 KiB
Q61 mark

A document is converted from 8-bit ASCII to a 32-bit Unicode encoding. The text itself does not change. What happens to the file size?

  • AIt becomes 4 times larger
  • BIt stays the same, because the characters are the same
  • CIt becomes 32 times larger
  • DIt increases by 24 bits in total
Quiz key
Q1: A

A character set such as ASCII or Unicode gives every character a unique binary code, so text can be converted to binary. A font only controls how characters look. Keyboards differ, but the character set is about the codes stored. A character set does not compress text.

Q2: A

f is 5 letters after a, so its code is 97 + 5 = 102 = 64 + 32 + 4 + 2 = 01100110. 01100101 is 101 (e), from counting one place short. 01000110 is 70, the code for capital F. 01100111 is 103 (g), from counting one place too far.

Q3: A

ASCII has room for only 128 (or 256) characters, mainly English. Unicode can represent over a million characters, covering many writing systems and emojis. It uses more bits per character, not fewer, and is not faster. All text, in any character set, must still be converted to binary.

Q4: A

27 = 128 different codes, from 0 to 127. 7 is just the number of bits. 127 is the largest code, but code 0 is also used, so there are 128. 256 is for 8 bits (extended ASCII).

Q5: A

16 bits = 2 bytes per character, so 1536 × 2 = 3072 bytes, and 3072 ÷ 1024 = 3 KiB. 1.5 KiB assumes 1 byte per character, as in 8-bit ASCII. 24 KiB forgets to divide the bits by 8. 6 KiB uses 4 bytes per character, which is 32-bit Unicode.

Q6: A

Each character goes from 8 bits to 32 bits, which is 4 times as many, so the whole file becomes 4 times larger. The characters are the same, but each takes more storage. 32 times confuses the new size with the factor. The extra 24 bits apply to every character, not once to the whole file.

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 for negative numbers