ICSE Class 10 Computer Applications Question 46 of 71

Arrays — Question 46

Back to all questions
46
Question

Question 40

Differentiate between one-dimensional and two-dimensional arrays.

Answer
One-dimensional arrayTwo-dimensional array
One-dimensional array stores data in a single row or column.Two-dimensional array stores data in a grid or table, with rows and columns.
It uses one index to access array elements.It uses two indices to access array elements.
For example,
int arr[] = new int[10];
It creates a one dimensional array arr which stores 10 elements of int type.
For example,
int arr[][] = new int [3][3];
It creates a two dimensional array which has three rows and three columns to store 3 x 3 = 9 elements of int type.