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 221–230 of 692
  1. 221
  2. 222
  3. 223
  4. 224
  5. 225
  6. 226
  7. 227
  8. 228
  9. 229
  10. 230

Question 221

Multiple choice Boolean Expressions
Consider the following code. int x = 0; if (x == 0) System.out.print("1"); else System.out.print("2");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 222

Multiple choice Boolean Expressions
Consider the following boolean expression. (X && !Y) || (!X && Y) Which of…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 223

Multiple choice Boolean Expressions
Consider the following code segment. boolean a = true, b = false; if (/* missing code */) System.out.print("Nice job."); else System.out.print("Nicer job.");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 224

Multiple choice Boolean Expressions
Suppose p and q are declared as boolean variables and have been initialized to unknown…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 225

Multiple choice Boolean Expressions
Consider the following code segment: for (int i = 200; i > 0; i /= 3) { if (i % 2 == 0)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 226

Multiple choice Boolean Expressions
Suppose p and q are declared as boolean variables and have been initialized to unknown…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 227

Multiple choice Iteration
Consider the following code segment. int val1 = 2, val2 = 22, val3 = 78; while (val2 % val1 == 0…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 228

Multiple choice Iteration
What will be the output when the following code is evaluated? for (int k = 0; k < 3;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 229

Multiple choice Iteration
Consider the following code fragments. Assume someNum has been correctly defined and initialized as a positive integer. I. int i; for (i = 0; i < someNum; i++)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 230

Multiple choice Iteration
Consider the following code segment: for (int i = 1; i < 100; i = i * 2) { if (i / 50 ==…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 221 of 692
Page 23 of 70