Computer Applications
Given that int z[ ][ ] = {{2, 6, 5}, {8, 3, 9}}; What will be value of z[1][0] and z[0][2] ?
- 2 and 9
- 8 and 5
- 2 and 5
- 6 and 3
Java Arrays
9 Likes
Answer
8 and 5
Reason — Two-dimensional arrays are stored in a row-column matrix, where the first index indicates the row and the second indicates the column.
The element stored at z[1][0] refers to the element stored in second row and first column, which is 8.
The element stored at z[0][2] refers to the element stored in first row and third column, which is 5.
Answered By
2 Likes
Related Questions
Which of the following contain error ?
- int x[ ] = int[10];
- int[ ] y = new int[5];
- float d[ ] = {1, 2, 3};
- x = y = new int[10];
- int a[ ] = {1, 2}; int b[ ]; b = a;
- int i = new int(10);
Given that
int A[ ] = {35, 26, 19, 76, 58};
What will be value contained in A[3] ?- 35
- 26
- 19
- 76
- 58
Given array 12, 3, 8, 5. What will be array like after two passes of selection sort ?
- 12, 3, 8, 5
- 3, 5, 8, 12
- 3, 8, 5, 12
- 3, 5, 12, 8
Given an array 12, 3, 8, 5. What will be array like after two passes of bubble sort?
- 12, 3, 8, 5
- 3, 8, 12, 5
- 3, 5, 8, 12
- 12, 3, 5, 8