18.3k views
2 votes
var testScores = []; testScores[0] = [80, 82, 90, 87, 85]; testScores[1] = [79, 80, 74, 82, 81]; testScores[2] = [93, 95, 89, 100, 85]; testScores[3] = [60, 72, 65, 71, 79]; (Refer to code example 16-1) Which of the following returns a value of 89?a.testScores[3][1]b.testScores[0][4]c.testScores[2][2]d.testScores[1][3]

User Jgraft
by
6.6k points

1 Answer

5 votes

Answer:

C) testScores[2][2]

Step-by-step explanation:

Consider that the above has been translated into a java program. A two dimentional array is declared to hold the value of the testScores.

The complete program and the output is given below

public class twoDimenTestScores {

public static void main(String[] args) {

int[][] testScores = {

{80, 82, 90, 87, 85},

{79, 80, 74, 82, 81},

{93, 95, 89, 100, 85},

{60, 72, 65, 71, 79}

};

System.out.println(testScores[3][1]); // prints 72

System.out.println(testScores[0][4]); // prints 85

System.out.println(testScores[2][2]); // prints 89

System.out.println(testScores[1][3]); // prints 82

}

}

User Mauryat
by
7.2k points