ICSE Class 10 Computer Applications Question 38 of 71

Arrays — Question 38

Back to all questions
38
Question

Question 32

What do you understand by two-dimensional arrays ? State some situations that can be easily represented by two-dimensional arrays.

Answer

A two-dimensional array is an array in which each element is itself an array. For instance, an array A[M][N] is an M by N table with M rows and N columns containing M x N elements.

The general form of a two-dimensional array declaration in Java is as follows:
type array-name[ ][ ] = new type[rows][columns];

Some situations that can be easily represented by two-dimensional arrays are as follows:

  1. In a school, marks obtained by a student in various subjects can be stored in a two-dimensional array, where rows can be used for successive tests (mid term, quarterly, half yearly etc.) and columns can be used for subjects (maths, english, science, hindi, computer etc.).
  2. In a business, the sales for a month can easily be represented using a two-dimensional array, where rows can represent weeks and columns can represent the individual days in a week.