Information Theory and Coding Basics

The 36 characters made up of the 26 capital letters and the 10 digits are to be distinguished by bit strings all of the same length (a fixed-length code). Which of the following is the minimum number of bits needed per character?

  1. A5 bits
  2. B6 bits
  3. C36 bits
Show answer and explanation

Answer: B. 6 bits

n bits can distinguish 2ⁿ cases, so we need the smallest n with 2ⁿ ≥ 36. 2⁵ = 32 is not enough and 2⁶ = 64 is, so the answer is 6 bits. It is also log₂ 36 ≈ 5.17 rounded up to a whole number.

  • A. 5 bits can distinguish only 2⁵ = 32 cases, too few for 36 characters.
  • B. Correct. 2⁶ = 64 ≥ 36.
  • C. 36 bits is the case where each character gets its own bit and exactly one bit is 1 (one-hot), which is not the minimum.
Practice this topic Back to topic

Books on Information Theory and Coding Basics Ad

As an Amazon Associate I earn from qualifying purchases.

More Information Theory and Coding Basics questions

  1. Which of the following correctly describes a variable-length code compared with a fixed-length code?
  2. Which of the following sets of codewords assigned to four symbols is a prefix code (a code in which no codeword is the beginning of another codeword)?
  3. A prefix code assigns the codewords A = 0, B = 10, C = 110 and D = 111 to the symbols A, B, C and D. Which of the following is the result of decoding the bit string 110100111 from the start?
  4. A binary prefix code is to be built by assigning codewords of the following lengths (numbers of bits) to the four symbols A to D. Which of the following sets of code lengths makes this possible?
  5. A binary prefix code is being built, and the length-2 codewords 00 and 01 are already in use. Which of the following is the maximum number of length-3 codewords that can be added while keeping the prefix condition?