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

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

Computer Science20242 marksOne word
An array ARR[ −4 …..6, −2…..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

AI
Row Major formula: $Address(ARR[i][j]) = Base + W \times [(i-L_r) \times N + (j-L_c)]$, where $N$ = number of columns. Row range $-4$ to $6 \Rightarrow$ number of rows $=6-(-4)+1=11$ Column range $-2$ to $12 \Rightarrow N = 12-(-2)+1=15$ Given $i=2, j=3, L_r=-4, L_c=-2, W=2$, Address $=4142$: $4142 = Base + 2\times[(2-(-4))\times 15+(3-(-2))]$ $4142 = Base + 2\times[90+5] = Base+190$ $Base = 4142-190$ Final answer: Base address $=3952$
Arrays, Strings

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