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.

Subtopic: Using Objects Clear filter

Questions 481–490 of 546
  1. 481
  2. 482
  3. 483
  4. 484
  5. 485
  6. 486
  7. 487
  8. 488
  9. 489
  10. 490

Question 481

Multiple choice Using Objects
The non-null Strings a and b have already been declared. Each offered declaration is…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 482

Multiple choice Using Objects
What is printed? String a = "elm"; String b = "oak"; String result = "?"; if (a.compareTo(b) < 0)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 483

Multiple choice Using Objects
Which offered value of text makes count equal to 2? int count = 0; for (int i = 1; i <…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 484

Multiple choice Using Objects
What is printed? String text = "A2B4C"; String digits = "0123456789"; int total = 0; for (int i = 0; i < text.length(); i++) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 485

Multiple choice Using Objects
What is printed? String text = "aaaaa"; int hits = 0; for (int i = 0; i <= text.length() - 2;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 486

Multiple choice Using Objects
What is printed? String s = "ab"; while (s.length() < 7) { s +=…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 487

Multiple choice Using Objects
What is printed? String s = "aababb"; int removed = 0; while (s.indexOf("ab") != -1) { int p =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 488

Multiple choice Using Objects
What is printed? Each position range is counted separately, even if two ranges contain the same text. String s = "aba"; int count = 0; for (int i = 0; i <…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 489

Multiple choice Using Objects
Each entry has a three-letter lowercase name, a colon, and a two-digit code, such as "oak:27". Larger codes are preferred;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 490

Multiple choice Using Objects
Initially, 0 <= p <= text.length(), and marker is nonempty. The first assignment inserts marker at p. Which statement makes the second assignment insert "|"…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 481 of 546
Page 49 of 55