GeekInterview.com
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
Asked by: Interview Candidate | Asked on: Sep 22nd, 2006
Showing Answers 1 - 9 of 9 Answers
vinayak

Answered On : Sep 28th, 2006

ans is  1344

  
Login to rate this answer.
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

Yes  1 User has rated as useful.
  
Login to rate this answer.
ajay

Answered On : Oct 5th, 2006

it should be 1330 according to me

  
Login to rate this answer.
joseprabhu

Answered On : Oct 5th, 2006

Hi ,

Can any one explain this with proper steps

  
Login to rate this answer.
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.

  
Login to rate this answer.
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.

  
Login to rate this answer.
imran4108

Answered On : Apr 26th, 2008

View all answers by imran4108

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

  
Login to rate this answer.
bangalo

Answered On : Aug 4th, 2010

View all answers by bangalo

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.

  
Login to rate this answer.
ankita_kri

Answered On : Aug 5th, 2010

View all answers by ankita_kri

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

  
Login to rate this answer.

Give your answer:

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

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Ads

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.