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

Showing Answers 1 - 19 of 19 Answers

vinayak

  • Sep 28th, 2006
 

ans is  1344

  Was this answer useful?  Yes

naveen

  • 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

ajay

  • Oct 5th, 2006
 

it should be 1330 according to me

  Was this answer useful?  Yes

joseprabhu

  • Oct 5th, 2006
 

Hi ,

Can any one explain this with proper steps

  Was this answer useful?  Yes

vishal

  • 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.

  Was this answer useful?  Yes

prashant kara

  • 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.

  Was this answer useful?  Yes

imran4108

  • 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

  Was this answer useful?  Yes

bangalo

  • Aug 4th, 2010
 

The answer is

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.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions