PRASHNIKAप्रश्निका
Back to the paper

A matrix is stored in the memory with each element requiring bytes of storage. If the base address…

Computer Science20232 marksOne word
A matrix $M[-6\dots 10, 4\dots 15]$ is stored in the memory with each element requiring $4$ bytes of storage. If the base address is $1025$, find the address of $M[4][8]$ when the matrix is stored in Column Major Wise.

Answer

Answer

AI
Column major: $Address(M[i][j]) = B + W[(j - L_c) \times R + (i - L_r)]$ Here $B = 1025$, $W = 4$, $L_r = -6$, $L_c = 4$, $i = 4$, $j = 8$. Number of rows $R = 10 - (-6) + 1 = 17$ $Address = 1025 + 4[(8 - 4) \times 17 + (4 - (-6))]$ $= 1025 + 4[68 + 10] = 1025 + 4 \times 78 = 1025 + 312$ $= 1337$
Arrays, Strings

From ISC 2023 Computer Science Paper 1, question 2(ii).