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,271–2,280 of 3,140
  1. 2271
  2. 2272
  3. 2273
  4. 2274
  5. 2275
  6. 2276
  7. 2277
  8. 2278
  9. 2279
  10. 2280

Question 2271

Multiple choice Unit 4: Data Collections
If list initially contains [6,1,8], what does it…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2272

Multiple choice Unit 4: Data Collections
Assume coins contains nonnull Coin objects. Which replaces /* more code */ in getTotal? public class Coin { private double value private String name public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2273

Multiple choice Unit 4: Data Collections
In Purse.find, coins and aCoin are nonnull. Coins with the same name have the same value, and vice versa. Which replacement detects a match? public class Coin {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2274

Multiple choice Unit 4: Data Collections
Which initializes an8×10 int matrix with all entries perfect squares, including 0? I int[][] mat=new int[8][10]; II int[][] mat=new int[8][10]; for(int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2275

Multiple choice Unit 4: Data Collections
Consider the following code segment. int[][] mat = {{1,3,5}, {2,4,6}, {0,7,8}, {9,10,11}}; for (int col = 0; col < mat[0].length; col++) for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2276

Multiple choice Unit 4: Data Collections
Consider a class that has this private instance variable. private int[][] mat; The class has the following method, alter. public void alter(int c) { for (int i…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2277

Multiple choice Unit 4: Data Collections
Consider the following method that will alter the matrix mat. public static void matStuff(int[][] mat, int row) { int numCols = mat[0].length; for (int col…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2278

Multiple choice Unit 4: Data Collections
Assume that a square matrix mat is defined by int[][] mat = new int[SIZE][SIZE]; // SIZE is an integer constant >= 2 What does the following code segment do?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2279

Multiple choice Unit 4: Data Collections
Consider a class MatrixStuff that has a private instance variable. private int[][] mat; Refer to method alter below that occurs in the MatrixStuff class. (The…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2280

Multiple choice Unit 4: Data Collections
This question refers to the following method. public static boolean isThere(String[][] mat, int row, int col, String symbol) { boolean yes; int i, count = 0;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2,271 of 3,140
Page 228 of 314