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 sort data into ascending order
C. To detect errors during transmission
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. Dynamic programming algorithm
C. Divide-and-conquer algorithm
D. Greedy algorithm

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

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

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

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

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

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

6 Which symbols generally receive shorter Huffman codes?

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

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

Huffman coding Easy
A. Every code starts with the same bit
B. No code contains repeated binary digits
C. No code is a prefix of another code
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 simple hash table
B. A maximum-priority queue
C. A minimum-priority queue
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 sorting all symbols by their names
B. By following bits from the root to a leaf
C. By reversing every group of encoded bits
D. By following bits from a leaf to the root

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

Huffman coding Easy
A. Fixed-length codewords
B. Zero-length codewords
C. Decimal-only 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. Lossy compression
B. Partial compression
C. Lossless compression
D. Analog compression

15 Which type of compression may permanently discard some information?

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

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

Data compression problems Easy
A. Approximate compression
B. Lossless compression
C. Lossy 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 arranged in random order
B. Information protected by a password
C. Information damaged during transmission
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. Parity-check encoding
B. Selection sort encoding
C. Run-length encoding
D. Binary search encoding

20 What is decompression?

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

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 fixed-length coding before LZ77
C. Apply LZ77 before Huffman coding
D. Apply Huffman 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 identical bit strings to tied symbols
B. They produce exactly the same tree shape
C. They produce the same optimal weighted path length
D. They assign the same length to every symbol

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 is possible using an incomplete prefix tree
B. It exists if two symbols share a codeword
C. It exists only for dyadic probabilities
D. It is impossible for ten distinct symbols

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. Every optimal tree gives all minimum-weight symbols equal depths
B. Some optimal tree places the largest weights as deepest siblings
C. Some optimal tree has two least-weight symbols 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. Decoding resumes correctly after one codeword
C. Decoding resumes within the maximum codeword length
D. Only the symbol containing the deletion is corrupted

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. Arithmetic coding assigns a zero-length word to probability
B. Huffman coding cannot represent probabilities that are not dyadic
C. Arithmetic coding approaches bits per symbol
D. Huffman coding requires two bits for each binary source 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. No, because every length must occur twice
B. Yes, because the lengths are nondecreasing
C. Yes, because the maximum length is only
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 weighted path lengths must be equal after normalization
C. Their Huffman depth assignments must be identical
D. Their tree shapes differ only through exchanging left and right

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. Apply the package-merge algorithm to the weights
B. Truncate every codeword longer than
C. Balance only the deepest subtree after coding
D. Discard symbols whose unconstrained lengths exceed

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

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

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