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 541–550 of 740
  1. 541
  2. 542
  3. 543
  4. 544
  5. 545
  6. 546
  7. 547
  8. 548
  9. 549
  10. 550

Question 541

Multiple choice Boolean Expressions
The int variable score and the boolean variable extra are initialized. A programmer replaces the original condition with the proposed condition, keeping both…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 542

Multiple choice Boolean Expressions
What happens when this code runs? int denominator = 0; if (denominator == 0) { denominator = 3; } else { denominator +=…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 543

Multiple choice Boolean Expressions
What is printed? int points = 7; int credits = 2; if (credits…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 544

Multiple choice Boolean Expressions
What is printed? int value = 6; if (value < 10) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 545

Multiple choice Boolean Expressions
What is printed? int left = 4; int right = 9; boolean copyRight = false; if (copyRight) { left =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 546

Multiple choice Boolean Expressions
The boolean variable enabled is initialized. Which single statement can replace the entire code…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 547

Multiple choice Boolean Expressions
What is printed? int fee = 8; boolean member = false; if (member) { fee =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 548

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

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 549

Multiple choice Boolean Expressions
The variable x is an int. Which offered initial value of x is unchanged…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 550

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 541 of 740
Page 55 of 74