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 531–540 of 740
  1. 531
  2. 532
  3. 533
  4. 534
  5. 535
  6. 536
  7. 537
  8. 538
  9. 539
  10. 540

Question 531

Multiple choice Boolean Expressions
The int variables n and d satisfy 0 <= n <= 100 and 1 <= d <= 20.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 532

Multiple choice Boolean Expressions
Each offered initial value is used in a separate run. Which value of stock makes earlier and now different? int stock = /* value */;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 533

Multiple choice Boolean Expressions
Assume 1 <= a <= 100 and 0 <= b <= 100, with both variables of type int. Each expression is evaluated separately. Which expressions are…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 534

Multiple choice Boolean Expressions
The int variables used and capacity are each from 0 through 100. A result must be true exactly when capacity is positive, used does not exceed…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 535

Multiple choice Boolean Expressions
The int variables tasks, slots, and reserved satisfy 0 <= tasks <= 100, 0 <= slots <= 20, and 0 <= reserved <= slots. After the declaration below, a plan is…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 536

Multiple choice Boolean Expressions
What is printed? boolean raining = true; boolean covered = false; if (!(raining…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 537

Multiple choice Boolean Expressions
The boolean variables member and expired are initialized, and access is declared as int. The two branches are swapped as shown. Which replacement for the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 538

Multiple choice Boolean Expressions
What is printed? boolean p = true; boolean q = false; boolean r = false; int result…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 539

Multiple choice Boolean Expressions
The int variables x and y and the boolean variable active are initialized. Which condition selects…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 540

Multiple choice Boolean Expressions
The int variables a and b are initialized. Which offered initial pair (a, b) makes…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 531 of 740
Page 54 of 74