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 281–290 of 740
  1. 281
  2. 282
  3. 283
  4. 284
  5. 285
  6. 286
  7. 287
  8. 288
  9. 289
  10. 290

Question 281

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

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 282

Free response Iteration
This question involves dog walkers who are paid through a dog-walking company to take dogs for one-hour walks. A dog-walking company has a varying number of…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 283

Multiple choice Iteration
A programmer has mistakenly placed a semicolon at the end of the while statement in the following code fragment. What will be the result of…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 284

Multiple choice Iteration
Consider the following code segment: Line 1: int count = 0; Line 2: for (int i = 0; i < 3; i++) Line 3: { Line 4: int j = 0; Line 5: while (j <…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 285

Multiple choice Iteration
How many times is "Hello" printed by the following code? for (int i = 1; i…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 286

Multiple choice Iteration
Consider the following code segment. What is the final value of product? int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 287

Multiple choice Iteration
A method is intended to return the largest digit in an…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 288

Multiple choice Boolean Expressions
What is printed by the following code? int x = 5; if (x > 3) { if (x > 7)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 289

Multiple choice Iteration
What is the output of this code segment? int a = 3, b = 7;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 290

Multiple choice Iteration
What is the value of result after the following executes? String result = "";…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 281 of 740
Page 29 of 74