#
10. Assume int[][] x = {{1, 2}, {3, 4, 5}, {5, 6, 5, 9}}, what are
x[0].length, x[1].length, and x[2].length?
a. 2, 3, and 4
b. 3, 3, and 3
#
11. Assume double[][][] x = new double[4][5][6], what are x.length,
x[2].length, and x[0][0].length?
a. 4, 5, and 6
b. 5, 5, and 5
c. 6, 5, and 4
d. 4, 5, and 4
#
12. What will be displayed by the following code?
public class Test {
public static void main(String[] args) {
double[][] m = {{1, 2, 3}, {1.5, 2.5, 3.5}, {0.1, 0.1, 0.1}};
System.out.println(sum(m));
}
public static double sum(double[][] m) {
double sum = 0;
for (int i = 0; i < m.length; i++)
sum += m[i][i];
return sum;
}
}
a. 4
b. 3.0
#
13. Assume double[][] x = new double[4][5], what are x.length and
x[2].length?
a. 4 and 5
b. 5 and 5
c. 5 and 4
d. 4 and 4
#
14. Which of the following statements are correct?