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 711–720 of 776
  1. 711
  2. 712
  3. 713
  4. 714
  5. 715
  6. 716
  7. 717
  8. 718
  9. 719
  10. 720

Question 711

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 712

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 713

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 714

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 715

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 716

Multiple choice Using Objects
Which offered value of start makes both checks print true? String route = "red::blue::gold"; String tail =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 717

Multiple choice Using Objects
The nonempty String needle occurs at least twice in text. Overlapping occurrences count. first is the start of the first…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 718

Multiple choice Using Objects
The String s may be empty. The assignment should remove one outer pair of square brackets only when s begins with "[" and ends…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 719

Multiple choice Using Objects
The loop should keep one character from each consecutive run. For example, "aabbaa" must become "aba". Which condition correctly fills the blank for every text,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 720

Multiple choice Using Objects
The String original may contain any number of letters, including zero. Which expression is guaranteed to be true before the loop and after every…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 711 of 776
Page 72 of 78