Verityprep
Question Bank · Unit 1

AP® Computer Science A Using Objects and Methods Practice Questions

Work through AP Computer Science A practice questions on Using Objects and Methods, 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 776
  1. 221
  2. 222
  3. 223
  4. 224
  5. 225
  6. 226
  7. 227
  8. 228
  9. 229
  10. 230

Question 221

Multiple choice Using Objects
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 Primitive Types
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 Using Objects
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 Using Objects
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 Primitive Types
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 Using Objects
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 Primitive Types
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 Primitive Types
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 Primitive Types
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 Primitive Types
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 776
Page 23 of 78