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 241–250 of 316
  1. 241
  2. 242
  3. 243
  4. 244
  5. 245
  6. 246
  7. 247
  8. 248
  9. 249
  10. 250

Question 241

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 242

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 243

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 244

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 245

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 246

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 247

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 248

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 249

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 250

Multiple choice Boolean Expressions
What is printed? int x = 4; int y = 6; if (x < y) { x += 3; if (x < y) { y…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 241 of 316
Page 25 of 32