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 1–10 of 2,811
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10

Question 1

Multiple choice Unit 1: Using Objects and Methods
Consider the following code segment. int a = 3 + 2 * 3; int b = 4 + 3 / 2; int c = 7 %…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2

Multiple choice Unit 1: Using Objects and Methods
Consider the method getHours, which is intended to calculate the number of hours that a vehicle takes to travel between two mile markers on a highway if the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 3

Multiple choice Unit 1: Using Objects and Methods
Consider the following method. public static void message(int a, int b, int c) { if (a < 10) { if (b < 10) { System.out.print("X"); }…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 4

Multiple choice Unit 1: Using Objects and Methods
Which of the following expressions evaluate to 3.5? I.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 5

Multiple choice Unit 1: Using Objects and Methods
Consider the following method. public static void printSome(int num1, int num2) { for (int i = 0;i < num1;i++) { if (i % num2…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 6

Multiple choice Unit 1: Using Objects and Methods
The following categories are used by some researchers to categorize zip codes as urban, suburban, or rural based on population density. An urban zip code is a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 7

Multiple choice Unit 1: Using Objects and Methods
Consider the following code segment. Assume that a is greater than zero. int a = / * value not shown * /; int b = a +…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 8

Multiple choice Unit 1: Using Objects and Methods
Consider the following method. public static String rearrange(String str) { String temp = ""; for (int i = str.length() - 1;i >…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 9

Multiple choice Unit 1: Using Objects and Methods
Consider the following method. public static String abMethod(String a, String b) { int x = a.indexOf(b); while (x >= 0) { a = a.substring(0, x) +…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 10

Multiple choice Unit 1: Using Objects and Methods
Consider the following methods. /** Precondition: a > 0 and b > 0 */ public static int methodOne(int a, int b) { int loopCount = 0; for (int i = 0; i < a / b;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1 of 2,811
Page 1 of 282