HomeInterview QuestionsDefine a 2D array.

Define a 2D array.

🟢 Easy Conceptual Fresher level
1Times asked
Apr 2026Last seen
Apr 2026First seen

💡 Model Answer

A 2D array, also known as a two‑dimensional array or matrix, is a data structure that stores elements in a grid of rows and columns. It can be visualized as a table where each element is accessed by two indices: the row index and the column index. In most programming languages a 2D array is implemented as an array of arrays. For example, in JavaScript:

js
const matrix = [
  [1, 2, 3],
  [4, 5, 6],
  [7, 8, 9]
];

Here matrix[0] is the first row, and matrix[0][1] is the element in the first row, second column. 2D arrays are used for matrices, grids, game boards, image pixel data, and any scenario that naturally fits a tabular representation.

This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.

🎤 Get questions like this answered in real-time

Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers — invisible to screen sharing.

Get Assisting AI — Starts at ₹500