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 161–170 of 546
  1. 161
  2. 162
  3. 163
  4. 164
  5. 165
  6. 166
  7. 167
  8. 168
  9. 169
  10. 170

Question 161

Free response Using Objects
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 162

Free response Using Objects
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 163

Multiple choice Using Objects
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 164

Multiple choice Using Objects
Which of the following statements assigns a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 165

Multiple choice Using Objects
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 166

Multiple choice Using Objects
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 167

Multiple choice Using Objects
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 168

Multiple choice Using Objects
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 169

Multiple choice Using Objects
The following incomplete method is intended to simulate a spinner in a game by returning "red", "blue", or "green" with equal probability. public static String…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 170

Multiple choice Using Objects
The following method is intended to return a string that is formed by exchanging the first and last characters of its string parameter. For example, the call…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 161 of 546
Page 17 of 55