Question discussion

A 2D array B[4][5] is stored in row-major order. The base address of the array is 5000, and each element occupies 2 bytes. What is the addr…

359027Medium DSSSB TGT Computer Science 0 replies 0 views
0
A 2D array B[4][5] is stored in row-major order. The base address of the array is 5000, and each element occupies 2 bytes. What is the address of B[2][3]?
  • A5054
  • B5039
  • C5048
  • D5026
Correct answer: D

Explanation

Address = base + ((i × columns) + j) × size = 5000 + (2 × 5 + 3) × 2 = 5000 + 26 = 5026.

Discussion 0

Nobody has replied yet. Start the discussion!