Verityprep
Question Bank

AP® Computer Science A Practice Questions

Work through AP Computer Science A practice 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,371–2,380 of 3,140
  1. 2371
  2. 2372
  3. 2373
  4. 2374
  5. 2375
  6. 2376
  7. 2377
  8. 2378
  9. 2379
  10. 2380

Question 2371

Multiple choice Unit 4: Data Collections
The following code segment appears in the main method of another class. AnotherClass[] acArray = new AnotherClass[10]; acArray[2] = new AnotherClass("two");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2372

Multiple choice Unit 4: Data Collections
A programmer intends to apply the standard Binary Search algorithm on the following array of integers. The standard Binary Search algorithm returns the index of…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2373

Multiple choice Unit 4: Data Collections
Consider the following code segment. int[][] nums = { {0, 1, 2}, {3, 4, 5}, {6, 7, 8} }; for (int x = 0;x < nums.length;x++) { int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2374

Multiple choice Unit 4: Data Collections
Consider the following code segment. ArrayList<Integer> newList = new ArrayList<Integer>(); Integer[] list = {2, 4, 3, 3, 2, 5, 1}; newList.add(list[0]); for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2375

Multiple choice Unit 4: Data Collections
Consider the following code segment. int [] [] a = new int [5] [5]; for (int r = 0;r < a.length;r++) for (int c = r + 1;c < a[0].length;c++) a[r][c] = 9; for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2376

Multiple choice Unit 4: Data Collections
Consider the following sorting method. public void mysterySort(int[] arr) { for (int j = 1; j < arr.length; j++) { int temp = arr[j]; int index = j; while…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2377

Multiple choice Unit 4: Data Collections
Consider the following method. public int puzzle(int m, int n) { if (n == 1) return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2378

Multiple choice Unit 4: Data Collections
Consider the following code segment. int [] [] table = new int [5] [6]; int val = 0; for (int k = 0;k < table[0].length;k++) { for (int j…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2379

Multiple choice Unit 4: Data Collections
Consider the following method. public void selectionSort(String[] arr) { for (int i = 0; i < arr.length; i++) { int small = i; for (int j = i; j < arr.length;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2380

Free response Unit 4: Data Collections
A train is composed of an engine and any number of train cars. The engine is rated to pull up to a maximum weight, based on its power. The weight of all the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2,371 of 3,140
Page 238 of 314