‹ Back to the paper
A matrix is stored in the memory with each element requiring 2 bytes of storage. If the base…
A matrix $P[-10\dots10, 1\dots10]$ is stored in the memory with each element requiring 2 bytes of storage. If the base address is 2000, find the address of $P[5][6]$ when the matrix is stored **Row Major wise**.
Answer
Answer
AIRow Major formula: Addr(P[i][j]) = Base + W × [ (i - LR) × NC + (j - LC) ]
Here LR (lower row bound) = -10, LC (lower column bound) = 1, UC (upper column bound) = 10, so NC (number of columns) = UC - LC + 1 = 10; W = 2, Base = 2000, i = 5, j = 6.
Addr(P[5][6]) = 2000 + 2 × [ (5-(-10)) × 10 + (6-1) ]
= 2000 + 2 × [ 15 × 10 + 5 ]
= 2000 + 2 × 155
= 2000 + 310
Final answer: 2310
Final answer: 2310
From ISC 2025 Improvement Computer Science Paper 1, question 2(ii).