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.

Subtopic: Boolean Expressions Clear filter

Questions 261–270 of 357
  1. 261
  2. 262
  3. 263
  4. 264
  5. 265
  6. 266
  7. 267
  8. 268
  9. 269
  10. 270

Question 261

Multiple choice Boolean Expressions
An int x qualifies when it belongs to exactly one of these inclusive…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 262

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 263

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 264

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 265

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 266

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 267

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 268

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 269

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 270

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 261 of 357
Page 27 of 36