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 471–480 of 740
  1. 471
  2. 472
  3. 473
  4. 474
  5. 475
  6. 476
  7. 477
  8. 478
  9. 479
  10. 480

Question 471

Multiple choice Iteration
Consider the following code segment. String s = "aaaa"; int n = 0; while (s.length() > 1…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 472

Multiple choice Iteration
Consider the following code segment. int count = 0; for (int r = 0; r < 3; r++) { for (int c = r;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 473

Multiple choice Iteration
Consider the following code segment. int count = 0; for (int r = 0; r < 4; r++) { for (int c = 0;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 474

Multiple choice Boolean Expressions
Consider the following code segment. int x = 4; int y = 9; int z = 2; boolean…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 475

Multiple choice Boolean Expressions
Consider the following code segment. int a = 5; int b = 2; int c = 7; boolean…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 476

Free response Boolean Expressions
This problem involves calculating the total amount due for a restaurant bill, including tip and a possible service charge for large groups, then dividing among…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 477

Free response Boolean Expressions
This question involves library members who borrow and return books through a public library. A library tracks how many copies of each book are currently…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 478

Multiple choice Boolean Expressions
What is printed by the following code segment? int n = 6; if (n % 2 == 0)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 479

Multiple choice Boolean Expressions
What is the value of r after the following code segment is executed? int a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 480

Multiple choice Boolean Expressions
What is printed by the following code segment? int x = 0; int y = 6; if (x != 0 && y / x > 2)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 471 of 740
Page 48 of 74