PRASHNIKAप्रश्निका

A matrix G[3...7, 2...5] is stored in the memory, with each element requiring 4 bytes of storage…

Computer Science20262 marksNumerical
A matrix G[3...7, 2...5] is stored in the memory, with each element requiring 4 bytes of storage. If the address of G[5][4] is 6000, find the base address when the matrix is stored Column Major Wise.

Answer

Answer

AI
Written by AI (antigravity) - it can contain mistakes.
Row range: 3 to 7 -> Number of rows M = 7 - 3 + 1 = 5 Column range: 2 to 5 -> Number of columns N = 5 - 2 + 1 = 4 Element size W = 4 bytes Given Address(G[5][4]) = 6000 Column Major formula: Address(G[i][j]) = Base Address + W * [(j - Lc) * M + (i - Lr)] Here i = 5, j = 4, Lr = 3, Lc = 2 6000 = Base Address + 4 * [(4 - 2) * 5 + (5 - 3)] 6000 = Base Address + 4 * [2 * 5 + 2] 6000 = Base Address + 4 * [10 + 2] 6000 = Base Address + 4 * 12 6000 = Base Address + 48 Base Address = 6000 - 48 = 5952 Final answer: 5952

Final answer: 5952

Arrays, Strings

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

See every question