Verityprep
Question Bank

AP® Computer Science A Practice Questions

Work through AP Computer Science A practice questions unit by unit, 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 3,140
  1. 321
  2. 322
  3. 323
  4. 324
  5. 325
  6. 326
  7. 327
  8. 328
  9. 329
  10. 330

Question 321

Multiple choice Unit 1: Using Objects and Methods
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 Unit 1: Using Objects and Methods
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 Unit 1: Using Objects and Methods
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 Unit 1: Using Objects and Methods
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 Unit 1: Using Objects and Methods
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 Unit 1: Using Objects and Methods
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 Unit 1: Using Objects and Methods

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 328

Multiple choice Unit 1: Using Objects and Methods
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 Unit 1: Using Objects and Methods
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 Unit 1: Using Objects and Methods
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 3,140
Page 33 of 314