Cache
October 19, 2023CompilerDesign
October 20, 2023Programming
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.
560


565


570


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
Step1: 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.
Step2: Offset = (11*10) + 5
= 115 (multiply with 4 words)
= 115*4
= 460
Step 3: Initial base address is 100
=Offset+base address
= 460 +100
= 560.
Offset= (Row number * Total number of columns) + Column Number
Step1: 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.
Step2: Offset = (11*10) + 5
= 115 (multiply with 4 words)
= 115*4
= 460
Step 3: Initial base address is 100
=Offset+base address
= 460 +100
= 560.
Correct Answer: A
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
Step1: 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.
Step2: Offset = (11*10) + 5
= 115 (multiply with 4 words)
= 115*4
= 460
Step 3: Initial base address is 100
=Offset+base address
= 460 +100
= 560.
Offset= (Row number * Total number of columns) + Column Number
Step1: 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.
Step2: Offset = (11*10) + 5
= 115 (multiply with 4 words)
= 115*4
= 460
Step 3: Initial base address is 100
=Offset+base address
= 460 +100
= 560.
Subscribe
Login
0 Comments