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 41–50 of 92
  1. 41
  2. 42
  3. 43
  4. 44
  5. 45
  6. 46
  7. 47
  8. 48
  9. 49
  10. 50

Question 41

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 42

Free response Using Objects
Given two strings, a and b, create a bigger string made of the first char of a, the first char of b, the second char of a, the second char of b, and so on. Any…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 43

Free response Using Objects
Given a string and an int n, return a string made of n repetitions of the last n characters of the string. You may assume that n is between 0 and the length of…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 44

Free response Using Objects
Given a string and an int n, return a string made of the first n characters of the string, followed by the first n-1 characters of the string, and so on. You…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 45

Free response Using Objects
Given two strings, word and a separator sep, return a big string made of count occurrences of the word, separated by the separator string.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 46

Free response Using Objects
Given a string, consider the prefix string made of the first N chars of the string. Does that prefix string appear somewhere else in the string? Assume that the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 47

Free response Using Objects
Given a string, does "xyz" appear in the middle of the string? To define middle, we'll say that the number of chars to the left and right of the "xyz" must…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 48

Free response Using Objects
A sandwich is two pieces of bread with something in between. Return the string that is between the first and last appearance of "bread" in the given string, or…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 49

Free response Using Objects
Returns true if for every '*' (star) in the string, if there are chars both immediately before and after the star, they are the same.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 50

Free response Using Objects
Given a string, compute a new string by moving the first char to come after the next two chars, so "abc" yields "bca". Repeat this process for each subsequent…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 41 of 92
Page 5 of 10