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 681–690 of 1,079
  1. 681
  2. 682
  3. 683
  4. 684
  5. 685
  6. 686
  7. 687
  8. 688
  9. 689
  10. 690

Question 681

Multiple choice Arrays
Consider the following method: public static void test(int[] a, int y) { if (a.length > 1) { a[1] = a[1] * 2; y = y *…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 682

Multiple choice Sorting And Searching
The following method should sort the contents of the array in ascending order using insertion sort. Which of the following should replace /* missing code */ to…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 683

Multiple choice Recursion
Consider the following recursive method: // precondition: x >= 0 public static void mystery(int x) { if…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 684

Multiple choice Arraylists
ArrayList<String> list = new ArrayList<String>(); list.add("A"); list.add("B"); list.add("C"); for (String s : list) { String t =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 685

Multiple choice 2D Arrays
public class FrequentFlyer { private int miles = 0; public FrequentFlyer(int m) { miles = m; } public void addMiles(int m) { miles += m;} public int getMiles()…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 686

Multiple choice Arraylists
Meetings use half-open intervals[start,end), so touching endpoints do not conflict. For meetings[2,4),[4,6),[3,5), what pair is returned by…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 687

Multiple choice Arrays
Two vertical lines at indices left and right enclose area(right−left)×min(height[left],height[right]). Return the greatest area; heights are nonnegative,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 688

Multiple choice Using Text Files
Which class is commonly used…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 689

Multiple choice Using Text Files
Which import statement is…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 690

Multiple choice Using Text Files
Which Scanner method…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 681 of 1,079
Page 69 of 108