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 451–460 of 740
  1. 451
  2. 452
  3. 453
  4. 454
  5. 455
  6. 456
  7. 457
  8. 458
  9. 459
  10. 460

Question 451

Multiple choice Iteration
Consider the following code segment. int n = 50; int count = 0; while (n > 4) { if (n % 2 ==…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 452

Multiple choice Boolean Expressions
Which of the following is…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 453

Multiple choice Iteration
Consider the following code segment. int count = 0; for (int i = 0; i < 4; i++) { for (int j =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 454

Multiple choice Iteration
Consider the following method. public static int mystery(int n) { int count = 0; while (n > 0) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 455

Multiple choice Boolean Expressions
Consider the following declarations. int x = 0; int y = 5; boolean b…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 456

Multiple choice Iteration
Consider the following code segment. int total = 0; for (int i = 1; i <= 7; i++) { total…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 457

Multiple choice Boolean Expressions
Which of the following is true exactly when n is outside the range 5 through 12, inclusive?
Pick an answer, then check it. The solution opens in a window.

Question 458

Multiple choice Iteration
Consider the following code segment. int sum = 0; for (int k = 2; k <= 9; k = k + 2) { if (k…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 459

Multiple choice Boolean Expressions
Suppose a, b, and c are int variables. Which of the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 460

Multiple choice Iteration
Consider the following code segment. int n = 18; int total = 0; while (n > 0) { total…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 451 of 740
Page 46 of 74