Verityprep
Question Bank · Unit 2

AP® Computer Science A Selection and Iteration Multiple Choice Questions

Work through AP Computer Science A multiple-choice 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 1–10 of 692
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10

Question 1

Multiple choice Boolean Expressions
Consider the following code segment. Assume num is a properly declared and initialized int variable. if (num > 0) { if (num % 2 == 0) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2

Multiple choice Boolean Expressions
Consider the following code segment. int num = /* initial value not shown */; boolean bl = true; if (num > 0) { if (num >= 100) { bl = false; } } else {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 3

Multiple choice Iteration
Which of the following code…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 4

Multiple choice Boolean Expressions
Assume that a, b, and c are boolean variables that have been properly declared and…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 5

Multiple choice Iteration
Consider the following two code segments. Assume that the int variables m and n have been properly declared and initialized and are both greater than 0. I. for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 6

Multiple choice Boolean Expressions
Consider the following statement. Assume that a and b are properly declared and initialized boolean variables.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 7

Multiple choice Iteration
Consider the following code segment. Assume that num3 > num2 > 0. int num1 = 0; int num2 = /* initial value not shown */; int num3 = /* initial value not…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 8

Multiple choice Iteration
Consider the following code segment. for (int r = 3; r > 0; r--) { int c; for (c = 1; c < r; c++) { System.out.print("-"); } for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 9

Multiple choice Boolean Expressions
Assume that x and y are boolean variables and have been properly initialized. (x || y)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 10

Multiple choice Iteration
Consider the following code segment. for (int outer = 1; outer <= 6; outer++) { for (int inner = outer; inner <= 6; inner++) { if…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1 of 692
Page 1 of 70