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.

Subtopic: Boolean Expressions Clear filter

Questions 271–280 of 316
  1. 271
  2. 272
  3. 273
  4. 274
  5. 275
  6. 276
  7. 277
  8. 278
  9. 279
  10. 280

Question 271

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 272

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 273

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 274

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 275

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 276

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 277

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 278

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 279

Multiple choice Boolean Expressions
What is printed? int x = 7; int y = 3; if (x > y) { x = y + 1; } if (x ==…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 280

Multiple choice Boolean Expressions
The int n is initialized to one of the offered values. Which input makes all three labeled bodies…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 271 of 316
Page 28 of 32