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.

Questions 601–610 of 740
  1. 601
  2. 602
  3. 603
  4. 604
  5. 605
  6. 606
  7. 607
  8. 608
  9. 609
  10. 610

Question 601

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 602

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 603

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 604

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 605

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 606

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 607

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 608

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 609

Multiple choice Boolean Expressions
The boolean variables p and q are initialized. Which condition completes the rewrite while preserving the complete output for every input? // Original if (p) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 610

Multiple choice Boolean Expressions
Each version starts with int total = 0 and the same boolean values p and q. Which condition identifies exactly when the outputs differ but the final totals are…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 601 of 740
Page 61 of 74