Question bank › A-level › A-level Computer Science › Fundamentals of data representation

Character coding (ASCII, Unicode) and error checking

10 questions53 marksabout 65 min

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

1Standard6 marks

(a) A byte uses even parity, with the most significant bit as the parity bit and the 7-bit ASCII code for 'C' (1000011) in the other bits. State the byte stored. [1]

(b) The byte 10110010 is received. A student says: "Even parity checking passed, so the byte must be correct." Explain why the student may be wrong. [2]

(c) The first 12 digits of an ISBN-13 are 978140883219. Calculate the check digit. Digits are multiplied alternately by 1 and 3 starting with 1, the products are summed, and the check digit makes the total a multiple of 10. [3]

2Core4 marks

A program reads the number 42 typed by a user at the keyboard. The ASCII code for the character '0' is 48 in denary, and the digits '0' to '9' have consecutive codes.

(a) Give the 8-bit pure binary representation of the number 42. [1]

(b) Give the two 8-bit bit patterns used to store the characters '4' and '2' in ASCII (with a leading 0). [2]

(c) Explain why the program should convert the input to pure binary before adding 42 to another number. [1]

3Core5 marks

A messaging app originally stored text using 7-bit ASCII, held in one byte per character. It is being updated to store text using a 16-bit Unicode encoding (two bytes per character).

(a) Explain why Unicode was introduced when ASCII already existed. [2]

(b) A message of 1500 characters is stored. Calculate how many more bytes are needed to store it in the 16-bit Unicode encoding than in ASCII. [2]

(c) The first 128 Unicode code points represent the same characters as ASCII. State one advantage of this. [1]

Stuck on Character coding (ASCII, Unicode) and error checking?

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.

4Standard5 marks

In ASCII, the character 'A' has the code 65 in denary and the upper-case letters have consecutive codes. Each lower-case letter has a code exactly 32 greater than its upper-case equivalent.

(a) Give the 7-bit ASCII code for 'K' in binary. [1]

(b) Give the 7-bit ASCII code for 'k' in binary and explain how a program could convert 'K' to 'k' by changing just one bit. [2]

(c) A subroutine converts every character in a string to upper case by subtracting 32 from its code. It is given the string "c3". Explain why the output is not what the programmer intended and how the subroutine should be corrected. [2]

5Standard5 marks

A radio link uses majority voting: each bit of data is transmitted three times in a row. The receiver reads the following 24 bits, shown in groups of three:

111 000 110 000 000 111 011 000

(a) Write down the 8-bit data byte the receiver decodes. [2]

(b) State how many of the groups contained an error. [1]

(c) Describe a situation in which majority voting would decode a bit incorrectly. [1]

(d) State one disadvantage of majority voting compared with using a single parity bit. [1]

6Standard5 marks

Four bytes are received. Each holds a 7-bit ASCII code in the 7 least significant bits, with an odd parity bit as the most significant bit.

ByteReceived
111001110
201001101
300110111
410100000

(a) Identify which bytes have been received with an error. Justify your answer. [2]

(b) The ASCII code for 'A' is 65. Using this, state the character stored in byte 1. [1]

(c) Explain why the receiver cannot correct the errors you identified using the parity bits alone, and state what the receiver would do instead. [2]

7Hard5 marks

A protocol sends data in packets. Each packet contains five data bytes followed by a one-byte checksum, calculated as the sum of the five data values modulo 256.

A packet is to contain the denary values: 87, 201, 64, 150, 33

(a) Calculate the checksum, showing your working. [2]

(b) The receiver gets the data 87, 201, 66, 150, 33 with the checksum you calculated. Show how the receiver detects that an error has occurred. [1]

(c) In a different packet, the second and third bytes arrive in the wrong order: 87, 64, 201, 150, 33. Explain why this checksum does not detect the error, and suggest a change to the checksum calculation that would. [2]

8Hard6 marks

A warehouse uses 7-digit product codes. The first six digits identify the product; the seventh is a check digit calculated as follows:

  • multiply the six digits by the weights 7, 6, 5, 4, 3, 2 respectively and add the products;
  • find the remainder when the total is divided by 11;
  • the check digit is 11 minus this remainder (a result of 11 becomes 0, and 10 is written as X).

A valid code satisfies: (weighted sum of the first six digits) + (check digit × 1) is exactly divisible by 11.

(a) Calculate the check digit for the product number 403917. Show your working. [3]

(b) A clerk keys in the code with the third and fourth digits swapped: 409317 followed by your check digit. Show that the error is detected. [2]

(c) Explain why passing the check-digit test does not guarantee that the correct product has been entered. [1]

9Hard6 marks

Four 7-bit ASCII characters are sent as a block. An even parity bit (P) is added to each byte, and a parity byte is added in which each bit gives even parity for its column. The block received is shown in the diagram. A single bit has been corrupted in transmission.

(a) Identify the byte and the column containing the corrupted bit. Explain how you located it. [2]

(b) The ASCII code for 'A' is 65. State the corrected 7-bit code in Byte 2 and the character it represents. [2]

(c) Explain why this method could detect, but not correct, two bits corrupted in the same byte. [2]

b6b5b4b3b2b1b0PByte 110000100Byte 210010010Byte 310101001Byte 410001011Parity byte00010100Even parity on every row and every column (P = row parity bit)
10Stretch6 marks

A rover on Mars sends a log of 4000 characters to Earth. Each character is a 7-bit ASCII code. A one-way signal between Mars and Earth can take over 20 minutes.

The engineers are considering two methods:

  • Method A: add one parity bit to each character;
  • Method B: majority voting, sending every bit three times.

(a) Calculate the total number of bits transmitted using Method B. [1]

(b) Calculate the percentage increase in the number of bits transmitted when Method A is used, compared with sending the 7-bit codes with no error checking. Give your answer to 1 decimal place. [2]

(c) Evaluate which method is more suitable for this link. [3]

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