Back to the topic

The mark scheme starts on a new page, so you can print pages one and two for a student and keep the last page yourself. Everything prints in black on white whichever theme you are using.

AQA GCSE CS · 3.3.4

Character Encoding

Section A: 10 multiple choice questions, 10 marks. Section B: 4 written questions, 11 marks. Total 21 marks.

Name

Class

Date

Mark  / 21

Section A

Circle the letter of the correct answer. One mark each.

  1. 1How many different characters can a 7 bit character set represent?1
    1. A64
    2. B127
    3. C128
    4. D256
  2. 2If 'A' has the code 65, what is the code for 'D'?1
    1. A67
    2. B68
    3. C69
    4. D97
  3. 3If 'A' is 65 and 'a' is 97, what is the difference between an upper case and lower case code?1
    1. A16
    2. B26
    3. C32
    4. D64
  4. 4What is the main advantage of Unicode over ASCII?1
    1. AIt uses fewer bits per character
    2. BIt compresses text automatically
    3. CIt stores images as well as text
    4. DIt can represent characters from a far wider range of languages
  5. 5What is the main disadvantage of Unicode compared with ASCII?1
    1. AIt cannot represent English letters
    2. BCharacters outside the basic set need more bits, so files can be larger
    3. CIt is not supported by modern computers
    4. DIt cannot be used on the internet
  6. 6Why can the same file appear as the wrong characters on a different computer?1
    1. AThe characters were stored as images
    2. BThe file size was calculated wrongly
    3. CThe file has been compressed
    4. DThe two computers are using different character sets
  7. 7What is actually stored when a computer saves the letter K?1
    1. AThe position of K in the alphabet as a shape
    2. BA small picture of the letter K
    3. CThe word K in plain text
    4. DThe binary code the character set assigns to K
  8. 8If '0' has the code 48, how would a program get the numeric value of a digit character?1
    1. AMultiply the code by 10
    2. BSubtract 48 from its character code
    3. CDivide the code by 8
    4. DAdd 48 to its character code
  9. 9What is a control character?1
    1. AA code that causes an action such as a new line rather than printing a symbol
    2. BA character used to control the CPU
    3. CThe first character of every file
    4. DA character that can only be typed with the control key
  10. 10Why are the first 128 Unicode codes the same as ASCII?1
    1. ASo that existing ASCII text remains valid and readable
    2. BBecause Unicode is a kind of ASCII
    3. CBecause 128 is the maximum any character set can hold
    4. DTo save memory when storing Chinese characters

Section B

Answer in the space provided. The number of marks tells you how many separate points to make.

  1. 1StateState what is meant by a character set.1
  2. 2CalculateA character set uses 8 bits per character. Calculate how many different characters it can represent.2
  3. 3ExplainExplain one advantage and one disadvantage of using Unicode rather than ASCII.4
  4. 4ExplainA program reads the character '9' from a keyboard and adds 1 to it, expecting 10. Explain why this does not work and how it should be corrected.4

Mark scheme

Section A

1C2B3C4D5B6D7D8B9A10A

Section B

1 State what is meant by a character set. 1

One mark for each of the following, to a maximum of 1.

  • An agreed set of codes giving every character a unique binary value

Model answer. A character set is an agreed table that gives every character a unique binary code, so that text can be stored and exchanged as numbers.

2 A character set uses 8 bits per character. Calculate how many different characters it can represent. 2

One mark for each of the following, to a maximum of 2.

  • Shows that the number of combinations is 2 to the power of the number of bits
  • Gives 256

Model answer. Each bit can be 0 or 1, so eight bits give 2 multiplied by itself eight times, which is 2 to the power 8. That is 256, so the character set can represent 256 different characters, numbered 0 to 255.

3 Explain one advantage and one disadvantage of using Unicode rather than ASCII. 4

One mark for each of the following, to a maximum of 4.

  • Unicode can represent far more characters
  • So it supports languages and symbols ASCII has no codes for
  • Unicode uses more bits per character for characters outside the basic set
  • So files can take more storage and take longer to transmit

Model answer. The advantage is coverage. Unicode has room for well over a million codes, so it can represent Chinese, Arabic, Greek, mathematical symbols and emoji, none of which ASCII has any code for at all. That makes it possible to store and exchange text in any language rather than only in English. The disadvantage is size. Characters outside the basic Latin set need more than one byte, so a document containing them takes more storage and more bandwidth to send than the equivalent ASCII file would, if ASCII could represent it at all.

4 A program reads the character '9' from a keyboard and adds 1 to it, expecting 10. Explain why this does not work and how it should be corrected. 4

One mark for each of the following, to a maximum of 4.

  • The keyboard returns the character '9', not the number 9
  • The character is stored as its character code, for example 57
  • Adding 1 either produces the next character or joins values rather than adding them
  • The character must be converted to an integer first, for example with STRING_TO_INT

Model answer. What arrives from the keyboard is the character '9', which is stored as its character set code rather than as the value nine. In ASCII that code is 57. Adding one to it therefore gives 58, which is the code for a colon, or in a language that treats the value as a string it joins the two values rather than adding them. Either way the result is not ten. The correction is to convert the character to an integer before doing arithmetic, for example value ← STRING_TO_INT(input), after which adding one gives ten as intended.