Prashnikaप्रश्निका
Code
About
‹ Back to the paper

Question 2(ii)

2 marks

Computer ScienceISC 2024 Specimen Computer Science Paper 1NumericalArrays, Strings

Solve the following.

An array ARR[-4 … 6, -2 … 12], stores elements in Row Major Wise, with the address ARR[2][3] as…

An array $ARR[-4 \dots 6, -2 \dots 12]$, stores elements in Row Major Wise, with the address $ARR[2][3]$ as 4142. If each element requires 2 bytes of storage, find the Base address.

Answer

Answer

Rows $= 6-(-4)+1 = 11$, columns $M = 12-(-2)+1 = 15$, $W = 2$ Row Major: $Address(ARR[i][j]) = Base + W \times [(i-L_r) \times M + (j-L_c)]$ $4142 = Base + 2 \times [(2-(-4)) \times 15 + (3-(-2))]$ $4142 = Base + 2 \times [90+5] = Base + 190$ $Base = 4142 - 190 = 3952$

Final answer: 3952