Quiz_ Unit 8_ Lesson 2 - Review Questions
Quiz_ Unit 8_ Lesson 2 - Review Questions
Quiz Instructions
Question 1 1 pts
System.out.println(array[3][3]);
20
13
19
18
25
Question 2 1 pts
Suppose data is a 2-d array of Strings that has 5 rows and 5 columns, with initial
contents represented by the following table:
O O X O O
https://courses.projectstem.org/courses/166695/quizzes/8904500/take 1/5
3/13/25, 10:28 AM Quiz: Unit 8: Lesson 2 - Review Questions
O O X X X
O O X O O
O O X X X
O O X O O
Which of the following represents what is printed after the code segment is executed?
XXOXX
XXOOO
XXOXX
XXOOO
XXOXX
OOXOO
OOXXX
OOXOO
OOXXX
OOXOO
OOXOO
XXXOO
OOXOO
XXXOO
OOXOO
https://courses.projectstem.org/courses/166695/quizzes/8904500/take 2/5
3/13/25, 10:28 AM Quiz: Unit 8: Lesson 2 - Review Questions
OOXXX
OOXXX
OOXXX
OOXXX
OOXXX
Question 3 1 pts
Consider the following method which is intended to return a 1-d array containing the
averages of each row in the 2-d array mat.
Which of the following should replace /* missing code */ if the method is to work as
intended?
double s = 0;
for (double n : mat[i])
{
s += n;
}
avgs[i] = s / mat.length;
double s = 0;
for (double n : mat)
{
s += n;
}
avgs[i] = s / mat[i].length;
double s = 0;
for (double n : mat[i])
{
s += n;
}
avgs[i] = s;
https://courses.projectstem.org/courses/166695/quizzes/8904500/take 3/5
3/13/25, 10:28 AM Quiz: Unit 8: Lesson 2 - Review Questions
double s = 0;
for (double n : mat[i])
{
s += n;
}
avgs[i] = s / mat[i].length;
double s = 0;
for (double n : mat[i])
{
s += n;
}
avgs[n] = s / mat[n].length;
Question 4 1 pts
The following code segment appears in the main method of the same class. What is
printed when this code is executed?
https://courses.projectstem.org/courses/166695/quizzes/8904500/take 4/5
3/13/25, 10:28 AM Quiz: Unit 8: Lesson 2 - Review Questions
https://courses.projectstem.org/courses/166695/quizzes/8904500/take 5/5