Verityprep
Question Bank

AP® Computer Science A Practice Questions

Work through AP Computer Science A practice 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,241–2,250 of 3,140
  1. 2241
  2. 2242
  3. 2243
  4. 2244
  5. 2245
  6. 2246
  7. 2247
  8. 2248
  9. 2249
  10. 2250

Question 2241

Multiple choice Unit 4: Data Collections
Consider the following method, which is intended to print the contents of a two-dimensional array of integers in row-major order. public static void…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2242

Multiple choice Unit 4: Data Collections
Consider the following code segment. int[] items = {10, 20, 30, 40, 50, 60}; int sum = 0; for (int k = items.length;k > items.length / 2;k--) { sum…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2243

Multiple choice Unit 4: Data Collections
Consider the following correct implementation of the selection sort algorithm. The method sorts an ArrayList of integers into ascending order. public static…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2244

Multiple choice Unit 4: Data Collections
public static void selectionSort(ArrayList<Integer> elements) { for (int j = 0;j < elements.size() - 1;j++) { / / Line 1 int index = j; for (int k = j + 1;k <…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2245

Multiple choice Unit 4: Data Collections
Consider the following code segment, which is intended to print true if all elements of the integer array arr are equal in value and false otherwise. Assume arr…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2246

Multiple choice Unit 4: Data Collections
Consider the following incomplete method, which is intended to reverse the elements in an array. public static void reverse(int[] values) { for (int k = 0;/ *…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2247

Multiple choice Unit 4: Data Collections
A rectangular playing board is to be set up so that in the even-numbered rows, there is an x in each odd-numbered column, and in the odd-numbered rows, there is…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2248

Multiple choice Unit 4: Data Collections
Consider the following method. public static String processWords(String[] words, int index) { String result; if (index >= words.length) { result = ""; } else {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2249

Multiple choice Unit 4: Data Collections
Which initializes an int array with four zero elements? I: int[] arr={0,0,0,0};…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2250

Multiple choice Unit 4: Data Collections
Assume location has been declared. The segment should locate the first negative…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2,241 of 3,140
Page 225 of 314