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: Boolean Expressions Clear filter

Questions 221–230 of 316
  1. 221
  2. 222
  3. 223
  4. 224
  5. 225
  6. 226
  7. 227
  8. 228
  9. 229
  10. 230

Question 221

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 222

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 223

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 224

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 225

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 226

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 227

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 228

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 229

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 230

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 221 of 316
Page 23 of 32