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 691–700 of 740
  1. 691
  2. 692
  3. 693
  4. 694
  5. 695
  6. 696
  7. 697
  8. 698
  9. 699
  10. 700

Question 691

Multiple choice Iteration
Which replacement for the condition produces the required four-line output shown in the comment? Leading spaces are significant. /* Required output: * ** ***…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 692

Multiple choice Iteration
Which expression produces the required centered shape shown in the comment? Leading spaces are significant. /* Required output: * *** ***** */ for (int row = 1;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 693

Multiple choice Iteration
Which replacement for the condition produces the required output shown in the comment? /* Required output: *-*- -*-* *-*- */ for (int row = 0; row < 3;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 694

Multiple choice Iteration
Which output is produced? for (int row = 1; row <= 3; row++) { for (int col = 1; col <= 7; col++) { if (col…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 695

Multiple choice Iteration
Which single edit produces the required output shown in the comment, with no extra blank lines? /* Required output: ** **** ****** */…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 696

Multiple choice Iteration
Version I uses row == 0 || col == 0 as the condition. Version II uses row == 0 || col == n - 1. Which offered nonnegative int n is the smallest size for which…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 697

Multiple choice Iteration
For every int n from 0 through 8 inclusive, the loop should leave total equal to n * n. Which…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 698

Multiple choice Iteration
The code is intended to count the nonzero decimal digits of a positive int number. Which offered initial value…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 699

Multiple choice Iteration
Each version starts with int x = 0 and runs the displayed body four times. Version II changes the second if to else if. What are the final x…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 700

Multiple choice Iteration
Each version starts with int result = 3. For how many int values of n from 0 through 4 inclusive do the versions finish with the same…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 691 of 740
Page 70 of 74