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

Question 711

Multiple choice Unit 1: Using Objects and Methods
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 Unit 1: Using Objects and Methods
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 Unit 1: Using Objects and Methods
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 Unit 1: Using Objects and Methods
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 Unit 1: Using Objects and Methods
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 Unit 1: Using Objects and Methods
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 Unit 1: Using Objects and Methods
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 Unit 1: Using Objects and Methods
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 Unit 1: Using Objects and Methods
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 Unit 1: Using Objects and Methods
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 3,140
Page 72 of 314