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.

Subtopic: Using Objects Clear filter

Questions 51–60 of 92
  1. 51
  2. 52
  3. 53
  4. 54
  5. 55
  6. 56
  7. 57
  8. 58
  9. 59
  10. 60

Question 51

Free response Using Objects
Look for patterns like "zip" and "zap" in the string -- length-3, starting with 'z' and ending with 'p'. Return a string where for all such words, the middle…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 52

Free response Using Objects
Return a version of the given string, where for every star (*) in the string the star and the chars immediately to its left and right are gone. So "ab*cd"…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 53

Free response Using Objects
Given a string and a non-empty word string, return a version of the original String where all chars have been replaced by pluses ("+"), except for appearances…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 54

Free response Using Objects
Given a string and a non-empty word string, return a string made of each char just before and just after every appearance of the word in the string. Ignore…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 55

Free response Using Objects
Given a string, count the number of words ending in 'y' or 'z' -- so the 'y' in "heavy" and the 'z' in "fez" count, but not the 'y' in "yellow" (not case…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 56

Free response Using Objects
Given two strings, base and remove, return a version of the base string where all instances of the remove string have been removed (not case sensitive). You may…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 57

Free response Using Objects
Given a string, return true if the number of appearances of "is" anywhere in the string is equal to the number of appearances of "not" anywhere in the string…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 58

Free response Using Objects
We'll say that a lowercase 'g' in a string is "happy" if there is another 'g' immediately to its left or right. Return true if all the g's in the given string…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 59

Free response Using Objects
We'll say that a "triple" in a string is a char appearing three times in a row. Return the number of triples in the given string. The triples may…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 60

Free response Using Objects
Given a string, return the longest substring that appears at both the beginning and end of the string without overlapping. For example,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 51 of 92
Page 6 of 10