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.

Subtopic: Boolean Expressions Clear filter

Questions 311–320 of 357
  1. 311
  2. 312
  3. 313
  4. 314
  5. 315
  6. 316
  7. 317
  8. 318
  9. 319
  10. 320

Question 311

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 312

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 313

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 314

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 315

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 316

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 317

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 318

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 319

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 320

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 311 of 357
Page 32 of 36