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 641–650 of 692
  1. 641
  2. 642
  3. 643
  4. 644
  5. 645
  6. 646
  7. 647
  8. 648
  9. 649
  10. 650

Question 641

Multiple choice Iteration
Version II moves only limit -= row to the start of the outer body, before the inner loop. Each version starts with count = 0 and limit = 5. What are the final…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 642

Multiple choice Iteration
Which output is produced? Spaces inside a line are significant. for (int row = 0; row < 3; row++) { for (int col = 0; col < 5; col++) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 643

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 644

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 645

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 646

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 647

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 648

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 649

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 650

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 641 of 692
Page 65 of 70