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 261–270 of 740
  1. 261
  2. 262
  3. 263
  4. 264
  5. 265
  6. 266
  7. 267
  8. 268
  9. 269
  10. 270

Question 261

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 262

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 263

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 264

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 265

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 266

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 267

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 268

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 269

Multiple choice Iteration
Consider the following output: 0 1 0 2 4 0 3 6 9 0 4 8 12 16…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 270

Multiple choice Iteration
Consider the following code segment: int x = 10; int y = 3; boolean b = true; for (int i = 0; i < 15; i += 5) { x…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 261 of 740
Page 27 of 74