Verityprep
Question Bank · Unit 4

AP® Computer Science A Data Collections Multiple Choice Questions

Work through AP Computer Science A multiple-choice questions on Data Collections, then check each answer against a worked solution.

Free · no sign-up Open questions need no account. Sign up or log in to open the rest.

Questions 61–70 of 1,079
  1. 61
  2. 62
  3. 63
  4. 64
  5. 65
  6. 66
  7. 67
  8. 68
  9. 69
  10. 70

Question 61

Multiple choice 2D Arrays
Given the following definition: int len = 4; int[][] matrix = new int[len][len]; Consider the following code: int total = 0; for (int row = 0;row < len;row++) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 62

Multiple choice Arraylists
Consider the following field and method declarations. private List list; public void mystery(int n) { for (int i = 0; i Assume that list has been…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 63

Multiple choice Recursion
Consider the following method. public static int recur(int n) { if (n <= 1) return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 64

Multiple choice Arraylists
Consider the following code segment. List<String> list = new ArrayList<String>(); list.add("a"); list.add("b"); list.set(1, "c");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 65

Multiple choice 2D Arrays
Given the following method and what would the result be when m is executed? public void m(int[][] p) { int height = p.length; for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 66

Multiple choice Recursion
What is the output from mystery(4321) when mystery is defined as follows: Precondition: \(x \geq 0\) public static…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 67

Multiple choice Arrays
Given the following code which of the answers best describes the conditions needed for temp to be true when it is returned?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 68

Multiple choice Sorting And Searching
Which replacement for /* missing code */ sorts a in ascending order? public static void sort(int[] a) { int maxCompare = a.length - 1 int savedIndex = 0 int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 69

Multiple choice Recursion
Consider the following method. What value is returned from a call of mystery(4)?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 70

Multiple choice Sorting And Searching
Which correctly shows the successive outer-loop…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 61 of 1,079
Page 7 of 108