Verityprep
Question Bank · Unit 2

AP® Computer Science A Selection and Iteration Multiple Choice Questions

Work through AP Computer Science A multiple-choice 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 281–290 of 316
  1. 281
  2. 282
  3. 283
  4. 284
  5. 285
  6. 286
  7. 287
  8. 288
  9. 289
  10. 290

Question 281

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 282

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 283

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 284

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 285

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 286

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 287

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 288

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 289

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 290

Multiple choice Boolean Expressions
The boolean variables outer and inner are initialized. The required behavior is: print A only when both are true; print B whenever outer is false; otherwise…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 281 of 316
Page 29 of 32