Computer Applications
Differentiate between one-dimensional and two-dimensional arrays.
Java Arrays
3 Likes
Answer
| One-dimensional array | Two-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. |
Answered By
3 Likes
Related Questions
Write a function that checks whether or not two arrays (of characters) are identical, that is, whether they have same characters and all characters in corresponding positions are equal.
The marks obtained by 50 students in a subject are tabulated as follows:-
Name Marks ….. ….. ….. ….. ….. ….. Write a program to input the names and marks of the students in the subject.
Calculate and display:
(a) The subject average marks (subject average marks = subject total/50).
(b) The highest marks in the subject and the name of the student. (The maximum marks in the subject are 100.)Explain
(i) Linear search method,
(ii) Binary search method.
Which of the two is more efficient for sorted data ?
Write a program Lower-left-half which takes a two dimensional array A, with size N rows and N columns as argument and prints the lower left-half.
2 3 1 5 0 7 1 5 3 1 e.g.,If A is 2 5 7 8 1 0 1 5 0 1 3 4 9 1 5 2 7 1 The output will be 2 5 7 0 1 5 0 3 4 9 1 5