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 221–230 of 357
  1. 221
  2. 222
  3. 223
  4. 224
  5. 225
  6. 226
  7. 227
  8. 228
  9. 229
  10. 230

Question 221

Multiple choice Boolean Expressions

Consider the following code segment.

boolean a = true;
boolean b = false;
boolean c = true;

boolean value = !(a && b) && (b || c) && !(a && !c);

What value is stored in value?

Pick an answer, then check it. The solution opens in a window.

Question 222

Multiple choice Boolean Expressions
Consider the following code segment. int x = 4; int y = 9; int z = 2; boolean…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 223

Multiple choice Boolean Expressions
Consider the following code segment. int a = 5; int b = 2; int c = 7; boolean…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 224

Free response Boolean Expressions
This problem involves calculating the total amount due for a restaurant bill, including tip and a possible service charge for large groups, then dividing among…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 225

Free response Boolean Expressions
This question involves library members who borrow and return books through a public library. A library tracks how many copies of each book are currently…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 226

Multiple choice Boolean Expressions
What is printed by the following code segment? int n = 6; if (n % 2 == 0)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 227

Multiple choice Boolean Expressions
What is the value of r after the following code segment is executed? int a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 228

Multiple choice Boolean Expressions
What is printed by the following code segment? int x = 0; int y = 6; if (x != 0 && y / x > 2)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 229

Multiple choice Boolean Expressions
Which of the following is…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 230

Multiple choice Boolean Expressions
Consider the following declarations: boolean p = true; boolean q = false; Which of…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 221 of 357
Page 23 of 36