GATE CS 2023 | Question 41

Computer Organization & Architecture › Machine Instructions · MCQ · 2 marks · Answer: B

  1. Question 41Computer Organization & Architecturemcq2 marks
    For a[i]=b[i]*8 (int = 32-bit, byte-addressable), the assembly uses shl r5,r5,U1, add r3,r3,U2, add r4,r4,U3, jmp U4. Which replaces (U1,U2,U3,U4)?
    • A.
      (8, 4, 1, L02)
    • B.
      (3, 4, 4, L01)
      ✓
    • C.
      (8, 1, 1, L02)
    • D.
      (3, 1, 1, L01)

    Answer: B

    Solution

    Answer: (B) (3, 4, 4, L01) Multiplying by 8 is a left shift by 3 -> U1=3. Arrays a and b hold 32-bit ints (4 bytes), so advancing to the next element adds 4 to each base pointer -> U2=4, U3=4. The loop jumps back to the comparison at the top -> U4=L01. So (3,4,4,L01).

More GATE PYQ on Machine Instructions

All GATE CS Computer Organization & Architecture PYQ →

Attempt GATE CS 2023 in real GATE exam mode

Full paper with a timer, the GATE interface and a topic-wise analysis — free.

Create free account →