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 171–180 of 776
  1. 171
  2. 172
  3. 173
  4. 174
  5. 175
  6. 176
  7. 177
  8. 178
  9. 179
  10. 180

Question 171

Free response Using Objects
Given 2 strings, a and b, return a new string made of the first char of a and the last char of b, so "yo" and "java" yields "ya". If either string is length 0,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 172

Free response Using Objects
Given two strings, append them together (known as "concatenation") and return the result. However, if the concatenation creates a double-char, then omit one of…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 173

Free response Using Objects
Given a string of any length, return a new string where the last 2 chars, if present, are swapped, so "coding" yields "codign".…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 174

Free response Using Objects
Given a string, if the string begins with "red" or "blue" return that color string, otherwise return the empty string. seeColor("redxx")…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 175

Free response Using Objects
Given a string, return true if the first 2 chars in the string also appear at the end of the string, such as with "edited".…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 176

Free response Using Objects
Given two strings, append them together (known as "concatenation") and return the result. However, if the strings are different lengths, omit chars from the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 177

Free response Using Objects
Given a string, return a new string made of 3 copies of the first 2 chars of the original string. The string may be any length. If there are fewer than 2 chars,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 178

Free response Using Objects
Given a string, if a length 2 substring appears at both its beginning and end, return a string without the substring at the beginning, so "HelloHe" yields…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 179

Free response Using Objects
Given a string, return a version without the first 2 chars. Except keep the first char if it is 'a' and keep the second char if it is 'b'. The string may be any…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 180

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 171 of 776
Page 18 of 78