Exam-style question
Try this first
A programmer needs to represent a 4 by 5 grid of integer values. Explain how a two-dimensional array can model this grid. Then describe how the idea generalises to an n-dimensional array, including the role of the indexing tuple.
Answer and explanation
Concise answer
A two-dimensional array can contain four rows and five columns, with each element being an integer.
Why this is correct
The answer links the two-dimensional case to the general definition. It identifies the dimensions, the common data type, and the fact that an ordered tuple of n integers identifies an element. A matrix or grid is a suitable example of a two-dimensional array.
Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.
Common mistake
No common mistake is linked to this question yet.
