GATE Computer ScienceHardGATE CS (PYQ pattern)
Five instructions occur with relative frequencies 0.4, 0.2, 0.2, 0.1 and 0.1. A fixed-length opcode would need 3 bits. What is the minimum possible average opcode length (bits) with a variable-length prefix code, to one decimal?
- A. 3.0
- B. 2.5
- C. 2.2
- D. 2.0
Correct answer: C. 2.2
Huffman merging: 0.1+0.1 = 0.2; 0.2+0.2 = 0.4; 0.2+0.4 = 0.6; 0.4+0.6 = 1.0. Total of merged weights = 0.2 + 0.4 + 0.6 + 1.0 = 2.2 bits on average.
Practise more Computer Organization and Architecture questionsComputer Organization and Architecture: notes and key points
More Computer Organization and Architecture questions
- An in-order 2-issue processor starts up to two consecutive instructions per cycle. The second is issued with the first only if it has no…
- A loop body is LW, ADD (uses the loaded value), SW, ADDI, BNE and runs 1000 times on a 5-stage pipeline with forwarding: the ADD right…
- A cache has 64 sets of 4 ways. Exact LRU stores the full recency order of each set using the minimum number of bits; tree pseudo-LRU…
- A fully pipelined floating-point adder has latency 4 cycles and can start one addition every cycle; a dependent addition starts only when…
- Two branches share one 2-bit saturating counter (aliasing in a small predictor table): X is always taken, Y is never taken, and they…
- On a processor with base CPI 1.0, the L1 cache has 40 misses per 1000 instructions. Of these, 10 per 1000 instructions also miss in the L2…