6,586 views

3 Answers

Best answer
6 votes
6 votes

No formula used.

This requires just counting of numbers.See the below diagram

Each element requires 2B.

Like A[0][0] =351-352 ,A[0][1]=353-354.......

This is given to have a idea on how elements are stored and not beneficial when in big size is given.

selected by
4 votes
4 votes
Given array is Table[6][8] means the dimension of the 2D array is 6 rows * 8 columns

Desired location of table[3][4] means a element which is available in 4th row .

and in 4th row it is present at 5th coulmn .

so for reaching the 4th row , you have to cross the all elements present in 3 rows so = 3*8(bcoz 8 element will be present in one row )

and in 4th row for reaching the 5th column element you have to cross the previous 4 element present in 4th row .

so element need to be cross in 4th row =4

so total element need to be crossed = 3*8+4 =28 elements

consider size of int is 2 bytes . so bytes need to skipped = 28*2 =56 bytes

as given base address of 2D array is 351 . so from 351 we need to move 56 bytes ahead = 351+56 =407

so 407 is the address of table[3][4] .
3 votes
3 votes
we have to find TABLE[3][4]

according to given data number of columns in array=8

Number of rows before TABLE[3][4] = 3 ( 0th row, 1st row, 2nd row )

so elements in this 3 rows = 3 * 8 = 24

now number of columns before TABLE[3][4] = 4 ( 0,1,2,3 )

so total elements before TABLE[3][4] = 24+4

So location = 351 + 28*2 =407. I have assumed size of int as 2 bytes

Related questions

1 votes
1 votes
2 answers
1
Sazia Tabassum asked Oct 14, 2022
575 views
The return value of ace(4) is int ace(int a) { int x=1; static int k=1; if(a==1) return x; for(;k<a;++k) x=x+ace(k)*ace(a-k); return x; }A.15B.4C.10D.Error
1 votes
1 votes
0 answers
2
srestha asked Mar 2, 2019
1,168 views
An OS uses virtual memory with paging technique for memory allocation. Which of the following searching technique on given data structure use locality of reference?Linear...
0 votes
0 votes
1 answer
3
Na462 asked Jun 29, 2018
575 views
According to me Option D.Because it should be an error because *("INDIA" + 2 ) = 'D' and we are doing 'D' = 'I' which is not valid so Error ???But answer is C
0 votes
0 votes
1 answer
4