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 321–330 of 357
  1. 321
  2. 322
  3. 323
  4. 324
  5. 325
  6. 326
  7. 327
  8. 328
  9. 329
  10. 330

Question 321

Multiple choice Boolean Expressions
The int n is initialized to one of the offered values. Which input makes all three labeled bodies…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 322

Multiple choice Boolean Expressions
A programmer changes only the second if below to else if, attaching it to the first if. What happens when the changed code runs? int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 323

Multiple choice Boolean Expressions
What is printed? The code intentionally has no braces. boolean p = true;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 324

Multiple choice Boolean Expressions
The boolean variables a and b are initialized. Which condition is true exactly when Z is…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 325

Multiple choice Boolean Expressions
The boolean variables p, q and r are initialized. Which condition is true exactly when C is printed?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 326

Multiple choice Boolean Expressions
The boolean variables p and q are initialized, and int result starts at 0. Which braced…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 327

Multiple choice Boolean Expressions
What is printed? int x = 5; int y = 2; if (x > 0) if (y > 3) System.out.print("A");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 328

Multiple choice Boolean Expressions
The boolean variables a, b and c are initialized. Which condition is true exactly when Z is printed?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 329

Multiple choice Boolean Expressions
Both versions use the same initialized boolean values p and q. Which condition describes exactly the inputs for which their complete outputs differ? //…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 330

Multiple choice Boolean Expressions
Here a is false; b and c are boolean and may have either value. Which labeled assignment bodies can execute for at…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 321 of 357
Page 33 of 36