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 111–120 of 546
  1. 111
  2. 112
  3. 113
  4. 114
  5. 115
  6. 116
  7. 117
  8. 118
  9. 119
  10. 120

Question 111

Free response Using Objects
Given a string, return a "rotated right 2" version where the last 2 chars are moved to the start. The string length will be at least 2.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 112

Free response Using Objects
Given a string, return a string length 1 from its front, unless front is false, in which case return a string length 1 from its back. The string will be…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 113

Free response Using Objects
Given a string, return a version without both the first and last char of the string. The string may be any length, including 0.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 114

Free response Using Objects
Given a string of even length, return a string made of the middle two chars, so the string "string" yields "ri". The string length will be at least 2.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 115

Free response Using Objects
Given a string, return true if it ends in "ly". endsLy("oddly") → true endsLy("y") → false…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 116

Free response Using Objects
Given a string and an int n, return a string made of the first and last n chars from the string. The string length will be at least n. nTwice("Hello",…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 117

Free response Using Objects
Given a string and an index, return a string length 2 starting at the given index. If the index is too big or too small to define a string length 2, use the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 118

Free response Using Objects
Given a string of odd length, return the string length 3 from its middle, so "Candy" yields "and". The string length will be at…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 119

Free response Using Objects
Given a string, return true if "bad" appears starting at index 0 or 1 in the string, such as with "badxxx" or "xbadxx" but not "xxbadxx". The string may be any…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 120

Free response Using Objects
Given a string, return a string length 2 made of its first 2 chars. If the string length is less than 2, use '@' for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 111 of 546
Page 12 of 55