Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.
You're offline
Unit 9 MCQsHuffman Coding and Data Compression
ECAP538 ·
60 questions. Pick an option to check it.
Answer: To compress data without losing information
Huffman coding is a lossless compression technique that represents frequent symbols with shorter codes.
Question 2 of 60 · Huffman coding · Easy
Which type of algorithm is used to construct a Huffman tree?
Not quite. Try another option.
Answer: Greedy algorithm
Huffman coding uses a greedy strategy by repeatedly combining the two least frequent nodes.
Question 3 of 60 · Huffman coding · Easy
Which symbols are combined first while constructing a Huffman tree?
Not quite. Try another option.
Answer: The two least frequent symbols
The Huffman algorithm repeatedly merges the two symbols or nodes having the lowest frequencies.
Question 4 of 60 · Huffman coding · Easy
In a Huffman tree, where are the original symbols normally stored?
Not quite. Try another option.
Answer: In the leaf nodes
Each leaf node represents one original symbol and its path determines the symbol's code.
Question 5 of 60 · Huffman coding · Easy
What determines the length of a symbol's Huffman code?
Not quite. Try another option.
Answer: Its depth in the Huffman tree
The code consists of the edge labels on the root-to-leaf path, so its length equals the leaf's depth.
Question 6 of 60 · Huffman coding · Easy
Which symbols generally receive shorter Huffman codes?
Not quite. Try another option.
Answer: Symbols that occur more frequently
Frequently occurring symbols are placed closer to the root and therefore receive shorter codes.
Question 7 of 60 · Huffman coding · Easy
What does it mean that Huffman codes are prefix-free?
Not quite. Try another option.
Answer: No code is a prefix of another code
The prefix-free property allows encoded data to be decoded unambiguously without separators.
Question 8 of 60 · Huffman coding · Easy
Which data structure is commonly used to select the two least frequent nodes in Huffman coding?
Not quite. Try another option.
Answer: A minimum-priority queue
A minimum-priority queue efficiently removes the two nodes with the smallest frequencies.
Question 9 of 60 · Huffman coding · Easy
When two Huffman nodes with frequencies and are merged, what is the new node's frequency?
Not quite. Try another option.
Answer:
A merged node receives the sum of its children's frequencies: .
Question 10 of 60 · Huffman coding · Easy
What values are typically assigned to the two branches of a binary Huffman tree?
Not quite. Try another option.
Answer: and
The two branches are labeled and to produce binary codewords.
Question 11 of 60 · Huffman coding · Easy
How is a Huffman-encoded symbol normally decoded?
Not quite. Try another option.
Answer: By following bits from the root to a leaf
Starting at the root, the decoder follows the branch indicated by each bit until it reaches a leaf.
Question 12 of 60 · Huffman coding · Easy
What kind of code length does Huffman coding use for different symbols?
Not quite. Try another option.
Answer: Variable-length codewords
Huffman coding assigns codewords of different lengths based on symbol frequencies.
Question 13 of 60 · Data compression problems · Easy
What is the general goal of data compression?
Not quite. Try another option.
Answer: To reduce the number of bits used
Data compression represents information using fewer bits, reducing storage or transmission requirements.
Question 14 of 60 · Data compression problems · Easy
Which type of compression allows the original data to be reconstructed exactly?
Not quite. Try another option.
Answer: Lossless compression
Lossless compression preserves all information, allowing exact recovery of the original data.
Question 15 of 60 · Data compression problems · Easy
Which type of compression may permanently discard some information?
Not quite. Try another option.
Answer: Lossy compression
Lossy compression reduces size by discarding some information that cannot be restored exactly.
Question 16 of 60 · Data compression problems · Easy
Which type of compression is generally required for executable program files?
Not quite. Try another option.
Answer: Lossless compression
Executable files must be reconstructed exactly, so lossless compression is required.
Question 17 of 60 · Data compression problems · Easy
An original file has size bytes and its compressed form has size bytes. How many bytes are saved?
Not quite. Try another option.
Answer: bytes
The saved space is bytes.
Question 18 of 60 · Data compression problems · Easy
What is redundancy in the context of data compression?
Not quite. Try another option.
Answer: Information represented more than necessary
Redundancy is repeated or predictable information that may be represented more compactly.
Question 19 of 60 · Data compression problems · Easy
Which simple compression method replaces consecutive repeated values with a value and its count?
Not quite. Try another option.
Answer: Run-length encoding
Run-length encoding stores each repeated run using the value and the number of repetitions.
Question 20 of 60 · Data compression problems · Easy
What is decompression?
Not quite. Try another option.
Answer: Reconstructing data from its compressed form
Decompression converts compressed data back into its original or reconstructed form.
Question 21 of 60 · Huffman coding · Medium
A source has symbol frequencies , , , , , and . What is the average code length of an optimal binary Huffman code?
Not quite. Try another option.
Answer: bits per symbol
The Huffman tree has weighted path length for symbols, so the average is bits per symbol.
Question 22 of 60 · Huffman coding · Medium
For symbol frequencies , , , and , which sequence of combined weights is produced by Huffman's algorithm?
Not quite. Try another option.
Answer:
The two smallest weights are repeatedly merged: , then , and finally .
Question 23 of 60 · Huffman coding · Medium
Given the prefix codes , , , and , what does the bit string decode to?
Not quite. Try another option.
Answer:
Reading valid codewords from left to right gives , corresponding to .
Question 24 of 60 · Huffman coding · Medium
Which set of binary codewords satisfies the prefix-free property required for Huffman decoding?
Not quite. Try another option.
Answer:
In the first set, no complete codeword is the prefix of another codeword. Each other set contains such a conflict.
Question 25 of 60 · Huffman coding · Medium
A canonical Huffman code assigns lengths to symbols in that order. If , what is the canonical code for ?
Not quite. Try another option.
Answer:
The canonical assignment is , , , , , and .
Question 26 of 60 · Huffman coding · Medium
A binary source has probabilities , , , and . A Huffman code gives corresponding lengths , , , and . What is its expected code length?
Not quite. Try another option.
Answer: bits per symbol
The expected length is bits per symbol.
Question 27 of 60 · Huffman coding · Medium
Symbols occur times, respectively. How many bits are needed to encode all symbols using an optimal binary Huffman code?
Not quite. Try another option.
Answer: bits
The Huffman lengths are , so the total is bits.
Question 28 of 60 · Huffman coding · Medium
Eight symbols have equal nonzero frequencies. What codeword length will each symbol have in an optimal binary Huffman code?
Not quite. Try another option.
Answer: bits
Eight equally likely symbols form a balanced binary tree, requiring bits for every symbol.
Question 29 of 60 · Huffman coding · Medium
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?
Not quite. Try another option.
Answer: bits per symbol
The contribution changes from to , a decrease of .
Question 30 of 60 · Huffman coding · Medium
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?
Not quite. Try another option.
Answer: bits
A fixed-length code needs bits per symbol, or bits. Huffman coding plus the tree needs bits, saving bits.
Question 31 of 60 · Data compression problems · Medium
Using compression ratio defined as original size divided by compressed size, what is the ratio when a KB file is compressed to KB?
Not quite. Try another option.
Answer:
The compression ratio is , so it is .
Question 32 of 60 · Data compression problems · Medium
A MB file is reduced to MB. What percentage of the original storage space is saved?
Not quite. Try another option.
Answer:
The saved space is MB, and .
Question 33 of 60 · Data compression problems · Medium
What is the Shannon entropy of a source with symbol probabilities , , , and ?
Not quite. Try another option.
Answer: bits per symbol
Using gives bits per symbol.
Question 34 of 60 · Data compression problems · Medium
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?
Not quite. Try another option.
Answer: bits
The original characters require bits. Three encoded runs require bits, so bits are saved.
Question 35 of 60 · Data compression problems · Medium
A compressor reduces a -byte file payload to bytes but adds bytes of metadata. What is the overall percentage reduction?
Not quite. Try another option.
Answer:
The final size is bytes. The reduction is .
Question 36 of 60 · Data compression problems · Medium
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?
Not quite. Try another option.
Answer: bits
The saving is bits per symbol, giving bits.
Question 37 of 60 · Data compression problems · Medium
A file contains both long repeated substrings and uneven token frequencies. Which compression pipeline most directly exploits both properties?
Not quite. Try another option.
Answer: Apply LZ77 before Huffman coding
LZ77 replaces repeated substrings with references, after which Huffman coding efficiently represents the resulting tokens according to frequency.
Question 38 of 60 · Data compression problems · Medium
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?
Not quite. Try another option.
Answer: seconds
The original takes seconds. The compressed file takes seconds, saving seconds.
Question 39 of 60 · Data compression problems · Medium
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?
Not quite. Try another option.
Answer: bits per symbol
Redundancy above entropy is the difference bits per symbol.
Question 40 of 60 · Data compression problems · Medium
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?
Not quite. Try another option.
Answer: symbols
A run costs encoded bits. Since an uncompressed run costs bits, compression is strict when , making the minimum.
Question 41 of 60 · Huffman coding · Hard
A source has symbol frequencies . What weighted external path length and average codeword length result from binary Huffman coding?
Not quite. Try another option.
Answer: and bits
The merge weights are , whose sum is . Dividing by the total frequency gives bits.
Question 42 of 60 · Huffman coding · Hard
Equal weights can allow several choices during Huffman construction. Which property is guaranteed across all valid tie-breaking choices?
Not quite. Try another option.
Answer: They produce the same optimal weighted path length
Any valid selection among tied minimum weights preserves Huffman optimality. Tree shapes, symbol depths, and assigned bit strings may differ, but the minimum total cost is unchanged.
Question 43 of 60 · Huffman coding · Hard
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?
Not quite. Try another option.
Answer: dummy symbol
A full -ary tree requires . For , the smallest satisfying is .
Question 44 of 60 · Huffman coding · Hard
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 ?
Not quite. Try another option.
Answer:
The canonical assignments are , , , , , and .
Question 45 of 60 · Huffman coding · Hard
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?
Not quite. Try another option.
Answer: It is impossible for ten distinct symbols
A binary prefix tree of maximum depth has at most leaves. Therefore, it cannot represent distinct symbols.
Question 46 of 60 · Huffman coding · Hard
For a binary source with probabilities , what are the entropy and optimal Huffman average length?
Not quite. Try another option.
Answer: and bits
The probabilities are dyadic, producing lengths . Their weighted average and the entropy are both bits.
Question 47 of 60 · Data compression problems · Hard
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?
Not quite. Try another option.
Answer:
Compression helps when , or . Thus the smallest integer is .
Question 48 of 60 · Huffman coding · Hard
A source has probabilities , and all five symbols must receive distinct finite binary prefix codewords. What is the minimum expected codeword length?
Not quite. Try another option.
Answer: bits
Only one positive-probability symbol can have length because space must remain for four other codewords. The other positive symbol can have length , giving .
Question 49 of 60 · Huffman coding · Hard
Which statement correctly expresses the sibling property used in the proof of binary Huffman coding optimality?
Not quite. Try another option.
Answer: Some optimal tree has two least-weight symbols as deepest siblings
An exchange argument shows that an optimal tree can be chosen in which two least-weight symbols are sibling leaves at maximum depth. Uniqueness is not required.
Question 50 of 60 · Data compression problems · Hard
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?
Not quite. Try another option.
Answer: No bounded resynchronization time is guaranteed
Prefix-freeness enables instantaneous decoding of an uncorrupted stream, but it does not provide error correction or guaranteed synchronization after deletion.
Question 51 of 60 · Data compression problems · Hard
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.
Not quite. Try another option.
Answer: Separate uses bits; global uses bits
Each two-symbol block uses one bit per symbol, totaling . Globally, Huffman merge costs are bits.
Question 52 of 60 · Data compression problems · Hard
A memoryless binary source has probabilities . Why can arithmetic coding of a long sequence substantially outperform symbol-by-symbol binary Huffman coding?
Not quite. Try another option.
Answer: Arithmetic coding approaches bits per symbol
Binary Huffman coding assigns one bit to each of the two symbols, whereas arithmetic coding amortizes fractional information over long sequences and approaches the source entropy.
Question 53 of 60 · Huffman coding · Hard
Binary Huffman coding is applied to frequencies . Which symbols receive the maximum codeword length, and what is that length?
Not quite. Try another option.
Answer: Frequencies and , with length
The merges are , , , , and . The first merged pair is nested most deeply, reaching length .
Question 54 of 60 · Huffman coding · Hard
Can a binary prefix code have codeword lengths ?
Not quite. Try another option.
Answer: No, because the Kraft sum is
The Kraft sum is , so no binary prefix code can have these lengths.
Question 55 of 60 · Huffman coding · Hard
For positive-frequency symbols, what is the largest possible depth of a leaf in a binary Huffman tree, considering all possible frequency distributions?
Not quite. Try another option.
Answer:
A full binary tree with leaves has maximum possible leaf depth . Strongly skewed frequency sequences can make Huffman construction produce this comb-shaped tree.
Question 56 of 60 · Huffman coding · Hard
Consider frequency sequences and , whose symbols have the same initial frequency ordering. Which conclusion is correct?
Not quite. Try another option.
Answer: Their depth assignments can differ because merged sums matter
Huffman construction depends on where merged weights are reinserted, not merely on the initial ranking. These sequences can yield depth patterns and .
Question 57 of 60 · Huffman coding · Hard
An unconstrained Huffman tree violates a required maximum codeword length . Which method correctly obtains an optimal binary length-limited prefix code?
Not quite. Try another option.
Answer: Apply the package-merge algorithm to the weights
Package-merge solves the binary length-limited coding problem while respecting the Kraft constraint. Simple truncation or local balancing need not preserve prefix-freeness or optimality.
Question 58 of 60 · Data compression problems · Hard
Why can no lossless compressor map every -bit input to a distinct binary output shorter than bits?
Not quite. Try another option.
Answer: There are only binary strings shorter than bits
There are possible inputs but only shorter outputs. An injective lossless mapping therefore cannot shorten every input.
Question 59 of 60 · Data compression problems · Hard
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?
Not quite. Try another option.
Answer:
For block Huffman coding, . Dividing by gives .
Question 60 of 60 · Data compression problems · Hard
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 ?
Not quite. Try another option.
Answer: bits per symbol
Given , encoding is equivalent to encoding the Bernoulli error variable . The relevant limit is bits per symbol.
That's unit 9
Answer a few questions and your score shows up here.
Nearly through. Did unit 9 of ECAP538 save you a night before the exam?
LPU Notes is free. A student pays for the servers.
Did unit 9 of ECAP538 save you a night before the exam?
Then you can help keep it free for the next batch. Ads cover part of the server bill;
the rest comes out of a student's own pocket: the domain, the storage, and keeping
the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason.
to try again.