GATE Computer ScienceVery hardGATE CS (PYQ pattern)
A stack machine evaluates the sum of 16 distinct variables arranged as a perfectly balanced binary tree of additions (addition is commutative so either operand may go first, but the tree shape is fixed). What is the minimum stack depth required?
- A. 5
- B. 6
- C. 4
- D. 16
Correct answer: A. 5
Equal subtrees both needing k force the parent to need k + 1: leaves 1, level 1 needs 2, then 3, 4, and the root 5 = log₂16 + 1. A depth of 16 would be needed only if all operands were pushed first.
Practise more Computer Organization and Architecture questionsComputer Organization and Architecture: notes and key points
More Computer Organization and Architecture questions
- A program has three disjoint parts: 20% not improvable, 30% sped up 5× by a vector unit, and 50% sped up 2× by a faster memory. What is…
- In IEEE 754 single precision with round-to-nearest-even, let x = 2²³ = 8,388,608. What are the results of (x + 0.5) + 0.5 and x + (0.5 +…
- A classic 5-stage pipeline (IF, ID, EX, MEM, WB) runs: I1: ADD R1, R1, R2; I2: ADD R3, R1, R4; I3: ADD R5, R3, R1; I4: LW R6, 0(R5); I5…
- A direct-mapped cache of 128 bytes with 32-byte blocks (4 lines) is used while a program reads the 4-byte words at byte addresses 0, 4, 8…
- A non-pipelined processor takes 180 + 120 + 200 + 260 + 100 ps per instruction. Its 5-stage pipelined version adds a 20 ps latch after…
- Memory access takes 200 ns. A page fault takes 8 ms to service if the replaced page is clean and 20 ms if it is dirty (it must first be…