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 321–330 of 776
  1. 321
  2. 322
  3. 323
  4. 324
  5. 325
  6. 326
  7. 327
  8. 328
  9. 329
  10. 330

Question 321

Multiple choice Using Objects
Consider the following expressions involving strings in Java: I. "Boston".equals(new String("Boston")); II. "Bos" + "ton" == new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 322

Multiple choice Using Objects
Consider the following code segment: double pi = 3.14159; int r = 10; int area = (int)(pi *…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 323

Multiple choice Using Objects
Assume that the String variables str1 and str2 have been properly declared and initialized. Which of the following…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 324

Multiple choice Primitive Types
Which of the following statements will print 1234? I. System.out.print(12 * 100…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 325

Multiple choice Using Objects
Consider the following code segment: String phrase = "Hello, world!"; int index = phrase.indexOf("world"); if (index >= 0) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 326

Multiple choice Primitive Types
Consider the following code snippet: public class MathOperations { public static void main(String[] args) { int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 327

Multiple choice Using Objects

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 328

Multiple choice Using Objects
Given the following code segment: String s = "ALASKA"; int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 329

Multiple choice Using Objects
What is the result when the following code segment is compiled and executed?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 330

Multiple choice Using Objects
Consider the following code segment. String s = "ban"; ArrayList<String> words = new ArrayList<String>(); words.add(s); words.add(s.substring(1));…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 321 of 776
Page 33 of 78