Verityprep
Question Bank · Unit 4

AP® Computer Science A Data Collections Practice Questions

Work through AP Computer Science A practice 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 441–450 of 1,222
  1. 441
  2. 442
  3. 443
  4. 444
  5. 445
  6. 446
  7. 447
  8. 448
  9. 449
  10. 450

Question 441

Multiple choice Sorting And Searching
Consider the following method. public void mystery (int[] array) { for (int i = 1; i < array.length; i++) { int j; int key = array[i]; for (j = i - 1; j >= 0 &&…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 442

Multiple choice Arraylists
Consider the following class declaration. public class City { private String name; private int population; public City(String myName, int myPop) { name =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 443

Free response Arraylists
Coin Collector The High School Coin Collection Club needs new software to help organize its coin collections. Each coin in the collection is represented by an…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 444

Multiple choice Arrays
Consider the following code segment. int[] myArray = {2, 3, 4, 1, 7, 6, 8}; int index = 0; while…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 445

Multiple choice Arraylists
Consider the following class used by a company to represent the items it has available for online purchase. public class OnlinePurchaseItem { public double…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 446

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

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 447

Multiple choice Recursion
Consider the following method. public int guess(int num1, int num2) { if (num1 % num2 == 0) return (num2 + num1) / 2; return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 448

Multiple choice Arraylists
Consider the following code segment. String crazyString = "crazy"; ArrayList<String> crazyList = new ArrayList<String>(); crazyList.add("weird");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 449

Multiple choice Arrays
Assume int[] arr has been correctly instantiated and is of sufficient size. Which of these code segments results in identical arrays? I. int i = 1; while (i…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 450

Multiple choice Arraylists
Consider the following code segment. ArrayList<String> nations = new ArrayList<String>(); nations.add("Argentina"); nations.add("Canada");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 441 of 1,222
Page 45 of 123