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 111–120 of 692
  1. 111
  2. 112
  3. 113
  4. 114
  5. 115
  6. 116
  7. 117
  8. 118
  9. 119
  10. 120

Question 111

Multiple choice Iteration
Consider the following code segment. int val = 48; int div = 6; while ((val % 2 == 0) && div > 0) { if (val %…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 112

Multiple choice Boolean Expressions
Consider the following code segment. int x = / * some integer value * /; int y = / * some integer value * /; if (x > y && x % 2 == 0) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 113

Multiple choice Boolean Expressions
Consider the following code segment. Assume that x and y are properly declared and initialized integer variables. int z = 0;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 114

Multiple choice Iteration
Consider the following code segment. int n = 0; while (n < 10) { n += 2;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 115

Multiple choice Boolean Expressions
Consider the following code segment. Assume that value is a properly declared and initialized integer variable. if (value < 7) { value + = value;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 116

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

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 117

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 118

Multiple choice Iteration
Consider the following code segment. int t = 0; for (int v = 1;v < 20;/ * missing increment * / ) { t = t + v; } Which of the following…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 119

Multiple choice Iteration
Consider the following code segment. int x = 102; int y = 5; int c = 0; while (x - y >=…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 120

Multiple choice Boolean Expressions
Which of the following Java expressions evaluates to true if the int variable…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 111 of 692
Page 12 of 70