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 261–270 of 3,140
  1. 261
  2. 262
  3. 263
  4. 264
  5. 265
  6. 266
  7. 267
  8. 268
  9. 269
  10. 270

Question 261

Free response Unit 1: Using Objects and Methods
This question involves reasoning about strings made up of uppercase letters. You will implement two related methods that appear in the same class (not shown).…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 262

Free response Unit 1: Using Objects and Methods
This question involves a game in which a player tries to hit a target by throwing a ball. You will write two static methods of the following BallGame class.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 263

Free response Unit 1: Using Objects and Methods
Consider the following class, FrogSimulation: (a) Write the simulate method, which simulates the frog attempting to hop in a straight line to a goal from the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 264

Free response Unit 1: Using Objects and Methods
A mathematical sequence is an ordered list of numbers. This question involves a sequence called a hailstone sequence. If \(n\) is the value of a term in the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 265

Multiple choice Unit 1: Using Objects and Methods
Consider the following code segment. String idk = "mnomnomno"; for (int i = 0; i < idk.length(); i++) { if (idk.substring(i, i + 1).equals("m")) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 266

Multiple choice Unit 1: Using Objects and Methods
Consider the following method. public String lengthen(String word) { int index = 0; while (index < word.length()) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 267

Multiple choice Unit 1: Using Objects and Methods
Consider the following method. public int mystery(String code, int index) { if (code.indexOf("c") == index) { return index; } return mystery(code.substring(2),…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 268

Multiple choice Unit 1: Using Objects and Methods
Consider the following statement. int number = (int)(Math.random() * 21 + 13);…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 269

Multiple choice Unit 1: Using Objects and Methods
Consider the following code segment. int myValue = 17; int multiplier = 3; int answer = myValue % multiplier + myValue /…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 270

Multiple choice Unit 1: Using Objects and Methods
Consider the following code segment. String myString = "H"; int index = 0; while (index < 4) { for (int i = 0;i <…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 261 of 3,140
Page 27 of 314