AQA 8525 GCSE Computer Science · 3.3 Fundamentals of Data Representation
Stretch tasks Character Encoding
Quiz Challenge
A quiz game against four computer players, then short and long written answers.
- Quiz Blitz12 questions against the clock
- Quick Fire4 short answers
- Big Think2 long answers
About 20 minutes
This or That
Pixel the cat asks 8 questions. Each has two answers: pick the right one.
- Two answers to every question
- A fish treat for every right answer
- Streaks win Pixel shades, then a party hat
About 4 minutes
Memory Match
Flip the cards two at a time to match each term card to its meaning card.
- 12 cards: each term has a meaning
- One peek at every card
- Combo points for pairs found in a row
6 pairs, about 4 minutes
Sort It
Sort each statement into the right box, like the tick-box tables in the exam.
- 12 cards to sort into 3 boxes
- Drag a card, tap a box or press its number
- Combo points for cards sorted in a row
12 cards, about 4 minutes
The games need JavaScript. Every question is below, with the answers at the end.
Read the lesson: Character Encoding
Character Encoding: the questions
Quiz Challenge, round 1: Quiz Blitz
How many codes does 7-bit ASCII have?
- 127
- 65,536
- 128
- 256
'A' is 65. What is the code for 'Z'?
'a' is 97. What is the code for 'c'?
'0' is 48. What is the code for the character '7'?
How do you get a lower case letter's code from its upper case code?
- Multiply by 2
- Add 32
- Subtract 32
- Add 26
Unicode always uses more storage than ASCII, even for plain English text.
- True
- False
Why do garbled boxes and question marks appear in some text?
- The font was too small
- The computer ran out of RAM
- It was displayed using a different character set
- The file was too big
Which TWO can Unicode represent but ASCII cannot?
Tick 2.
- The digits 0 to 9
- A full stop
- Arabic letters
- Chinese characters
- Upper case English letters
What is a control character?
- A capital letter
- A character used in passwords
- The first character of a string
- A code that causes an action, such as a new line
How many codes does extended ASCII have?
Why is 65 the letter A?
- Because 65 is A in hexadecimal
- Because of where it sits on the keyboard
- Because everybody agreed it would be
- Because A is the 65th letter
The first 128 Unicode codes are the same as ASCII.
- True
- False
Quiz Challenge, round 2: Quick Fire
Explain how to find the numeric value of a digit character such as '7' from its ASCII code. [2 marks]
Compare ASCII with Unicode. [2 marks]
Explain why two computers must use the same character set to exchange text. [2 marks]
Describe how an upper case letter can be turned into lower case using its character code. [2 marks]
Quiz Challenge, round 3: Big Think
Explain why Unicode was introduced, and the trade-off of using it. [4 marks]
Characters are stored in a logical order in ASCII. Explain how this lets a program change case and find digit values using arithmetic, with examples. [4 marks]
This or That: tick the right answer
Is the character '7' the same as the number 7?
- Yes: both store seven
- No: '7' is code 55
Which can use more bits per character?
- Unicode
- ASCII
Which is a control character?
- Carriage return
- The letter Q
'B' is 66. What is 'b'?
- 98
- 67
Why do old ASCII files still open as Unicode?
- Unicode's first 128 codes match
- Unicode turns them into pictures
Plain English text in variable-width Unicode takes...
- The same space as ASCII
- Four times the space of ASCII
How many bits does standard ASCII use?
- 7
- 8
Which needs Unicode?
- An English shopping list
- A menu written in Greek
Memory Match: match each term to its meaning
| Term | Meaning |
|---|---|
| A ASCII | 1 65 |
| B Extended ASCII | 2 Over a million codes, every script |
| C Unicode | 3 90 |
D 'A' | 4 8 bits, 256 codes |
E 'Z' | 5 48 |
F '0' | 6 7 bits, 128 codes |
Sort It: tick one box in each row
In ASCII, what does each code stand for?
| Statement | Upper case letter | Lower case letter | Digit character |
|---|---|---|---|
| 55 | |||
| 65 | |||
| 50 | |||
| 122 | |||
| 90 | |||
| 72 | |||
| 48 | |||
| 110 | |||
| 77 | |||
| 100 | |||
| 57 | |||
| 97 |
Answers
Round 1: Quiz Blitz
- 128 2 to the power 7 is 128, numbered 0 to 127.
- 90 Z is 25 letters after A: 65 + 25 = 90.
- 99 a 97, b 98, c 99.
- 55 48 + 7 = 55. The character '7' is not the number 7.
- Add 32 'A' is 65 and 'a' is 97: always 32 apart.
- False In a variable-width encoding, plain English costs the same as ASCII.
- It was displayed using a different character set Both ends must use the same character set.
- Arabic letters; Chinese characters ASCII was designed for English.
- A code that causes an action, such as a new line Carriage return is a control character: it does something rather than print a symbol.
- 256 8 bits give 2 to the power 8 = 256 codes.
- Because everybody agreed it would be A character set is an agreement, not a property of the machine.
- True So older ASCII files still open correctly.
Round 2: Quick Fire
- The code for '0' is 48, and the digits are in order
- Subtract 48 from the code: 55 - 48 = 7
Model answerThe digit characters are in order, starting with '0' at 48. So subtract 48 from the code: '7' has the code 55, and 55 - 48 = 7.
- Unicode represents far more characters, covering every language
- But it can use more bits per character, so more storage
Model answerUnicode represents far more characters than ASCII, over a million, covering every writing system, but it can use more bits per character, so text can take more storage.
- A character set gives each character an agreed code
- With a different set, the codes would show as the wrong characters
Model answerA character set gives each character an agreed code. If the other computer used a different set, the same codes would be shown as the wrong characters, such as boxes and question marks.
- Find its code, for example with CHAR_TO_CODE
- Add 32, then turn the new code back into a character
Model answerFind the letter's code with CHAR_TO_CODE, for example 65 for A. Add 32, then turn the new code back into a character with CODE_TO_CHAR: 97 is a.
Round 3: Big Think
- ASCII uses 7 bits, so it has only 128 codes
- ASCII was designed for English, with no Greek, Arabic or Chinese
- Unicode uses more bits, giving over a million codes
- The trade-off: more storage for characters outside the basic set
- Its first 128 codes match ASCII, so old files still work
Model answerASCII uses 7 bits, so it has only 128 codes, and it was designed for English: it has no codes for Greek, Arabic, Chinese or Hindi. Unicode uses more bits per character, giving room for over a million codes, enough for every writing system. The trade-off is size: characters outside the basic set take more bytes, so documents can need more storage. Its first 128 codes are the same as ASCII, so older files still open correctly.
- Letters are in sequence: 'A' is 65, 'B' is 66
- Lower case is always 32 more, so 'a' is 97
- '0' is 48
- So a digit's value is its code minus 48, such as 55 - 48 = 7
Model answerThe letters are in sequence: 'A' is 65, 'B' is 66, and so on. Lower case is always 32 more than upper case, so adding 32 to 65 gives 97, which is 'a'. The digit characters start at '0', which is 48, so a digit's value is its code minus 48: the character '7' is 55, and 55 - 48 = 7.
This or That
- No: '7' is code 55 That is why input must be cast before arithmetic.
- Unicode ASCII uses 7 or 8 bits. Unicode uses from 8 to 32.
- Carriage return A control character makes something happen rather than printing a symbol.
- 98 Lower case is always 32 more: 66 + 32 = 98.
- Unicode's first 128 codes match That was a deliberate design choice.
- The same space as ASCII The basic characters need only one byte each.
- 7 Extended ASCII uses 8.
- A menu written in Greek ASCII has no Greek letters.
Memory Match
- A 6 ASCII: 7 bits, 128 codes
- B 4 Extended ASCII: 8 bits, 256 codes
- C 2 Unicode: Over a million codes, every script
- D 1
'A': 65 - E 3
'Z': 90 - F 5
'0': 48
Sort It
- Digit character 55 55 is the character '7'.
- Upper case letter 65 65 is A, the first upper case letter.
- Digit character 50 50 is the character '2'.
- Lower case letter 122 122 is z: 90 + 32.
- Upper case letter 90 90 is Z, the last upper case letter.
- Upper case letter 72 72 is H.
- Digit character 48 48 is the character '0'.
- Lower case letter 110 110 is n.
- Upper case letter 77 77 is M.
- Lower case letter 100 100 is d.
- Digit character 57 57 is the character '9', the last digit.
- Lower case letter 97 97 is a: 65 + 32.