
AP CSA Exam 8 Review
Authored by Caitlyn Choe
Computers
10th Grade - University
Used 16+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
3 mins âĒ 1 pt
Consider the following method:
Assume that the array test has been declared and initialized as follows.
int[] test = {1, 3, 2, 5, 8, 7, 0};
What value will be returned as a result of the call mystery(test)?
4
6
11
13
26
2.
MULTIPLE CHOICE QUESTION
3 mins âĒ 1 pt
Consider the following code segment.
int[][] matrix = new int[7][15];
Which of the following correctly gives the number of columns in the two-dimensional array matrix?
matrix[0]
matrix.length
matrix[matrix.length - 1 ]
matrix[0].length
matrix.length[0]
3.
MULTIPLE CHOICE QUESTION
3 mins âĒ 1 pt
3. Consider the following declaration for a two-dimensional array.
What element is displayed when the following line of code is executed?
System.out.println(grid[2][1]);
6
7
10
11
12
4.
MULTIPLE CHOICE QUESTION
3 mins âĒ 1 pt
Consider the following method intended to swap the first and last rows in a two-dimensional array:
Which of the following correctly replaces / missing code */?
none of the above
5.
MULTIPLE CHOICE QUESTION
3 mins âĒ 1 pt
Consider the following method declaration.
Assume the 2D array, matrix, has been initialized to the following values:
4 6 -15
5 11 21
-11 -10 3
4 -10 -18
-21 14 -23
What is the value of matrix after the method call, increment(matrix); ?
4 6 -15
5 11 21
-11 -10 3
4 -10 -18
-21 14 -23
5 7 -15
6 12 22
-11 -10 4
5 -10 -18
-21 15 -23
5 7 -14
6 12 22
-10 -9 4
5 -9 -17
-20 15 -22
4 6 -16
5 11 21
-12 -11 3
4 -11 -19
-22 14 -24
5 7 -16
6 12 22
-12 -11 4
5 -11 -19
-22 15 -24
6.
MULTIPLE CHOICE QUESTION
3 mins âĒ 1 pt
The following code is meant to find the smallest value in a 2-d array.
What should m be set to in order for the code to work as intended?
1000
0
-100000
Double.MIN_VALUE
Double.MAX_VALUE
7.
MULTIPLE SELECT QUESTION
3 mins âĒ 1 pt
Consider the following code.
int[][] matrix = new int[4][5];
Suppose we want to initialize matrix to the following rows and columns.
0 1 2 3 4
4 3 2 1 0
0 1 2 3 4
4 3 2 1 0
Which of the options below correctly initializes matrix? (Choose all that apply)
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?