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 11–20 of 2,811
  1. 11
  2. 12
  3. 13
  4. 14
  5. 15
  6. 16
  7. 17
  8. 18
  9. 19
  10. 20

Question 11

Multiple choice Unit 1: Using Objects and Methods
Consider the following incomplete method, which is intended to return the number of integers that evenly divide the integer inputVal. Assume that inputVal is…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 12

Multiple choice Unit 1: Using Objects and Methods
Consider the following method, which is intended to return true if at least one of the three strings s1, s2, or s3 contains the substring "art". Otherwise, the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 13

Multiple choice Unit 1: Using Objects and Methods
A pair of number cubes is used in a game of chance. Each number cube has six sides, numbered from 1 to 6, inclusive, and there is an equal probability for each…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 14

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

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 15

Multiple choice Unit 1: Using Objects and Methods
Consider the following method, biggest, which is intended to return the greatest of three integers. It does not always work as intended. public static int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 16

Multiple choice Unit 1: Using Objects and Methods
Consider the following method. /* Precondition: num > 0 */ public static int doWhat(int num) { int var = 0; for (int loop = 1;loop…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 17

Multiple choice Unit 1: Using Objects and Methods
What is printed as a result of executing the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 18

Multiple choice Unit 1: Using Objects and Methods
Consider the following code segment. int x = 1; while ( /* condition */ ) { if (x % 2 == 0) { System.out.print(x + " "); } x = x + 2; } The following…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 19

Multiple choice Unit 1: Using Objects and Methods
The price per box of ink pens advertised in an office supply catalog is based on the number of boxes ordered. The following table shows the pricing. Number of…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 20

Multiple choice Unit 1: Using Objects and Methods
Consider the following code segment. String str = "abcdef"; for (int rep = 0;rep < str.length() - 1;rep++) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 11 of 2,811
Page 2 of 282