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 281–290 of 357
  1. 281
  2. 282
  3. 283
  4. 284
  5. 285
  6. 286
  7. 287
  8. 288
  9. 289
  10. 290

Question 281

Multiple choice Boolean Expressions
What is printed? int queued = 12; int batch; if (queued < 5) { batch = 1; }…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 282

Multiple choice Boolean Expressions
What is printed? int stock = 7; if (stock < 10) { stock += 8; } else if (stock < 20) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 283

Multiple choice Boolean Expressions
The boolean variables priority and urgent may have any values. Which assigned route value can never be produced by this code? int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 284

Multiple choice Boolean Expressions
The int variable level is from 0 through 15 inclusive, and label is declared as String. The required labels are A for 0–3, B for 4–8, C for 9–12, and D for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 285

Multiple choice Boolean Expressions
A shipping rule requires fee 9 for every fragile item. A nonfragile item has fee 6 when mass > 5 and fee 2 otherwise. mass is a positive int and fragile is…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 286

Multiple choice Boolean Expressions
An int variable x initially has a value from 0 through 12 inclusive. Which list contains all initial values for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 287

Multiple choice Boolean Expressions
The boolean variables voucher and member are initialized. Which condition is true exactly for the inputs that make this code print 19?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 288

Multiple choice Boolean Expressions
What is printed? The nested if statements intentionally have no braces. int x = -2; int y = 5;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 289

Multiple choice Boolean Expressions
What is printed? boolean allowed = false; boolean fast = true; int score = 4; if (allowed) { if (fast) { score…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 290

Multiple choice Boolean Expressions
The int variables a, b and c are initialized. Which condition is true exactly when winner finishes with the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 281 of 357
Page 29 of 36