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 131–140 of 546
  1. 131
  2. 132
  3. 133
  4. 134
  5. 135
  6. 136
  7. 137
  8. 138
  9. 139
  10. 140

Question 131

Free response Using Objects
Given a string, if the first or last chars are 'x', return the string without those 'x' chars, and otherwise return the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 132

Free response Using Objects
Given a string, if one or both of the first 2 chars is 'x', return the string without those 'x' chars, and otherwise return the string unchanged. This is a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 133

Free response Using Objects
Given a string, return a string where for every char in the original, there are two chars. doubleChar("The") → "TThhee"…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 134

Free response Using Objects
Return the number of times that the string "hi" appears anywhere in the given string. countHi("abc hi ho") → 1…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 135

Free response Using Objects
Return true if the string "cat" and "dog" appear the same number of times in the given string.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 136

Free response Using Objects
Return the number of times that the string "code" appears anywhere in the given string, except we'll accept any letter for the 'd', so…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 137

Free response Using Objects
Given two strings, return true if either of the strings appears at the very end of the other string, ignoring upper/lower case differences (in other words, the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 138

Free response Using Objects
Return true if the given string contains an appearance of "xyz" where the xyz is not directly preceeded by a period (.). So "xxyz" counts…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 139

Free response Using Objects
Return true if the given string contains a "bob" string, but where the middle 'o' char can be any char. bobThere("abcbob")…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 140

Free response Using Objects
We'll say that a String is xy-balanced if for all the 'x' chars in the string, there exists a 'y' char somewhere later in the string. So "xxy" is balanced, but…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 131 of 546
Page 14 of 55