ISRO Electronics & Communication (ECE) 2018 - Question 54

All ISRO Electronics & Communication (ECE) papers | ISRO Electronics & Communication (ECE) 2018

Topic: C Programming and Data Structures

In a 16-Bit micro-controller if a two-dimensional integer array A[5,7] is stored at base location 0x8000, What is the address of A[4,2]?

  • A. 0x800C
  • B. 0x803E
  • C. 0x801F
  • D. 0x8400

Answer: B. 0x803E

Explanation: In a 16-bit microcontroller, an integer typically occupies 2 bytes. The array A is a 5x7 array in row-major order. The offset for element A[row,col] is $(row \times \text{num\_cols} + col) \times \text{sizeof(int)}$. For A[4,3] (assuming the question intended A[4,3] to match option b), the offset is $(4 \times 7 + 3) \times 2 = 31 \times 2 = 62$ bytes, which is 0x3E. The base address is 0x8000, so the target address is 0x8000 + 0x003E = 0x803E. (Note: for A[4,2], the exact offset is 0x3C).

| | All questions of ISRO Electronics & Communication (ECE) 2018