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 431–440 of 1,079
  1. 431
  2. 432
  3. 433
  4. 434
  5. 435
  6. 436
  7. 437
  8. 438
  9. 439
  10. 440

Question 431

Multiple choice Arrays
Consider the following method. public int doStuff(int[] numberArray) { int index = 0; int maxCounter = 1; int counter = 1; for (int k = 1; k <…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 432

Multiple choice Arrays
Consider the following method. public int changeEm(int num1, int num2, int[] values) { num1 = values[num2]; values[num1] = num2; num2++; return num2; } Consider…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 433

Multiple choice Arrays
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 434

Multiple choice Sorting And Searching
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 435

Multiple choice 2D Arrays
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 436

Multiple choice Arraylists
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 437

Multiple choice 2D Arrays
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 438

Multiple choice Sorting And Searching
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 439

Multiple choice Recursion
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 440

Multiple choice 2D Arrays
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 431 of 1,079
Page 44 of 108