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 331–340 of 546
  1. 331
  2. 332
  3. 333
  4. 334
  5. 335
  6. 336
  7. 337
  8. 338
  9. 339
  10. 340

Question 331

Multiple choice Using Objects
Given String s = "abcdefgh", what is the value of…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 332

Multiple choice Using Objects
Consider the following code segment: String s = "programming"; String t =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 333

Multiple choice Using Objects
Which of the following correctly extracts the last three…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 334

Multiple choice Using Objects
A method repeat is defined as: public static String repeat(String s, int n) { String r = "";…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 335

Multiple choice Using Objects
What is the output of the following code? String[] tokens = " hello…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 336

Multiple choice Using Objects
Consider the following method: public static String encode(String s) { String result = ""; for (int i =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 337

Free response Using Objects
A game application needs to process words. You will write two methods for the WordScrambler class, which has a single private instance variable: private String…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 338

Multiple choice Using Objects
Consider the following code segment. String s = "PRACTICE"; String t = s.substring(2, 6); int result =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 339

Multiple choice Using Objects
What is printed by the following? String p = "apple"; String q = "apricot"; String r = "app";…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 340

Multiple choice Using Objects
What is printed by the following? String msg = "artificial intelligence"; int space = msg.indexOf(" "); String first =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 331 of 546
Page 34 of 55