...
Question 1295 – Nielit STA [02-12-2018]
December 10, 2023
OOPS
December 10, 2023
Question 1295 – Nielit STA [02-12-2018]
December 10, 2023
OOPS
December 10, 2023

Question 1302 – Nielit STA [02-12-2018]

Suppose that we have an MxN array ‘A’ in row major order, where the size of the elements is S. Then the location of A[i,j] elements is given by:

Correct Answer: B

Question 49 Explanation: 
“A” is the base address,
M is number of the rows and N is number of Columns and S is size of the element.
The elements are storing row major order. So the elements are in the following order.
A[1,1],A[1,2],A[1,3] ….. A[1,N]
A[2,1],A[2,2],A[2,3]……..A[2,N]
……
….
A[M,1],A[M,2],A[M,3]……..A[M,N]
We will get the location of A[i,j] by using formula A+(i*N+j)*S where “i” is the index of the row and “j” index of the column and “N” is number of columns.
A
A+i*N*S
B
A+(i*N+j)*S
C
A+(i*N+j*M)*S
D
A+(i*M+j*N)*S
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!