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

An array ARR [ -5 .....15, 10.....20 ] stores elements in Row Major Wise with each element…

Computer Science20242 marksNumerical
An array ARR [ -5 .....15, 10.....20 ] stores elements in Row Major Wise with each element requiring 2 bytes of storage. Find the address of ARR [10] [15] when the base address is 2500.

Answer

Answer

AI
Rows: $-5$ to $15 \Rightarrow N = 15-(-5)+1 = 21$ Columns: $10$ to $20 \Rightarrow M = 20-10+1 = 11$ Row Major formula: $Address(ARR[i][j]) = Base + W \times [(i-L_r) \times M + (j-L_c)]$ Here $i=10, j=15, L_r=-5, L_c=10, W=2$ $= 2500 + 2 \times [(10-(-5)) \times 11 + (15-10)]$ $= 2500 + 2 \times [165+5] = 2500+340$ Final answer: 2840

Final answer: 2840

Arrays, Strings

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