Open In App

GATE | GATE CS Mock 2018 | Set 2 | Question 38

Consider a 2D-array A[10][20] using row major order in memory and the memory location we want to access is A[y, z]. Known that each memory address occupies 4-bytes.
Below is the 3-address code for the same, fill the blank spaces with correct value :

x : A[y, z]

t1 = ---(1)--- * ---(2)---
t2 = t1  +  z
t3 = t2  *  ---(3)---
---(4)--- = base address of A
x = t4[---(5)---]

(A) (1) : x
(2) : 10
(3) : 4
(4) : t4
(5) : t3
(B) (1) : y
(2) : 10
(3) : t4
(4) : 4
(5) : t3
(C) (1) : y
(2) : 20
(3) : 4
(4) : t4
(5) : t3
(D) None of these

Answer: (C)
Explanation: (1) : y
(2) : 20
(3) : 4
(4) : t4
(5) : t3
Quiz of this Question

Article Tags :