GATE CS 2023 (Forenoon) — Question 41

Computer Organization and Architecture (COA)Machine Instructions & Addressing ModesMCQ2 marks · −2/3 if wrongMedium

Consider the given C-code and its corresponding assembly code, with a few operands U1–U4 being unknown. Some useful information as well as the semantics of each unique assembly instruction is annotated as inline comments in the code. The memory is byte-addressable.
c
1//C-code
2int a[10], b[10], i;
3// int is 32-bit
4for (i=0; i<10; i++)
5    a[i] = b[i] * 8;
6
assembly
1; assembly-code (; indicates comments)
2; r1-r5 are 32-bit integer registers
3; initialize r1=0, r2=10
4; initialize r3, r4 with base address of a, b
5L01: jeq r1, r2, end; if(r1==r2) goto end
6L02: lw r5, 0(r4); r5 <- Memory[r4+0]
7L03: shl r5, r5, U1; r5 <- r5 << U1
8L04: sw r5, 0(r3); Memory[r3+0] <- r5
9L05: add r3, r3, U2; r3 <- r3+U2
10L06: add r4, r4, U3
11L07: add r1, r1, 1
12L08: jmp U4; goto U4
13L09: end
14
Which one of the following options is a CORRECT replacement for operands in the position (U1, U2, U3, U4) in the above assembly code?
  1. A
    (8, 4, 1, L02)
  2. B
    (3, 4, 4, L01)
  3. C
    (8, 1, 1, L02)
  4. D
    (3, 1, 1, L01)
Practise the full 2023-FN paper
Challenge a friend: WhatsApp Telegram
From RENYXERAWhat rank do your marks get?GATE score, likely All-India Rank and qualifying marks for your category.
Practise more on Machine Instructions & Addressing ModesTimed, in the real exam interface · free to start

A GATE question every morning

One real past-paper question every morning for your branch, answer hidden until you tap. Free on Telegram.

Join
Stuck? Ask in the student group