Comparing ASCII and Unicode

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Comparing ASCII and Unicode

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which character set can represent characters from many languages and emoji?
A ASCII
B Unicode
2. How many bits does each character use in 8-bit ASCII?
A 8 bits per character
B 16 bits per character
3. A text has 100 characters. Which format gives the larger file?
A Unicode with 16 bits per character (1600 bits)
B ASCII with 8 bits per character (800 bits)
4. Why can Unicode support far more characters than ASCII?
A It uses more bits for each character, so there are more possible codes
B It uses fewer bits for each character, so the codes are shorter
5. A short English-only message needs to be stored using as little space as possible. Which is the better choice?
A Unicode, because it always makes files smaller
B ASCII, because it needs fewer bits per character

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1ASCII: 8 bits per character AUnicode uses more bits per character, so the same text makes a larger file, not a smaller one
2Unicode: 16 or 32 bits per character B100 x 8 = 800 bits, 100 x 16 = 1600 bits
3Unicode supports far more characters than ASCII, including emoji and other alphabets CEach character is stored in one byte, so a 100-character English text needs 800 bits
4The same 100-character message takes twice the storage in 16-bit Unicode as in 8-bit ASCII DUnicode: over 140000 characters, ASCII: 256 characters
5Unicode text files are smaller than ASCII text files EEach character takes two or four bytes, so the same text uses more storage than in ASCII
6ASCII is used for English-only text because it can show emoji FASCII cannot show emoji; it is used for English-only text because it needs fewer bits and so saves storage

Definitions

Unicode vs ASCII

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
asciiBits = 100 * _
2.
// UTF-32 uses 4 bytes per character unicodeBits = 100 * __
3.
IF unicodeBits _ asciiBits THEN OUTPUT "Unicode file is bigger" ENDIF
4.
asciiChars = 2 ^ 8 unicodeChars = 2 ^ __
5.
unicodeBits = ______("Hello") * 16

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A text ← "HELLO"
B asciiBits ← 5 * 16
C unicodeBits ← 5 * 32
D OUTPUT unicodeBits - asciiBits
Question 2
A maxAscii ← 2 ^ 32
B maxUnicode ← 2 ^ 16
C OUTPUT maxUnicode > maxAscii
Question 3
A text ← "Hi"
B asciiSize ← LENGTH(text) * 8
C uniSize ← LENGTH(text) * 8
D OUTPUT uniSize > asciiSize
Question 4
A IF onlyEnglish = FALSE THEN
B encoding ← "ASCII"
C ELSE
D encoding ← "Unicode"
E ENDIF
Question 5
A emoji ← TRUE
B IF emoji = TRUE THEN
C encoding ← "ASCII"
D ELSE
E encoding ← "ASCII"
F ENDIF

Answer Key

Comparing ASCII and Unicode
Section A: Quick Questions
Q1
B — Unicode
Q2
A — 8 bits per character
Q3
A — Unicode with 16 bits per character (1600 bits)
Q4
A — It uses more bits for each character, so there are more possible codes
Q5
B — ASCII, because it needs fewer bits per character
Section B: Match the Pairs
Q1
ASCII: 8 bits per character → Each character is stored in one byte, so a 100-character English text needs 800 bits
Q2
Unicode: 16 or 32 bits per character → Each character takes two or four bytes, so the same text uses more storage than in ASCII
Q3
Unicode supports far more characters than ASCII, including emoji and other alphabets → Unicode: over 140000 characters, ASCII: 256 characters
Q4
The same 100-character message takes twice the storage in 16-bit Unicode as in 8-bit ASCII → 100 x 8 = 800 bits, 100 x 16 = 1600 bits
Q5
Unicode text files are smaller than ASCII text files → Unicode uses more bits per character, so the same text makes a larger file, not a smaller one
Q6
ASCII is used for English-only text because it can show emoji → ASCII cannot show emoji; it is used for English-only text because it needs fewer bits and so saves storage
Section C: Definitions
Q1
Unicode vs ASCII — Unicode supports far more characters than 8-bit ASCII but uses 16 or 32 bits per character, so the same text takes up more storage space.
Section D: Fill in the Blanks
Q1
asciiBits = 100 * 8
Q2
// UTF-32 uses 4 bytes per character unicodeBits = 100 * 32
Q3
IF unicodeBits > asciiBits THEN OUTPUT "Unicode file is bigger" ENDIF
Q4
asciiChars = 2 ^ 8 unicodeChars = 2 ^ 16
Q5
unicodeBits = LENGTH("Hello") * 16
Section E: Spot the Error
Q1
B — ASCII uses 8 bits per character, so 5 characters need 5 * 8 bits. 16 bits per character is a Unicode size, not ASCII.
Q2
A — 8-bit ASCII can only represent 2 ^ 8 = 256 characters. 2 ^ 32 is far too large and would make ASCII bigger than Unicode.
Q3
C — Unicode uses 16 or 32 bits per character, not 8. It should be LENGTH(text) * 32 (or 16), which is why Unicode text takes more storage.
Q4
A — ASCII is still used when text is English-only because it needs fewer bits. The condition should be onlyEnglish = TRUE.
Q5
C — Emoji are not in the ASCII character set, which only has 256 characters. Text with emoji needs Unicode, so this should be "Unicode".