GATE Computer ScienceHardGATE CS (PYQ pattern)
Instruction frequencies are 0.5, 0.25, 0.125, 0.0625 and 0.0625. What is the minimum average opcode length with a prefix code, and how many bits does a fixed-length 5-opcode encoding need?
- A. 1.8750 bits versus 3 bits
- B. 1.8750 bits versus 2 bits
- C. 1.5 bits versus 2 bits
- D. 2.0 bits versus 3 bits
Correct answer: A. 1.8750 bits versus 3 bits
The probabilities are powers of ½, so code lengths 1, 2, 3, 4, 4 give 0.5 + 0.5 + 0.375 + 0.25 + 0.25 = 1.875 bits; fixed length needs ⌈log₂5⌉ = 3 bits.
Practise more Computer Organization and Architecture questionsComputer Organization and Architecture: notes and key points
More Computer Organization and Architecture questions
- A cache line holds 8 words. Memory returns the first word 20 cycles after the request and then one word per cycle. Without…
- A physically indexed, physically tagged cache needs the TLB first: a TLB hit takes 1 ns and the cache hit then takes 2 ns. A VIPT cache…
- A physically tagged L1 data cache is 32 KB, 8-way set-associative with 64-byte blocks. Physical addresses are 40 bits and pages are 4 KB…
- A pipeline (ideal CPI 1) can predict branches not-taken (a taken branch costs 3 cycles, a not-taken one 0) or predict taken (a taken…
- A direct-mapped cache with 32-byte blocks and 32-bit addresses stores, for every line, only a tag and a valid bit as metadata. The total…
- A loop computes y[i] += A[i][j] × x[j] for a 64×64 matrix of 4-byte floats (A in row-major order at address 0, x at 16384, y at 17024)…