Data Compression UNIT-2: B) Greedy Algorithm
Data Compression UNIT-2: B) Greedy Algorithm
Data Compression UNIT-2: B) Greedy Algorithm
UNIT-2
1. Which of the following algorithms is the best approach for solving Huffman codes?
a) exhaustive search
b) greedy algorithm
c) brute force algorithm
d) divide and conquer algorithm
2. How many printable characters does the ASCII character set consists of?
a) 120
b) 128
c) 100
d) 98
3. Which bit is reserved as a parity bit in an ASCII set?
a) first
b) seventh
c) eighth
d) tenth
4. How many bits are needed for standard encoding if the size of the character set is
X?
a) log X
b) X+1
c) 2X
d) X2
5. The code length does not depend on the frequency of occurrence of characters.
a) true
b) false
6. In Huffman coding, data in a tree always occur?
a) roots
b) leaves
c) left sub trees
d) right sub trees
7. From the following given tree, what is the code word for the character ‘a’?
a) 011
b) 010
c) 100
d) 101
8. From the following given tree, what is the computed codeword for ‘c’?
a) 111
b) 101
c) 110
d) 011
9. What will be the cost of the code if character ci is at depth di and occurs at
frequency fi?
a) cifi
b) ∫cifi
c) ∑fidi
d) fidi
10. An optimal code will always be present in a full tree.
a) true
b) false
11. The type of encoding where no character code is the prefix of another character
code is called?
a) optimal encoding
b) prefix encoding
c) frequency encoding
d) trie encoding
12. What is the running time of the Huffman encoding algorithm?
a) O(C)
b) O(log C)
c) O(C log C)
d) O( N log C)
13. What is the running time of the Huffman algorithm, if its implementation of the
priority queue is done using linked lists?
a) O(C)
b) O(log C)
c) O(C log C)
d) O(C2)
14. Which of the following is true about Huffman Coding?
a) Huffman coding may become lossy in some cases
b) Huffman Codes may not be optimal lossless codes in some cases
c) In Huffman coding, no code is prefix of any other code.
d) All of the above
15. Which of the following algorithms is the best approach for solving Huffman codes?
a) exhaustive search
b) greedy algorithm
c) brute force algorithm
d) divide and conquer
16. How many printable characters does the ASCII character set consists of?
a) 120
b) 128
c) 100
d) 98
17. Which bit is reserved as a parity bit in an ASCII set?
a) first
b) seventh
c) eighth
d) tenth
18. How many bits are needed for standard encoding if the size of the character set is X?
a) log X
b) X+1
c) 2X
d) X2
19. The code length does not depend on the frequency of occurrence of characters.
a) true
b) false
20. In Huffman coding, data in a tree always occur?
a) roots
b) leaves
c) left sub trees
d) right sub trees
21. From the following given tree, what is the code word for the character 'a'?
a) 011
b) 10
c) 100
d) 101
22. From the following given tree, what is the computed codeword for 'c'?
a) 111
b) 101
c) 110
d) 11