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

Question 491

Multiple choice 2D Arrays
Consider the following code segment. int[][] mat = new int[3][4]; for (int row = 0; row < mat.length; row++) { for (int col = 0; col < mat[0].length; col++) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 492

Multiple choice Arraylists
Consider the following methods. public List<Integer> process1(int n) { List<Integer> someList = new ArrayList<Integer>(); for (int k = 0; k < n; k++)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 493

Multiple choice Arrays
Consider the following instance variable and incomplete method, partialSum, which is intended to return an integer array sum such that for all i, sum[i] is…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 494

Free response 2D Arrays
This question involves a two-dimensional array of integers that represents a collection of randomly generated data. A partial declaration of the Data class is…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 495

Multiple choice Arraylists
What is printed? Assume java.util.ArrayList has been imported. public class Java1102 { public static void main(String[] args) { ArrayList names=new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 496

Multiple choice Arraylists
Consider this program segment. You may assume that wordList has been declared as ArrayList<String>. for (String s :…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 497

Multiple choice Recursion
Refer to the following method. public static int mystery(int n) { if (n == 1)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 498

Multiple choice Arraylists
Refer to the following declarations. String[] colors = {"red", "green", "black"}; ArrayList<String> colorList = new ArrayList<String>(); Which of the following…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 499

Multiple choice Sorting And Searching
Often the most efficient computer algorithms use a divide-and-conquer approach, for example, one in which a list is repeatedly split into two pieces until a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 500

Multiple choice Arraylists
Refer to method removeWord. /** Removes all occurrences of word from wordList. /** Precondition: wordList is an ArrayList of String objects. * Postcondition:…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 491 of 1,222
Page 50 of 123