Question bank › GCSE › GCSE Computer Science › Fundamentals of data representation

Character encoding: ASCII & Unicode

10 questions40 marksabout 50 min

Answer on paper first, then reveal the mark scheme one mark at a time.

1Grade 4–54 marks

(a) State how many bytes there are in 3 kilobytes. [1]

(b) In ASCII the character 'D' is represented by the denary code 68. State the denary ASCII code for 'H'. [1]

(c) Explain one advantage of using Unicode instead of ASCII. [2]

2Grade 1–34 marks

Part of the ASCII character set is shown in the table.

CharacterDenary code7-bit binary
A651000001
B661000010
C671000011

(a) Define the term character set. [1]

(b) Using the table, write the word CAB as a sequence of 7-bit ASCII codes in binary. [2]

(c) State the number of bits used to store the word CAB in 7-bit ASCII. [1]

3Grade 1–33 marks

In ASCII, the lower-case letter a has the denary code 97. Letter codes are grouped together and are sequential.

(a) State the denary ASCII code for the lower-case letter f. [1]

(b) Convert the code for f to a 7-bit binary number. [1]

(c) The upper-case letter F has the denary code 70. State the difference between the codes for f and F. [1]

Stuck on Character encoding: ASCII & Unicode?

Get it sorted in a free 30-minute session

We work through your weakest questions on this topic on Zoom. I reply the same day.

4Grade 4–53 marks

A message has been stored as three 7-bit ASCII codes. The bit patterns are shown in the diagram, one character per row.

Part of the ASCII table is given: H = 72, e = 101, y = 121.

(a) Convert the bit pattern in row 1 to denary. [1]

(b) State the message that the three rows represent. [1]

(c) Explain why a program receiving these codes needs to know that they are ASCII rather than, for example, three 7-bit unsigned integers. [1]

110010002110010131111001
5Grade 4–54 marks

The original ASCII character set uses 7 bits per character.

(a) Calculate the maximum number of different characters that can be represented using 7-bit ASCII. [1]

(b) A software company wants its app to display text in Japanese, which uses several thousand different characters. Explain why 7-bit ASCII is not suitable for this. [2]

(c) State the name of a character set that the company could use instead. [1]

6Grade 4–54 marks

The following AQA pseudocode uses the built-in functions CHAR_TO_CODE (returns the ASCII code of a character) and CODE_TO_CHAR (returns the character with a given ASCII code).

word ← 'bed'
result ← ''
FOR i ← 0 TO LEN(word) - 1
   code ← CHAR_TO_CODE(word[i]) + 3
   result ← result + CODE_TO_CHAR(code)
ENDFOR
OUTPUT result

The ASCII code for a is 97.

(a) State the value of code the first time the line code ← CHAR_TO_CODE(word[i]) + 3 is executed. [1]

(b) State the output of the program. [1]

(c) Explain why the program would not output a letter for every character if word were changed to 'xyz'. [2]

7Grade 6–74 marks

In ASCII the digit characters are grouped together: '0' has the denary code 48, '1' has 49, and so on.

A program reads one keypress from a user as a character and needs to use it as a number.

(a) State the denary ASCII code for the character '7'. [1]

(b) The program uses the expression CHAR_TO_CODE(key) - 48. Explain how this expression converts a digit character into its integer value. [2]

(c) A student instead writes CHAR_TO_CODE('7') + CHAR_TO_CODE('2'), expecting the answer 9. State the value this expression actually gives. [1]

8Grade 6–75 marks

A text message contains 120 characters. It can be stored using 7-bit ASCII or using a 16-bit Unicode encoding.

(a) Calculate the size of the message in bytes when stored in 7-bit ASCII. [2]

(b) Calculate how many more bits are needed to store the message in 16-bit Unicode than in 7-bit ASCII. [2]

(c) Give one reason why a developer might still choose Unicode for the message despite the larger file size. [1]

9Grade 6–74 marks

A program sorts a list of words into ascending order by comparing the ASCII codes of their characters, one position at a time.

Before sorting the list is:

apple, Zebra, mango, Banana

Upper-case letters have ASCII codes 65–90 and lower-case letters have codes 97–122.

(a) Write the list in the order the program produces. [2]

(b) Explain why Zebra appears before apple in the sorted list, even though Z comes after a in the alphabet. [2]

10Grade 8–95 marks

A word processor saves documents using Unicode. A user opens an old text file that was saved using 7-bit ASCII. The file contains only English letters, digits and punctuation, and it opens correctly with every character displayed as intended.

(a) Explain why the ASCII file opens correctly in the Unicode-based word processor. [2]

(b) The user adds the character é, which has the Unicode code 233, and saves the document. State, with a reason, whether this document could be saved correctly in 7-bit ASCII. [2]

(c) Describe one disadvantage of storing a document that contains only English text in Unicode rather than ASCII. [1]

Stuck on this topic?

Book a free 30-minute session on WhatsApp and we'll find exactly which step is costing you the marks. Or build a timed paper on it.

Free 30-minute session