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 611–620 of 740
  1. 611
  2. 612
  3. 613
  4. 614
  5. 615
  6. 616
  7. 617
  8. 618
  9. 619
  10. 620

Question 611

Multiple choice Boolean Expressions
The int bounds low and high are each from -10 through 10 inclusive and remain unchanged. The int x may have any value. Which condition is true exactly when…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 612

Multiple choice Boolean Expressions
The boolean variables p and q are initialized and int x starts at 0. Insert one offered statement at the comment. Which insertion guarantees that…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 613

Multiple choice Boolean Expressions
The required behavior is to print A for p && q, B for !p && q, and nothing otherwise. p and q are boolean. Which…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 614

Multiple choice Boolean Expressions
For int n, result should be -1 for negative inputs and 1 otherwise. Which inputs are handled incorrectly by…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 615

Multiple choice Boolean Expressions
Each implementation is run separately with the same nonnegative int x. What is the smallest x for which all three complete outputs are different from one…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 616

Multiple choice Boolean Expressions
The boolean variables p and q are initialized. In Version I, moving the else to the outer if produces Version II. Which pair of tests exercises both directions…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 617

Multiple choice Boolean Expressions
The int variables a and b each initially lie from 0 through 4 inclusive. Which condition, evaluated before the code…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 618

Multiple choice Boolean Expressions
The boolean variables p, q and r are initialized and unchanged. int pick starts at 0. Which replacement…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 619

Multiple choice Boolean Expressions
The boolean variables p, q and r may have any values. Which list contains all and only the possible complete outputs? Semicolons in the choices separate…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 620

Multiple choice Iteration
What is printed? for (int i = 2; i <…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 611 of 740
Page 62 of 74