UGC-NET Dec 2014 · Arrays & Matrix Representation

MCQ · 2 marks · Problem PROG-DSTR-0074

Consider an array $A\left[20, 10\right]$, assume $4$ words per memory cell and the base address of array $A$ is $100$. What is the address of $A\left[11, 5\right]$ ? Assume row major storage.
  1. A
    $560$
  2. B
    $565$
  3. C
    $570$
  4. D
    $575$

Solve it on GATE DA practice →More Basic Data Structures problems

Show the worked solution\[\boxed{\text{addr}(A[i,j])=B+(i\cdot n+j)\cdot w}\]Row-major, \(n=10\) columns, \(w=4\) words per cell, \(B=100\), with indices counted from 0:\[100+(11\cdot10+5)\cdot4=100+115\cdot4=100+460=560.\](Counting from 1 would give 516, which is not an option.)Answer: A

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com