TCS
Company
Programming
Technical
One circular array is given (means the memory allocation takes place like a circular fashion) dimension (9X7) .starting address is 3000.find the address of (2, 3)
Read Solution (Total 5)
-
- @krishnamurthy: how is it 3018? what is the formula for circular array?
- 12 years agoHelpfull: Yes(4) No(4)
- the address of (2,3) is 3018
- 12 years agoHelpfull: Yes(3) No(16)
- starting address is 3000
every element takes 2 bytes
total elements before (2*3)=9*1+2
9*1-from first rows , 9 elements in each row
so , (2*3) is 12th element of given array
1) 3000 -->(1,1)
2) 3002 -->(1,2)
3) 3004 -->(1,3)
4) 3006 -->(1,4)
5) 3008 -->(1,5)
6) 3010 -->(1,6)
7) 3012 -->(1,7)
8) 3014 -->(1,8)
9) 3016 -->(1,9)
10) 3018 -->(2,1)
11) 3020 -->(2,2)
12) 3022 -->(2,3)...............Answer
formula to calculate
=baseAddress+sizeOfDataType*((rowCountCurr-1*columnCount)+columncountCurr-1)
=3000+2((2-1)*9 +(3-1))
=3000+2(9+2)
=3022
...........answer - 10 years agoHelpfull: Yes(1) No(4)
- how 3818
plz explain it clearly... - 12 years agoHelpfull: Yes(0) No(1)
- it's a 9x7 int array so it reqiure a 126 bytes for storing.b'ze integer value need 2 byes of memory allocation .and starting add is 3000so starting add of 2x3 will be 3012.
- 10 years agoHelpfull: Yes(0) No(1)
TCS Other Question