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 521–530 of 692
  1. 521
  2. 522
  3. 523
  4. 524
  5. 525
  6. 526
  7. 527
  8. 528
  9. 529
  10. 530

Question 521

Multiple choice Boolean Expressions
The int variables x and y are initialized. Which statement describes their final…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 522

Multiple choice Boolean Expressions
The boolean variables p, q and r are initialized. Which offered initial triple (p, q, r) makes all…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 523

Multiple choice Boolean Expressions
The int variable n may be from 0 through 10 inclusive. Each proposed set is run as separate tests, resetting n each time. Which set executes…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 524

Multiple choice Boolean Expressions
For a nonnegative int value, the required route is 1 for 0–4, 2 for 5–9, and 3 for 10 or above. Which offered pair consists of two inputs that both…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 525

Multiple choice Boolean Expressions
Each version starts with the same int x from 0 through 12 inclusive. Which replacement for the comment makes the rewritten version produce the same final x as…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 526

Multiple choice Boolean Expressions
The intended condition is true exactly when the int n is from 3 through 7 inclusive. Two faulty implementations are shown. Which pair of test inputs detects a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 527

Multiple choice Boolean Expressions
Each test starts with an int x from 0 through 10 inclusive. Which set of four initial values makes the code print each of A, B, C and D at least once across the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 528

Multiple choice Boolean Expressions
Each implementation is run separately with an initialized int x. A pair of inputs produces a two-character output sequence for each implementation, in the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 529

Multiple choice Boolean Expressions
The int free is from 0 through 8 inclusive, the int requested is from 1 through 4 inclusive, and priority is boolean. Which condition, evaluated before the code…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 530

Multiple choice Boolean Expressions
What is printed? int x = 12; if (x > 0) { System.out.print("A"); } if (x…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 521 of 692
Page 53 of 70