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 261–270 of 316
  1. 261
  2. 262
  3. 263
  4. 264
  5. 265
  6. 266
  7. 267
  8. 268
  9. 269
  10. 270

Question 261

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 262

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 263

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 264

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 265

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 266

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 267

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 268

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 269

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 270

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 261 of 316
Page 27 of 32