Assignment3 DDA
Assignment3 DDA
Assignment 3
Double Dimensional Array Questions
Q3. Consider the following two-dimensional array and answer the questions given below:
int x[][] ={{4,3,2}, {7,8,2}, {8, 3,10}, {1, 2, 9}};
(a) What is the order of the array?
(b) What is the value of x[0][0]+x[2][2]?
Q4 Which of the following represents the second element of the second row in a multi-
dimensional
array?
a) arr[0][1]
b) arr[0][0]
c) arr[1][0]
d) arr[1][1]
Q9 Write a program in Java to store the number in 4x4 matrix in a double dimensional
array find the highest and the lowest number of the matrix by using an input statement.
Sample Input:
The numbers of matrix are
12 21 13 14
24 41 51 33
61 11 30 29
59 82 41 76
Sample Output:
The lowest number in array = 11
The lowest number in array = 82
Q10 Define a class to accept values into an integer array of order 4 x 4 and check whether
it is DIAGONAL array or not. An array is DIAGONAL if the sum of the left diagonal
elements equals the sum of the right diagonal elements. Print the appropriate message
Example: 3 4 2 5
2 5 2 3
5 3 2 7
1 3 7 1
Sum of the left diagonal elements
3 + 5 + 2 + 1 = 11
Sum of the right diagonal elements
5 + 2 + 3 + 1 = 11