Operating-Systems
October 11, 2023
Process-Scheduling
October 11, 2023
Operating-Systems
October 11, 2023
Process-Scheduling
October 11, 2023

Data-Structures

Question 38

Let A be a two dimensional array declared as follows:

  A: array [1 ... 10] [1 ... 15] of integer;  

Assuming that each integer takes one memory location, the array is stored in row-major order and the first element of the array is stored at location 100, what is the address of the element a[i][j]?

A
15i + j + 84
B
15j + i + 84
C
10i + j + 89
D
10j + i + 89
Question 38 Explanation: 
The address of element A[i][j] will be,
100 + 15 * (i-1) + (j-1)
= 100 + 15i – 15 + j – 1
= 15i + j + 84
Correct Answer: A
Question 38 Explanation: 
The address of element A[i][j] will be,
100 + 15 * (i-1) + (j-1)
= 100 + 15i – 15 + j – 1
= 15i + j + 84

Leave a Reply

Your email address will not be published. Required fields are marked *

error: <b>Alert: </b>Content selection is disabled!!