Verityprep
Question Bank · Unit 1

AP® Computer Science A Using Objects and Methods FRQ

Work through AP Computer Science A free-response 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 31–40 of 95
  1. 31
  2. 32
  3. 33
  4. 34
  5. 35
  6. 36
  7. 37
  8. 38
  9. 39
  10. 40

Question 31

Free response Using Objects
Given a string and a second "word" string, we'll say that the word matches the string if it appears at the front of the string, except its first char does not…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 32

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 33

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 34

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 35

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 36

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 37

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 38

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 39

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 40

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 31 of 95
Page 4 of 10