Multiple choice

When a multi-dimensional array is accessed, each array index is ________.

  1. separated by commas

  2. surrounded by brackets and separated by commas

  3. separated by commas and surrounded by brackets

  4. surrounded by brackets

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

When accessing elements in a multi-dimensional array in C++ or similar languages, each index must be enclosed in its own set of square brackets. For example, a two-dimensional array is accessed as matrix[i][j], where each index is surrounded by brackets.