OCR A-Level Computer Science H446
Processors: Structure, Performance and Types
Input, Output and Storage
Systems Software
Applications Generation
Software Development
Types of Programming Language
Exchanging Data
Networks
Web Technologies
Data Types and Number Representation
Data Structures
Boolean Algebra
Legal, Moral, Cultural and Ethical Issues
Elements of Computational Thinking
Problem Solving and Programming
Algorithms
Data Types and Number Representation
Character sets: ASCII and Unicode
- 1 thing to know
- Component 01
Overview
Recall questions on character sets, standard and extended ASCII, control codes, working out codes and sorting by code, character digits versus numbers, why Unicode was needed, UTF-8, storage costs, and garbled text between machines.
What you need to know
Answer each one before you reveal it.
Questions from this subtopic
Each one with the model answer underneath.
- 1
What is a character set?
Model answer
An agreed table that maps every character to a unique binary code number. It lets text be stored and transmitted as numbers, and because the mapping is a published standard, a file written on one machine is read as the same characters on another. If two systems assume different character sets the same bytes come out as different symbols, which is why text can appear as garbage.
- 2
How many bits does standard ASCII use, and how many characters does that give?
Model answer
Seven bits, giving 2 to the power 7 = 128 different codes, numbered 0 to 127. In practice each character is stored in a whole byte with the eighth bit set to zero, or historically used as a parity bit for error detection.
- 3
What is extended ASCII?
Model answer
A version that uses all eight bits of the byte, giving 256 codes. The first 128 are the same as standard ASCII and the extra 128 hold additional symbols such as accented letters and box-drawing characters. The problem is that several incompatible versions of the upper half existed, so the same byte meant a different character depending on which national variant the machine was using.
- 4
What is in the first 32 codes of ASCII?
Model answer
Control characters rather than printable symbols. They are instructions to the receiving device, such as carriage return, line feed, tab, backspace and the bell. They date from teleprinters, and several are still in everyday use, since a text file's line endings are control characters.
- 5
The letter 'A' has ASCII code 65. What is the code for 'K', and how did you work it out without a table?
Model answer
75. The upper case letters are in alphabetical order with consecutive codes, and K is the eleventh letter, so it is ten places after A. 65 + 10 = 75. The same trick works for lower case, where 'a' is 97, and for digits, where the character '0' is 48.
- 6
Why is it useful that the ASCII codes for the letters run in an unbroken alphabetical sequence?
Model answer
It means text can be sorted alphabetically by comparing code numbers, with no lookup table needed, and it means you can test whether a character is a letter by checking whether its code lies between the codes for A and Z. It also makes arithmetic on characters meaningful, such as adding a fixed amount to shift a letter along the alphabet, which is how a Caesar cipher is implemented.
Other ways to work this
The same content, four other ways.
What is inside Levo
Six ways to work the same material.
Every question in Data Types and Number Representation, on a schedule.
Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.
Or £46 a year, about £3.83 a month. Cancel anytime.