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 351–360 of 776
  1. 351
  2. 352
  3. 353
  4. 354
  5. 355
  6. 356
  7. 357
  8. 358
  9. 359
  10. 360

Question 351

Multiple choice Primitive Types
Consider the following method: public static int mystery(int y) { y = 2 * y + y; y = 2 * y + y; return y; } Which of the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 352

Multiple choice Using Objects
Given the following code segment: String s1 = new String("hi"); String s2 = new String("hi"); String s3 = s2;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 353

Multiple choice Using Objects
Consider the following code segment: String s1 = "Hi There"; String s2 = s1; String s3 = s2; String s4 =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 354

Multiple choice Using Objects
Given the following code segment: String s = "Computer Science is fun!"; String s1 = s.substring(0,8); String s2…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 355

Multiple choice Using Objects
Consider the following code segment: String s1 = new String("hi"); String s2 = new String("hi there"); String s3 = s2.substring(0, 2);…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 356

Multiple choice Using Objects
Consider the following code segment: public static void test(String str, int y) { str = str + "bow"; y = y *…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 357

Multiple choice Using Objects
Consider the following code segment: String str = "mnopqr"; for (int x = 0; x < str.length() - 1; x++) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 358

Multiple choice Using Objects
Consider the following code segment: int x = 2; int y = -1; while (x < 30) { x =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 359

Multiple choice Using Objects
Consider the following class declaration: public class Test { private int value; public Test(int n) { value = n; } public void add(int amount) { value = value +…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 360

Free response Using Objects
This question involves the design of a simulation of birds or a bear eating from a bird feeder. You will write two methods of the Feeder class below. public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 351 of 776
Page 36 of 78