October 19, 2023
October 20, 2023
October 19, 2023
###### Compiler-Design
October 20, 2023
 Question 274
Consider an array A[20, 10], assume 4 words per memory cell and the base address of array A is 100. What is the address of A[11, 5] ? Assume row major storage.
 A 560 B 565 C 570 D 575
Question 274 Explanation:
Here, Row major order generally follows offset formula to find address of the location.
Offset= (Row number * Total number of columns) + Column Number
Step-1: Add the Base address to calculate the effective address. Given matrix is A[20][10], Size of memory word is 4 bytes, address of the location to find A[11][5], Base address is 100.
Step-2: Offset = (11*10) + 5
= 115 (multiply with 4 words)
= 115*4
= 460
Step 3: Initial base address is 100
= 460 +100
= 560.
Question 274 Explanation:
Here, Row major order generally follows offset formula to find address of the location.
Offset= (Row number * Total number of columns) + Column Number
Step-1: Add the Base address to calculate the effective address. Given matrix is A[20][10], Size of memory word is 4 bytes, address of the location to find A[11][5], Base address is 100.
Step-2: Offset = (11*10) + 5
= 115 (multiply with 4 words)
= 115*4
= 460
Step 3: Initial base address is 100
= 460 +100
= 560.