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 41–50 of 1,079
  1. 41
  2. 42
  3. 43
  4. 44
  5. 45
  6. 46
  7. 47
  8. 48
  9. 49
  10. 50

Question 41

Multiple choice Sorting And Searching
The following incomplete method is intended to sort its array parameter arr in increasing order. // postcondition: arr is sorted in increasing order public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 42

Multiple choice 2D Arrays
Consider the following method. Method allEven is intended to return true if all elements in array arr are even numbers; otherwise, it should return false.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 43

Multiple choice Arrays
Consider the following incomplete method. Method findNext is intended to return the index of the first occurrence of the value val beyond the position start in…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 44

Multiple choice Arraylists
Consider the following declaration of the class NumSequence, which has a constructor that is intended to initialize the instance variable seq to an ArrayList of…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 45

Multiple choice Recursion
Consider the following recursive method. public static String recur(int val) { String dig = "" + (val % 3); if (val / 3 > 0) return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 46

Multiple choice Recursion
Consider the following method. public String goAgain(String str, int index) { if (index >= str.length()) return str; return str +…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 47

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 48

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 49

Multiple choice Sorting And Searching
The following incomplete method is intended to sort the array a in ascending order. public void sort() { int maxCompare = a.length - 1; int lIndex = 0; int temp…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 50

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 41 of 1,079
Page 5 of 108