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.

Subtopic: Iteration Clear filter

Questions 361–370 of 376
  1. 361
  2. 362
  3. 363
  4. 364
  5. 365
  6. 366
  7. 367
  8. 368
  9. 369
  10. 370

Question 361

Multiple choice Iteration
What is printed as a result of executing the following code segment? for (int i = 1; i <= 4; i++) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 362

Multiple choice Iteration
What is printed as a result of executing the following code segment? int i =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 363

Multiple choice Iteration
What is printed as a result of executing the following code segment? for (int i = 3; i >= 1; i--) { for (int j = 0; j…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 364

Multiple choice Iteration
What is printed as a result of executing the following code segment? int max = 0; for (int i…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 365

Multiple choice Iteration
For every int n from 0 through 6 inclusive, which statement in the replacement loop preserves the final value of sum? Each version starts with int sum = 0;. //…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 366

Multiple choice Iteration
Each version begins with int a = 3; and int b = 2;. For every int n from 0 through 8 inclusive, which replacement body preserves…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 367

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

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 368

Multiple choice Iteration
Which of the following three code segments will produce the exact same output? // I. int i = 1; while (i < 27) { System.out.print(i + " "); i *= 3; } // II. for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 369

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

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 370

Multiple choice Iteration
The code below is intended to sum all positive even 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 361 of 376
Page 37 of 38