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 181–190 of 776
  1. 181
  2. 182
  3. 183
  4. 184
  5. 185
  6. 186
  7. 187
  8. 188
  9. 189
  10. 190

Question 181

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 182

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 183

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 184

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 185

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 186

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 187

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 188

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 189

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 190

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 181 of 776
Page 19 of 78