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 861–870 of 1,079
  1. 861
  2. 862
  3. 863
  4. 864
  5. 865
  6. 866
  7. 867
  8. 868
  9. 869
  10. 870

Question 861

Multiple choice Arraylists

What is printed?

ArrayList<Integer> list = new ArrayList<Integer>();
for (int i = 1; i <= 6; i++) {
    list.add(i * i);
}
// list = [1, 4, 9, 16, 25, 36]
for (int i = list.size() - 1; i >= 1; i -= 2) {
    list.set(i, list.get(i) - list.get(i - 1));
}
System.out.println(list);
Pick an answer, then check it. The solution opens in a window.

Question 862

Multiple choice Arrays
int[] arr = {4, 7, 2};…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 863

Multiple choice Arrays
int[] arr = new int[3];…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 864

Multiple choice Arrays
int[] arr = null;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 865

Multiple choice Arrays
int[] arr = new int[3];…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 866

Multiple choice Arrays
Integer[] arr = new Integer[3];…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 867

Multiple choice Arraylists
ArrayList<Integer> list = null;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 868

Multiple choice Arraylists
ArrayList<Integer> list = new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 869

Multiple choice Arrays
String[] arr = new String[3];…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 870

Multiple choice Arrays
String[] arr = null; if (arr == null) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 861 of 1,079
Page 87 of 108