Verityprep
Question Bank

AP® Computer Science A Multiple Choice Questions

Work through AP Computer Science A multiple-choice 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,361–2,370 of 2,811
  1. 2361
  2. 2362
  3. 2363
  4. 2364
  5. 2365
  6. 2366
  7. 2367
  8. 2368
  9. 2369
  10. 2370

Question 2361

Multiple choice Unit 4: Data Collections
Consider the following method: /* * Returns the number of zeros in s. * Precondition: s.length() = 31; s consists of several * '0's followed by several '1's *…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2362

Multiple choice Unit 4: Data Collections
Consider the following method: public String encrypt(String word) { int pos = word.length() / 2; if (pos >= 1) { word =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2363

Multiple choice Unit 4: Data Collections
Consider the following code segment. int[] nums = new int[8]; nums[0] = 0; int n = 1; while (n < nums.length) { int k; for (k = n; k < 2 *…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2364

Multiple choice Unit 4: Data Collections
What is printed when the following code segment is executed? int[] factors = {2, 3, 5}; ArrayList<Integer> products = new ArrayList<Integer>(); products.add(1);…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2365

Multiple choice Unit 4: Data Collections
Suppose names is an array of String objects: String[] names = {"Dan", "Ada", "Claire", "Evan", "Boris"}; public class SortX { public static void sort(String[]…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2366

Multiple choice Unit 4: Data Collections
Consider the following class: public class SortX { public static void sort(String[] items) { int n = items.length; while (n > 1) { sortHelper(items, n - 1);…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2367

Multiple choice Unit 4: Data Collections
What is printed when the following code segment is executed? ArrayList<Integer> lst = new ArrayList<Integer>(); for (int k = 1; k <= 6;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2368

Multiple choice Unit 4: Data Collections
Consider the following method: public int mysteryCount(int[] p) { int count = 0; for (int i = 0; i < p.length; i++) { count++; int j…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2369

Multiple choice Unit 4: Data Collections
Given the following code, which of the answers best describes the conditions needed for temp to be true, when it is returned?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2370

Multiple choice Unit 4: Data Collections
Consider the following code segment: List<String> list = new ArrayList<String>(); list.add("a"); list.add("b"); list.set(1, "c");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2,361 of 2,811
Page 237 of 282