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 651–660 of 740
  1. 651
  2. 652
  3. 653
  4. 654
  5. 655
  6. 656
  7. 657
  8. 658
  9. 659
  10. 660

Question 651

Multiple choice Iteration
What is printed? int count = 0; for (int r = 1; r <= 4; r++) { for (int c =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 652

Multiple choice Iteration
The original loop prints six coordinate pairs. Which replacement for the comment inside the single loop makes it print exactly the same sequence? // Original…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 653

Multiple choice Iteration
Which replacement produces the same final values of both total and i as the original? Each version…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 654

Multiple choice Iteration
For every int n from 0 through 10 inclusive, which replacement leaves total equal to the original…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 655

Multiple choice Iteration
The code is intended to sum all positive odd integers less than or equal to n. Which…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 656

Multiple choice Iteration
For every int n from 1 through 6 inclusive, the code should count all executions of the inner body. Which single edit fixes…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 657

Multiple choice Iteration
Which statement describes the code? int x = 2;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 658

Multiple choice Iteration
Which replacement makes count equal to the number of integer divisions by 2 needed for a positive x to become 0? The original x…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 659

Multiple choice Iteration
Which replacement lets the loop terminate normally with d equal to 0, without throwing…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 660

Multiple choice Iteration
What is printed? Notice the semicolon immediately after the for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 651 of 740
Page 66 of 74