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 491–500 of 1,079
  1. 491
  2. 492
  3. 493
  4. 494
  5. 495
  6. 496
  7. 497
  8. 498
  9. 499
  10. 500

Question 491

Multiple choice Recursion
Consider the following method. public int mystery(int n) { if (n == 0) return 0; else if (n % 2…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 492

Multiple choice 2D Arrays
A two-dimensional matrix mat with at least one row is initialized and will be traversed using…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 493

Multiple choice Arrays
A class of 30 students rated their computer science teacher on a scale of 1 to 10 (1 means awful and 10 means outstanding). The responses array is a 30-element…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 494

Multiple choice Arrays
Consider an array arr that is initialized with int values. The following code segment stores in count the number of positive values in arr. int count = 0, index…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 495

Multiple choice 2D Arrays
A square matrix is declared as int[][] mat = new int[SIZE][SIZE]; where SIZE is an appropriate integer constant. Consider the following method. public static…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 496

Multiple choice Arraylists
Consider the following declaration. ArrayList<Integer> list = new ArrayList<Integer>(); Which of the following code segments will place the integers 1 to 10, in…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 497

Multiple choice Arrays
Assume that a Book class has a compareTo method in which, if b1 and b2 are Book objects, b1.compareTo(b2) is a negative integer if b1 is less than b2, a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 498

Multiple choice Arraylists
Refer to the static method removeNegs shown below. /** Precondition: list is an ArrayList<Integer>. * Postcondition: All negative values have been removed from…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 499

Multiple choice Sorting And Searching
A sorted list of 120 integers is to be searched to determine whether the value 100 is in the list. Assuming…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 500

Multiple choice Sorting And Searching
Consider a sorted array arr of n elements, where n is large and n is even. Under which conditions will a sequential search of arr be faster…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 491 of 1,079
Page 50 of 108