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 221–230 of 2,811
  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
Consider the following code segment. String str1 = "presto chango"; String str2 = "abracadabra"; int i =…

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
Which of the following returns the…

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
Which statement assigns a random integer…

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
After executing the code segment, what are the possible…

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 statements generates a…

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
Consider the following code segment. int r = 100; int answer = (int)(Math.PI * Math.pow(r,…

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
Consider the following code segment. String ex1 = "example"; String ex2 = "elpmaxe"; ex1 = ex1.substring(1, ex1.indexOf("p")); ex2 = ex2 + ex2.substring(3,…

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
Which print statement will produce the…

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
Consider the following code segment. int rand = (int)(Math.random() * 5 + 3); rand =…

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
Consider the following code segment. int val1 = 10; int val2 = 7; val1 = (val1 + val2) % (val1 - val2); val2 = 3 + val1 * val2;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 221 of 2,811
Page 23 of 282