Verityprep
Question Bank

AP® Computer Science A Multiple Choice Questions

Work through AP Computer Science A multiple-choice questions unit by unit, 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 2,411–2,420 of 2,811
  1. 2411
  2. 2412
  3. 2413
  4. 2414
  5. 2415
  6. 2416
  7. 2417
  8. 2418
  9. 2419
  10. 2420

Question 2411

Multiple choice Unit 4: Data Collections
Consider the following code that is part of a class declaration: private int[] myStuff; // precondition: myStuff contains integers in no particular order public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2412

Multiple choice Unit 4: Data Collections
Consider the following declaration of the class RandomList, which has a constructor intended to initialize the instance variable numList to an ArrayList of n…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2413

Multiple choice Unit 4: Data Collections
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 2414

Multiple choice Unit 4: Data Collections
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 2415

Multiple choice Unit 4: Data Collections
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 2416

Multiple choice Unit 4: Data Collections
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 2417

Multiple choice Unit 4: Data Collections
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 2418

Multiple choice Unit 4: Data Collections
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 2419

Multiple choice Unit 4: Data Collections
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 2420

Multiple choice Unit 4: Data Collections
Which class is commonly used…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2,411 of 2,811
Page 242 of 282