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,031–2,040 of 3,140
  1. 2031
  2. 2032
  3. 2033
  4. 2034
  5. 2035
  6. 2036
  7. 2037
  8. 2038
  9. 2039
  10. 2040

Question 2031

Multiple choice Unit 4: Data Collections
Consider the following method. /** Returns the index of searchVal, if found in list; * otherwise returns -1 */ public int binarySearch (ArrayList<String> list,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2032

Multiple choice Unit 4: Data Collections
int[][] t = new int[2][3]; for (int i = 0; i < t.length; i++) { for (int j = 0; j <…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2033

Multiple choice Unit 4: Data Collections
What is the outcome when the following code is compiled/executed? ArrayList<Integer> numbers = new ArrayList<Integer>();…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2034

Multiple choice Unit 4: Data Collections
Consider the following class. public class Matrix { private int[][] m; /** Initializes m to a square n-by-n array with all * the elements on the diagonal…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2035

Multiple choice Unit 4: Data Collections
Consider the following code segment. ArrayList<Integer> list = new ArrayList<Integer>(); list.add(1); list.add(2); for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2036

Multiple choice Unit 4: Data Collections
Consider the following method. public void reduce(int[] arr, int len) { for (int k = 0; k < len; k++) { arr[k]--; } len--; } What is printed when the following…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2037

Multiple choice Unit 4: Data Collections
How do you create an…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2038

Multiple choice Unit 4: Data Collections
What is a primary difference…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2039

Multiple choice Unit 4: Data Collections
True or false: adding an int or double primitive value to…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2040

Multiple choice Unit 4: Data Collections
What is printed? Assume ArrayList is imported. ArrayList array = new ArrayList () array.add(3);…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2,031 of 3,140
Page 204 of 314