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 551–560 of 740
  1. 551
  2. 552
  3. 553
  4. 554
  5. 555
  6. 556
  7. 557
  8. 558
  9. 559
  10. 560

Question 551

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 552

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 553

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 554

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 555

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 556

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 557

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 558

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 559

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 560

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 551 of 740
Page 56 of 74