Information Theory and Coding Basics

Which of the following correctly describes a variable-length code compared with a fixed-length code?

  1. AIt assigns codewords of the same length to every symbol, so there is no need to look for boundaries when decoding
  2. BIt assigns shorter codewords to less probable symbols to shorten the average code length
  3. CIt assigns shorter codewords to more probable symbols to shorten the average code length
Show answer and explanation

Answer: C. It assigns shorter codewords to more probable symbols to shorten the average code length

A variable-length code assigns short codewords to frequent symbols and long ones to rare symbols, shortening the average number of bits per symbol (the average code length). Morse code representing E, the most common letter in English, with a single dot follows the same idea. In exchange, the codewords are not all the same length, so the code is built to satisfy a condition such as being a prefix code, so that the boundaries can be determined in only one way.

  • A. This describes a fixed-length code. A fixed-length code has fixed boundaries, but it cannot exploit skewed symbol probabilities.
  • B. It is the other way round. Making rare symbols short and frequent symbols long actually lengthens the average code length.
  • C. Correct. It exploits skewed probabilities to shorten the average code length.
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 sets of codewords assigned to four symbols is a prefix code (a code in which no codeword is the beginning of another codeword)?
  2. 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?
  3. 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?
  4. 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?
  5. A source emits the symbols A, B, C and D independently with probabilities 0.4, 0.3, 0.2 and 0.1, and it is encoded with a Huffman code. Which of the following is the average code length per symbol?