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 531–540 of 692
  1. 531
  2. 532
  3. 533
  4. 534
  5. 535
  6. 536
  7. 537
  8. 538
  9. 539
  10. 540

Question 531

Multiple choice Boolean Expressions
What is printed? int n = 16; if (n % 2 == 0) { System.out.print("TWO"); } else if (n % 4…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 532

Multiple choice Boolean Expressions
Each version starts with int tokens = 3. What are the final values for Version I and Version II, respectively? // Version I if (tokens > 0) { tokens -= 1; } if…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 533

Multiple choice Boolean Expressions
Both versions start with int x = 2 and int result = 0. Which statement is correct? Count only executions of the displayed result…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 534

Multiple choice Boolean Expressions
Which offered initial value of the int n makes this code print AB? if (n % 2 == 0) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 535

Multiple choice Boolean Expressions
Here p is false, q is false and r is true. How many of the three named conditions are evaluated, and how many assignment…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 536

Multiple choice Boolean Expressions
The int n is from 1 through 12 inclusive. Which list contains exactly the inputs for which two of the three bodies execute? if…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 537

Multiple choice Boolean Expressions
What is printed? int x = 3; if (x < 4) { x += 3; System.out.print("A"); } if (x…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 538

Multiple choice Boolean Expressions
Which labeled assignment bodies execute, in order? int x = 4; if (x > 0) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 539

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

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 540

Multiple choice Boolean Expressions
What is printed? int n = 4; if (n < 6) { n += 4; } if (n > 7)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 531 of 692
Page 54 of 70