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 271–280 of 357
  1. 271
  2. 272
  3. 273
  4. 274
  5. 275
  6. 276
  7. 277
  8. 278
  9. 279
  10. 280

Question 271

Multiple choice Boolean Expressions
The int variables a and b are initialized. Which offered initial pair (a, b) makes…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 272

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 273

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 274

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 275

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 276

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 277

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 278

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 279

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 280

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 271 of 357
Page 28 of 36