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 211–220 of 3,140
  1. 211
  2. 212
  3. 213
  4. 214
  5. 215
  6. 216
  7. 217
  8. 218
  9. 219
  10. 220

Question 211

Free response Unit 1: Using Objects and Methods
Given a string, return the length of the largest "block" in the string. A block is a run of adjacent chars that are the same.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 212

Free response Unit 1: Using Objects and Methods
Given a string, return a string where every appearance of the lowercase word "is" has been replaced with "is not". The word "is" should not be immediately…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 213

Multiple choice Unit 1: Using Objects and Methods
Consider the following code segment. int a = 5; int b = 2; double c = 3.0;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 214

Multiple choice Unit 1: Using Objects and Methods
Consider the processWords method. Assume that each of its two parameters is a String of length two or more. public void processWords(String word1, String word2)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 215

Multiple choice Unit 1: Using Objects and Methods
Which of the following statements assigns a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 216

Multiple choice Unit 1: Using Objects and Methods
Consider the following two methods, which are intended to return the same values when they are called with the same positive integer parameter n. public static…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 217

Multiple choice Unit 1: Using Objects and Methods
Consider the following code segment. double valOne = 5.75; double valTwo = 2.75; int x = (int) valOne + (int) valTwo; int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 218

Multiple choice Unit 1: Using Objects and Methods
Consider the method replaceStr, which is intended to return a string that is identical to orig except that all occurrences of string a are replaced by string b.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 219

Multiple choice Unit 1: Using Objects and Methods
The following method prints the value of start and then prints every other value up to, and possibly including, end. For example, the method call printRun(1, 7)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 220

Multiple choice Unit 1: Using Objects and Methods
Consider the following method. / * * Precondition: lim >= 0 * / public static void printLetters(int lim) { for (int m = 0;m < lim;m++) { for (int n = 0;n <…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 211 of 3,140
Page 22 of 314