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 221–230 of 3,140
  1. 221
  2. 222
  3. 223
  4. 224
  5. 225
  6. 226
  7. 227
  8. 228
  9. 229
  10. 230

Question 221

Multiple choice Unit 1: Using Objects and Methods
The following incomplete method is intended to simulate a spinner in a game by returning "red", "blue", or "green" with equal probability. public static String…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 222

Multiple choice Unit 1: Using Objects and Methods
Consider the following code segment. int r = 23; int t = 10; double a = r % t; double b = r / t;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 223

Multiple choice Unit 1: Using Objects and Methods
The following method is intended to return a string that is formed by exchanging the first and last characters of its string parameter. For example, the call…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 224

Multiple choice Unit 1: Using Objects and Methods
Consider the following class definition. public class WordPlay { private String word; public WordPlay(String w) { word = w; } public void update(String first) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 225

Multiple choice Unit 1: Using Objects and Methods
Which of the following pairs of declarations will cause an error message? I double x…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 226

Multiple choice Unit 1: Using Objects and Methods
What output will be produced by the following?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 227

Multiple choice Unit 1: Using Objects and Methods
Refer to the following code fragment. double answer = 13 / 5; System.out.println("13 / 5 = " + answer); The output is 13 / 5 = 2.0 The…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 228

Multiple choice Unit 1: Using Objects and Methods
What value is stored in result if…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 229

Multiple choice Unit 1: Using Objects and Methods
Suppose that addition and subtraction had higher precedence than multiplication and…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 230

Multiple choice Unit 1: Using Objects and Methods
Which is true of the following boolean expression, given…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 221 of 3,140
Page 23 of 314