Series: Subject: Topic:
Question: 245 of 375

# 4.In two dimensional array X(7,9) each element occupies 2 bytes of memory.If the address of first element X(1,1)is 1258 then what will be the address of the element X(5,8) ? whats the ans

This question is related to TCS Interview
vinayak

Answered On : Sep 28th, 2006

ans is  1344

naveen

Answered On : Sep 30th, 2006

Ans is 1344 and it is calculated asfirst add 8 since in first row 8 elements then for the next 3 row add 9 nd for the last row add 8 so the total comes to 43 multiply with 2 add it to 1258 it gives 1344

1 User has rated as useful.

ajay

Answered On : Oct 5th, 2006

it should be 1330 according to me

joseprabhu

Answered On : Oct 5th, 2006

Hi ,

Can any one explain this with proper steps

vishal

Answered On : Nov 30th, 2006

intger req. 2 byte for memory allocation so in this two dim array 7x9 it req. 126 bytes memory.

so 1x1 starting add is 1258.

now to find add of 5x8 so it req 80 byes

so 80+1258=1338.

prashant kara

Answered On : Jan 24th, 2007

here, the address of first element x[1][1] is 1258 and also 2 byte of memory is given.now, we have to solve the address of element x[5][8], therefore, 1258+ 5*8*2 = 1258+80 = 1338 so the answer is 1338.

imran4108

Answered On : Apr 26th, 2008

formulae is
X(5,8)=X(N,M)
X(7,9)=X(R,C)
X(5,8)=BASE+C*(M-1)*SIZE+(N-1)*SIZE
WHERE SIZE=2BYTES
BASE=1258
X(5,8)=1258+9*7*2+4*2

bangalo

Answered On : Aug 4th, 2010

1) If it is a row based then

1258+2(9(5-1)+(8-1))=1258+2(36+7)=1258+86=1344

2)
If it is column based then

1258+2((7(8-1)+(5-1))=1258+2(49+4)=1258+106=1364.

ankita_kri

Answered On : Aug 5th, 2010

1258+4*(9*(5-1)+(8-1)) equals to 1430