SSC IMD SA Mock 01 – Question 113

Question:

Consider a 2D array \(A[1..10, 1..15]\) stored in row-major order with base address 1000. Each element occupies 4 bytes. What is the address of element \(A[6, 8]\)?

पंक्ति-प्रमुख क्रम (Row-major order) में संग्रहीत एक 2D ऐरे \(A[1..10, 1..15]\) का आधार पता 1000 है। प्रत्येक तत्व 4 बाइट्स लेता है। तत्व \(A[6, 8]\) का पता क्या होगा?

Options:

  • 1328
  • 1332
  • 1324
  • 1340
  • 1328
  • 1332
  • 1324
  • 1340

Correct Answer: a)

Explanation:

Row-major formula: \(\text{Address} = \text{Base} + [(i – \text{LB}_1) \times N_2 + (j – \text{LB}_2)] \times W\)
Here, \(\text{Base} = 1000, i = 6, \text{LB}_1 = 1, N_2 = 15, j = 8, \text{LB}_2 = 1, W = 4\):
\(\text{Offset} = [(6 – 1) \times 15 + (8 – 1)] = [5 \times 15 + 7] = [75 + 7] = 82\).
\(\text{Address} = 1000 + 82 \times 4 = 1000 + 328 = \textbf{1328}\) (Option a).

रो-मेजर सूत्र से: \(\text{पता} = 1000 + [(6-1) \times 15 + (8-1)] \times 4 = 1000 + 82 \times 4 = \textbf{1328}\) (विकल्प a)।

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top