Unit 9: Huffman Coding and Data Compression - Practice Quiz

ECAP538 60 Questions
0 Correct 0 Wrong 60 Left
0/60

1 What is the main purpose of Huffman coding?

Huffman coding Easy
A. To compress data without losing information
B. To detect errors during transmission
C. To sort data into ascending order
D. To encrypt data using secret keys

2 Which type of algorithm is used to construct a Huffman tree?

Huffman coding Easy
A. Backtracking algorithm
B. Divide-and-conquer algorithm
C. Dynamic programming algorithm
D. Greedy algorithm

3 Which symbols are combined first while constructing a Huffman tree?

Huffman coding Easy
A. The first two input symbols
B. The last two input symbols
C. The two most frequent symbols
D. The two least frequent symbols

4 In a Huffman tree, where are the original symbols normally stored?

Huffman coding Easy
A. In the tree edges
B. In the internal nodes
C. In the leaf nodes
D. In the root node

5 What determines the length of a symbol's Huffman code?

Huffman coding Easy
A. Its order in the alphabet
B. Its position in the input file
C. Its numerical character value
D. Its depth in the Huffman tree

6 Which symbols generally receive shorter Huffman codes?

Huffman coding Easy
A. Symbols that occur at the end
B. Symbols that appear only once
C. Symbols that occur more frequently
D. Symbols that occur less frequently

7 What does it mean that Huffman codes are prefix-free?

Huffman coding Easy
A. No code contains repeated binary digits
B. No code is a prefix of another code
C. Every code starts with the same bit
D. Every code has an equal number of bits

8 Which data structure is commonly used to select the two least frequent nodes in Huffman coding?

Huffman coding Easy
A. A minimum-priority queue
B. A maximum-priority queue
C. A simple hash table
D. A last-in-first-out stack

9 When two Huffman nodes with frequencies and are merged, what is the new node's frequency?

Huffman coding Easy
A.
B.
C.
D.

10 What values are typically assigned to the two branches of a binary Huffman tree?

Huffman coding Easy
A. and
B. and
C. and
D. and

11 How is a Huffman-encoded symbol normally decoded?

Huffman coding Easy
A. By following bits from a leaf to the root
B. By reversing every group of encoded bits
C. By sorting all symbols by their names
D. By following bits from the root to a leaf

12 What kind of code length does Huffman coding use for different symbols?

Huffman coding Easy
A. Decimal-only codewords
B. Fixed-length codewords
C. Zero-length codewords
D. Variable-length codewords

13 What is the general goal of data compression?

Data compression problems Easy
A. To remove every repeated character
B. To increase the number of stored files
C. To reduce the number of bits used
D. To convert all data into text

14 Which type of compression allows the original data to be reconstructed exactly?

Data compression problems Easy
A. Lossless compression
B. Analog compression
C. Partial compression
D. Lossy compression

15 Which type of compression may permanently discard some information?

Data compression problems Easy
A. Prefix compression
B. Lossless compression
C. Binary compression
D. Lossy compression

16 Which type of compression is generally required for executable program files?

Data compression problems Easy
A. Approximate compression
B. Lossy compression
C. Lossless compression
D. Visual compression

17 An original file has size bytes and its compressed form has size bytes. How many bytes are saved?

Data compression problems Easy
A. bytes
B. bytes
C. bytes
D. bytes

18 What is redundancy in the context of data compression?

Data compression problems Easy
A. Information damaged during transmission
B. Information protected by a password
C. Information arranged in random order
D. Information represented more than necessary

19 Which simple compression method replaces consecutive repeated values with a value and its count?

Data compression problems Easy
A. Selection sort encoding
B. Run-length encoding
C. Parity-check encoding
D. Binary search encoding

20 What is decompression?

Data compression problems Easy
A. Encrypting data before it is stored
B. Deleting data after it has been transmitted
C. Dividing a file into equal-sized blocks
D. Reconstructing data from its compressed form

21 A source has symbol frequencies , , , , , and . What is the average code length of an optimal binary Huffman code?

Huffman coding Medium
A. bits per symbol
B. bits per symbol
C. bits per symbol
D. bits per symbol

22 For symbol frequencies , , , and , which sequence of combined weights is produced by Huffman's algorithm?

Huffman coding Medium
A.
B.
C.
D.

23 Given the prefix codes , , , and , what does the bit string decode to?

Huffman coding Medium
A.
B.
C.
D.

24 Which set of binary codewords satisfies the prefix-free property required for Huffman decoding?

Huffman coding Medium
A.
B.
C.
D.

25 A canonical Huffman code assigns lengths to symbols in that order. If , what is the canonical code for ?

Huffman coding Medium
A.
B.
C.
D.

26 A binary source has probabilities , , , and . A Huffman code gives corresponding lengths , , , and . What is its expected code length?

Huffman coding Medium
A. bits per symbol
B. bits per symbol
C. bits per symbol
D. bits per symbol

27 Symbols occur times, respectively. How many bits are needed to encode all symbols using an optimal binary Huffman code?

Huffman coding Medium
A. bits
B. bits
C. bits
D. bits

28 Eight symbols have equal nonzero frequencies. What codeword length will each symbol have in an optimal binary Huffman code?

Huffman coding Medium
A. bits
B. bits
C. bits
D. bits

29 A symbol with probability has code length , while a symbol with probability has code length . By how much does their combined expected contribution decrease if their codewords are swapped?

Huffman coding Medium
A. bits per symbol
B. bits per symbol
C. bits per symbol
D. bits per symbol

30 A file contains symbols drawn from six symbols with frequencies . Its Huffman payload uses bits, and storing the tree requires bits. Compared with a fixed-length code, how many bits are saved overall?

Huffman coding Medium
A. bits
B. bits
C. bits
D. bits

31 Using compression ratio defined as original size divided by compressed size, what is the ratio when a KB file is compressed to KB?

Data compression problems Medium
A.
B.
C.
D.

32 A MB file is reduced to MB. What percentage of the original storage space is saved?

Data compression problems Medium
A.
B.
C.
D.

33 What is the Shannon entropy of a source with symbol probabilities , , , and ?

Data compression problems Medium
A. bits per symbol
B. bits per symbol
C. bits per symbol
D. bits per symbol

34 The string AAAAABBBCCCCCCCC is stored using bits per character. Run-length encoding stores each run as an -bit character and an -bit count. How many bits are saved?

Data compression problems Medium
A. bits
B. bits
C. bits
D. bits

35 A compressor reduces a -byte file payload to bytes but adds bytes of metadata. What is the overall percentage reduction?

Data compression problems Medium
A.
B.
C.
D.

36 A source uses an alphabet of eight symbols. Fixed-length coding requires bits per symbol, while a variable-length code averages bits. How many bits are saved over symbols?

Data compression problems Medium
A. bits
B. bits
C. bits
D. bits

37 A file contains both long repeated substrings and uneven token frequencies. Which compression pipeline most directly exploits both properties?

Data compression problems Medium
A. Apply run-length coding without entropy coding
B. Apply Huffman coding before LZ77
C. Apply LZ77 before Huffman coding
D. Apply fixed-length coding before LZ77

38 An -megabit file is sent over a Mbps link. Compression has a ratio of and adds seconds of total processing time. How much time is saved compared with sending the original file?

Data compression problems Medium
A. seconds
B. seconds
C. seconds
D. seconds

39 A source has entropy bits per symbol, while a lossless code uses an average of bits per symbol. What is the code's redundancy above the entropy?

Data compression problems Medium
A. bits per symbol
B. bits per symbol
C. bits per symbol
D. bits per symbol

40 A run-length encoder represents each run using an -bit symbol and an -bit count. The uncompressed representation uses bits per symbol. What is the minimum run length that produces a strict size reduction?

Data compression problems Medium
A. symbols
B. symbols
C. symbols
D. symbols

41 A source has symbol frequencies . What weighted external path length and average codeword length result from binary Huffman coding?

Huffman coding Hard
A. and bits
B. and bits
C. and bits
D. and bits

42 Equal weights can allow several choices during Huffman construction. Which property is guaranteed across all valid tie-breaking choices?

Huffman coding Hard
A. They assign the same length to every symbol
B. They produce exactly the same tree shape
C. They produce the same optimal weighted path length
D. They assign identical bit strings to tied symbols

43 A full -ary Huffman code must be constructed for positive-frequency symbols. How many zero-frequency dummy symbols must be added before repeatedly merging four nodes?

Huffman coding Hard
A. dummy symbols
B. dummy symbol
C. dummy symbols
D. dummy symbols

44 A canonical binary Huffman code uses symbol order and codeword lengths , respectively. If the first codeword is the lexicographically smallest possible one, what is the codeword for ?

Huffman coding Hard
A.
B.
C.
D.

45 A length-limited binary prefix code is required for symbols, with every codeword having length at most . Which conclusion is correct regardless of the symbol probabilities?

Huffman coding Hard
A. It exists only for dyadic probabilities
B. It is impossible for ten distinct symbols
C. It is possible using an incomplete prefix tree
D. It exists if two symbols share a codeword

46 For a binary source with probabilities , what are the entropy and optimal Huffman average length?

Huffman coding Hard
A. and bits
B. and bits
C. and bits
D. and bits

47 An -byte file is originally stored using bits. Huffman compression averages bits per byte, but its frequency-table header costs bits. What is the smallest integer for which the compressed representation is strictly smaller?

Data compression problems Hard
A.
B.
C.
D.

48 A source has probabilities , and all five symbols must receive distinct finite binary prefix codewords. What is the minimum expected codeword length?

Huffman coding Hard
A. bits
B. bit
C. bits
D. bits

49 Which statement correctly expresses the sibling property used in the proof of binary Huffman coding optimality?

Huffman coding Hard
A. Some optimal tree has two least-weight symbols as deepest siblings
B. Every optimal tree gives all minimum-weight symbols equal depths
C. Some optimal tree places the largest weights as deepest siblings
D. Every optimal tree has a unique pair of deepest sibling leaves

50 A single bit is deleted from a stream encoded with an arbitrary binary Huffman code. What recovery property follows solely from the prefix-free condition?

Data compression problems Hard
A. No bounded resynchronization time is guaranteed
B. Only the symbol containing the deletion is corrupted
C. Decoding resumes correctly after one codeword
D. Decoding resumes within the maximum codeword length

51 Two blocks each contain symbols. The first has counts , and the second has counts . Ignoring headers, compare separate binary Huffman coding of the blocks with one global Huffman code.

Data compression problems Hard
A. Separate uses bits; global uses bits
B. Separate uses bits; global uses bits
C. Separate uses bits; global uses bits
D. Separate uses bits; global uses bits

52 A memoryless binary source has probabilities . Why can arithmetic coding of a long sequence substantially outperform symbol-by-symbol binary Huffman coding?

Data compression problems Hard
A. Huffman coding requires two bits for each binary source symbol
B. Huffman coding cannot represent probabilities that are not dyadic
C. Arithmetic coding assigns a zero-length word to probability
D. Arithmetic coding approaches bits per symbol

53 Binary Huffman coding is applied to frequencies . Which symbols receive the maximum codeword length, and what is that length?

Huffman coding Hard
A. Frequencies and , with length
B. Frequencies and , with length
C. Frequencies and , with length
D. Frequencies and , with length

54 Can a binary prefix code have codeword lengths ?

Huffman coding Hard
A. Yes, because the maximum length is only
B. Yes, because the lengths are nondecreasing
C. No, because every length must occur twice
D. No, because the Kraft sum is

55 For positive-frequency symbols, what is the largest possible depth of a leaf in a binary Huffman tree, considering all possible frequency distributions?

Huffman coding Hard
A.
B.
C.
D.

56 Consider frequency sequences and , whose symbols have the same initial frequency ordering. Which conclusion is correct?

Huffman coding Hard
A. Their depth assignments can differ because merged sums matter
B. Their Huffman depth assignments must be identical
C. Their tree shapes differ only through exchanging left and right
D. Their weighted path lengths must be equal after normalization

57 An unconstrained Huffman tree violates a required maximum codeword length . Which method correctly obtains an optimal binary length-limited prefix code?

Huffman coding Hard
A. Discard symbols whose unconstrained lengths exceed
B. Apply the package-merge algorithm to the weights
C. Truncate every codeword longer than
D. Balance only the deepest subtree after coding

58 Why can no lossless compressor map every -bit input to a distinct binary output shorter than bits?

Data compression problems Hard
A. Every lossless compressor must preserve the input's Hamming weight
B. Entropy is exactly bits for every individual input string
C. Prefix-free output requires every compressed string to have length
D. There are only binary strings shorter than bits

59 An i.i.d. source has entropy bits per symbol. Binary Huffman coding is applied to length- source blocks. Which bound holds for the average encoded length per source symbol?

Data compression problems Hard
A.
B.
C.
D.

60 Let be an equiprobable binary variable and let , where is independent with . If both encoder and decoder know , what asymptotic lossless compression rate is achievable for ?

Data compression problems Hard
A. bits per symbol
B. bits per symbol
C. bit per symbol
D. bits per symbol