Verityprep
Question Bank · Unit 2

AP® Computer Science A Selection and Iteration Practice Questions

Work through AP Computer Science A practice questions on Selection and Iteration, 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 271–280 of 740
  1. 271
  2. 272
  3. 273
  4. 274
  5. 275
  6. 276
  7. 277
  8. 278
  9. 279
  10. 280

Question 271

Multiple choice Iteration
In the following statement, a and b are boolean variables: boolean c =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 272

Multiple choice Iteration
Consider the following code segment: while ((x > y) || y >= z) { //code not shown } In the code segment above,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 273

Multiple choice Iteration
Consider the following code segment: int x = 10; int y = x / 3; int z = x % 2; x++;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 274

Multiple choice Iteration
Consider the following code segments: I. int x = 10; int y = 20; int z = 0; if (x < y && 10 < y/z) { System.out.println("Homer"); } else {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 275

Multiple choice Boolean Expressions
Given int x = 7 and int y = 3, what is…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 276

Multiple choice Iteration
Consider the following code segment: int sum = 0; for (int i = 1; i <= 5; i++) { if (i % 2 ==…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 277

Multiple choice Boolean Expressions
Consider the following boolean expression: !(x > 5 && y < 10) ||…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 278

Multiple choice Boolean Expressions
Consider the following code segment: int x = 5; int y = 10; boolean result = (x > 7) && (y++ <…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 279

Multiple choice Boolean Expressions
The following method is intended to return "Renaissance" for years from 1400 to 1600, inclusive, "Medieval" for years from 400 to 1399, inclusive, or "Other"…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 280

Multiple choice Iteration
Consider the following code segment. for (int j = 4; j > 0; j--) { for (/* missing code */) { System.out.print(k + " "); } System.out.println(); } This code…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 271 of 740
Page 28 of 74