TCS
Company
Programming
Arrays
A Two-dimensional array X(7,9) is stored linearly column-wise in a computer's memory. Each element requires 8 bytes for storage of the value. If the first byte address of X(1,1) is 3000, what would be the last byte address of X(2,3)?
(a) 3247 (b) 3567 (c) 3088 (d) 3225 (e) 3765
Read Solution (Total 9)
-
- formula :
Baseaddress+byte required {N(i-1)+(j-1)}
3000+8{9(2-1)+(3-1)}
3000+88
3088
3088 is the answer
i represents the row
j represents the column
N means column size total 9 here - 6 years agoHelpfull: Yes(22) No(0)
- 3088
if 1,1=3000
1,3=3016
1,9=3064
2,1=3072
2,3=3088.
Simple - 5 years agoHelpfull: Yes(9) No(0)
- C by the address of each arrays it is 3088
- 6 years agoHelpfull: Yes(1) No(3)
- ans: c
1 -> 1-9 -> 3000+(8*7)= 3056
2 -> 0-3 -> 3056+(8*4)= 3088 - 6 years agoHelpfull: Yes(1) No(2)
- each element takes 8 bytes , and x(1,1) is 3000 according to this we add 8 bytes after each elements. in first row total 9 elements so x(1,9) becomes 3064 now we enter in 2nd row ,we have to find x(2,3) so in 2nd row we add 3 elements & ac to this 24 also added in address .so x(2,3) becomes 3088
- 5 years agoHelpfull: Yes(1) No(1)
- C by the address of each arrays it is 3088
- 6 years agoHelpfull: Yes(0) No(1)
- Formula:
Base address+byte required{N(i-1)+(j-1)}
Here Base addres is 3000.
Byte required is 4.
N=Number of columns in an array.
i=row of the array element of the address to be found.
j=column of the array element of the address to be found.
Solution;
3000+4{7(7)+4}=3212. - 5 years agoHelpfull: Yes(0) No(2)
- formula
baseaddress+{n(i-1)+(j-1)}
n=9, i=2, j=3
ans=3088 - 5 years agoHelpfull: Yes(0) No(0)
- 3088 x(I, j) =b+w(m(i-l1)+(j-l2))
- 5 years agoHelpfull: Yes(0) No(0)
TCS Other Question