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.

Questions 551–560 of 692
  1. 551
  2. 552
  3. 553
  4. 554
  5. 555
  6. 556
  7. 557
  8. 558
  9. 559
  10. 560

Question 551

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 552

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 553

Multiple choice Boolean Expressions
What happens when this code is compiled and run as part of an otherwise valid method? The displayed indentation does not…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 554

Multiple choice Boolean Expressions
Both versions use the same initialized boolean values p and q. Which statement about their outputs is correct? // Version I if (p) if (q)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 555

Multiple choice Boolean Expressions
The int variables left and right and boolean enabled are initialized. Which condition is true…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 556

Multiple choice Boolean Expressions
Each version starts with int x = 1 and the same boolean values p and q. Which condition completes the rewrite so that both the final x and complete output are…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 557

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

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 558

Multiple choice Boolean Expressions
The boolean variables p, q and r are initialized and are not changed. Which condition completes the rewrite so that its output matches the original for every…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 559

Multiple choice Boolean Expressions
The int x is initialized and none of the bodies changes it. A programmer changes the second and third if statements to else if. Which statement…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 560

Multiple choice Boolean Expressions
Each version begins with the same int x from -3 through 6 inclusive. Which condition completes the rewrite so that final x is preserved for every allowed…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 551 of 692
Page 56 of 70