Correct Answer: To compress data without losing information
Explanation:
Huffman coding is a lossless compression technique that represents frequent symbols with shorter codes.
Incorrect! Try again.
2Which 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
Correct Answer: Greedy algorithm
Explanation:
Huffman coding uses a greedy strategy by repeatedly combining the two least frequent nodes.
Incorrect! Try again.
3Which 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
Correct Answer: The two least frequent symbols
Explanation:
The Huffman algorithm repeatedly merges the two symbols or nodes having the lowest frequencies.
Incorrect! Try again.
4In 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
Correct Answer: In the leaf nodes
Explanation:
Each leaf node represents one original symbol and its path determines the symbol's code.
Incorrect! Try again.
5What 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
Correct Answer: Its depth in the Huffman tree
Explanation:
The code consists of the edge labels on the root-to-leaf path, so its length equals the leaf's depth.
Incorrect! Try again.
6Which 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
Correct Answer: Symbols that occur more frequently
Explanation:
Frequently occurring symbols are placed closer to the root and therefore receive shorter codes.
Incorrect! Try again.
7What 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
Correct Answer: No code is a prefix of another code
Explanation:
The prefix-free property allows encoded data to be decoded unambiguously without separators.
Incorrect! Try again.
8Which 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
Correct Answer: A minimum-priority queue
Explanation:
A minimum-priority queue efficiently removes the two nodes with the smallest frequencies.
Incorrect! Try again.
9When two Huffman nodes with frequencies and are merged, what is the new node's frequency?
Huffman coding
Easy
A.
B.
C.
D.
Correct Answer:
Explanation:
A merged node receives the sum of its children's frequencies: .
Incorrect! Try again.
10What values are typically assigned to the two branches of a binary Huffman tree?
Huffman coding
Easy
A. and
B. and
C. and
D. and
Correct Answer: and
Explanation:
The two branches are labeled and to produce binary codewords.
Incorrect! Try again.
11How 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
Correct Answer: By following bits from the root to a leaf
Explanation:
Starting at the root, the decoder follows the branch indicated by each bit until it reaches a leaf.
Incorrect! Try again.
12What 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
Correct Answer: Variable-length codewords
Explanation:
Huffman coding assigns codewords of different lengths based on symbol frequencies.
Incorrect! Try again.
13What 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
Correct Answer: To reduce the number of bits used
Explanation:
Data compression represents information using fewer bits, reducing storage or transmission requirements.
Incorrect! Try again.
14Which 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
Correct Answer: Lossless compression
Explanation:
Lossless compression preserves all information, allowing exact recovery of the original data.
Incorrect! Try again.
15Which type of compression may permanently discard some information?
Data compression problems
Easy
A.Lossless compression
B.Binary compression
C.Lossy compression
D.Prefix compression
Correct Answer: Lossy compression
Explanation:
Lossy compression reduces size by discarding some information that cannot be restored exactly.
Incorrect! Try again.
16Which 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
Correct Answer: Lossless compression
Explanation:
Executable files must be reconstructed exactly, so lossless compression is required.
Incorrect! Try again.
17An 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
Correct Answer: bytes
Explanation:
The saved space is bytes.
Incorrect! Try again.
18What 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
Correct Answer: Information represented more than necessary
Explanation:
Redundancy is repeated or predictable information that may be represented more compactly.
Incorrect! Try again.
19Which 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
Correct Answer: Run-length encoding
Explanation:
Run-length encoding stores each repeated run using the value and the number of repetitions.
Incorrect! Try again.
20What 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
Correct Answer: Reconstructing data from its compressed form
Explanation:
Decompression converts compressed data back into its original or reconstructed form.
Incorrect! Try again.
21A 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
Correct Answer: bits per symbol
Explanation:
The Huffman tree has weighted path length for symbols, so the average is bits per symbol.
Incorrect! Try again.
22For symbol frequencies , , , and , which sequence of combined weights is produced by Huffman's algorithm?
Huffman coding
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
The two smallest weights are repeatedly merged: , then , and finally .
Incorrect! Try again.
23Given the prefix codes , , , and , what does the bit string decode to?
Huffman coding
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
Reading valid codewords from left to right gives , corresponding to .
Incorrect! Try again.
24Which set of binary codewords satisfies the prefix-free property required for Huffman decoding?
Huffman coding
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
In the first set, no complete codeword is the prefix of another codeword. Each other set contains such a conflict.
Incorrect! Try again.
25A canonical Huffman code assigns lengths to symbols in that order. If , what is the canonical code for ?
Huffman coding
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
The canonical assignment is , , , , , and .
Incorrect! Try again.
26A 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
Correct Answer: bits per symbol
Explanation:
The expected length is bits per symbol.
Incorrect! Try again.
27Symbols 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
Correct Answer: bits
Explanation:
The Huffman lengths are , so the total is bits.
Incorrect! Try again.
28Eight 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
Correct Answer: bits
Explanation:
Eight equally likely symbols form a balanced binary tree, requiring bits for every symbol.
Incorrect! Try again.
29A 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
Correct Answer: bits per symbol
Explanation:
The contribution changes from to , a decrease of .
Incorrect! Try again.
30A 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
Correct Answer: bits
Explanation:
A fixed-length code needs bits per symbol, or bits. Huffman coding plus the tree needs bits, saving bits.
Incorrect! Try again.
31Using 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.
Correct Answer:
Explanation:
The compression ratio is , so it is .
Incorrect! Try again.
32A MB file is reduced to MB. What percentage of the original storage space is saved?
Data compression problems
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
The saved space is MB, and .
Incorrect! Try again.
33What 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
Correct Answer: bits per symbol
Explanation:
Using gives bits per symbol.
Incorrect! Try again.
34The 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
Correct Answer: bits
Explanation:
The original characters require bits. Three encoded runs require bits, so bits are saved.
Incorrect! Try again.
35A 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.
Correct Answer:
Explanation:
The final size is bytes. The reduction is .
Incorrect! Try again.
36A 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
Correct Answer: bits
Explanation:
The saving is bits per symbol, giving bits.
Incorrect! Try again.
37A 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
Correct Answer: Apply LZ77 before Huffman coding
Explanation:
LZ77 replaces repeated substrings with references, after which Huffman coding efficiently represents the resulting tokens according to frequency.
Incorrect! Try again.
38An -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
Correct Answer: seconds
Explanation:
The original takes seconds. The compressed file takes seconds, saving seconds.
Incorrect! Try again.
39A 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
Correct Answer: bits per symbol
Explanation:
Redundancy above entropy is the difference bits per symbol.
Incorrect! Try again.
40A 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
Correct Answer: symbols
Explanation:
A run costs encoded bits. Since an uncompressed run costs bits, compression is strict when , making the minimum.
Incorrect! Try again.
41A 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
Correct Answer: and bits
Explanation:
The merge weights are , whose sum is . Dividing by the total frequency gives bits.
Incorrect! Try again.
42Equal 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
Correct Answer: They produce the same optimal weighted path length
Explanation:
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.
Incorrect! Try again.
43A 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
Correct Answer: dummy symbol
Explanation:
A full -ary tree requires . For , the smallest satisfying is .
Incorrect! Try again.
44A 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.
Correct Answer:
Explanation:
The canonical assignments are , , , , , and .
Incorrect! Try again.
45A 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
Correct Answer: It is impossible for ten distinct symbols
Explanation:
A binary prefix tree of maximum depth has at most leaves. Therefore, it cannot represent distinct symbols.
Incorrect! Try again.
46For 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
Correct Answer: and bits
Explanation:
The probabilities are dyadic, producing lengths . Their weighted average and the entropy are both bits.
Incorrect! Try again.
47An -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.
Correct Answer:
Explanation:
Compression helps when , or . Thus the smallest integer is .
Incorrect! Try again.
48A 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
Correct Answer: bits
Explanation:
Only one positive-probability symbol can have length because space must remain for four other codewords. The other positive symbol can have length , giving .
Incorrect! Try again.
49Which 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
Correct Answer: Some optimal tree has two least-weight symbols as deepest siblings
Explanation:
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.
Incorrect! Try again.
50A 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
Correct Answer: No bounded resynchronization time is guaranteed
Explanation:
Prefix-freeness enables instantaneous decoding of an uncorrupted stream, but it does not provide error correction or guaranteed synchronization after deletion.
Incorrect! Try again.
51Two 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
Correct Answer: Separate uses bits; global uses bits
Explanation:
Each two-symbol block uses one bit per symbol, totaling . Globally, Huffman merge costs are bits.
Incorrect! Try again.
52A 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
Correct Answer: Arithmetic coding approaches bits per symbol
Explanation:
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.
Incorrect! Try again.
53Binary 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
Correct Answer: Frequencies and , with length
Explanation:
The merges are , , , , and . The first merged pair is nested most deeply, reaching length .
Incorrect! Try again.
54Can 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
Correct Answer: No, because the Kraft sum is
Explanation:
The Kraft sum is , so no binary prefix code can have these lengths.
Incorrect! Try again.
55For 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.
Correct Answer:
Explanation:
A full binary tree with leaves has maximum possible leaf depth . Strongly skewed frequency sequences can make Huffman construction produce this comb-shaped tree.
Incorrect! Try again.
56Consider 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
Correct Answer: Their depth assignments can differ because merged sums matter
Explanation:
Huffman construction depends on where merged weights are reinserted, not merely on the initial ranking. These sequences can yield depth patterns and .
Incorrect! Try again.
57An 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
Correct Answer: Apply the package-merge algorithm to the weights
Explanation:
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.
Incorrect! Try again.
58Why 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
Correct Answer: There are only binary strings shorter than bits
Explanation:
There are possible inputs but only shorter outputs. An injective lossless mapping therefore cannot shorten every input.
Incorrect! Try again.
59An 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.
Correct Answer:
Explanation:
For block Huffman coding, . Dividing by gives .
Incorrect! Try again.
60Let 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
Correct Answer: bits per symbol
Explanation:
Given , encoding is equivalent to encoding the Bernoulli error variable . The relevant limit is bits per symbol.
Incorrect! Try again.
Did this save you a night before the exam?
LPU Notes is free, and it stays free. 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.
Nothing here is ever locked, and nothing unlocks. Chip in only if it was worth it.
What it pays for →