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 291–300 of 316
  1. 291
  2. 292
  3. 293
  4. 294
  5. 295
  6. 296
  7. 297
  8. 298
  9. 299
  10. 300

Question 291

Multiple choice Boolean Expressions
What happens when this code is compiled and run as part of an otherwise valid method? The displayed indentation does not…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 292

Multiple choice Boolean Expressions
Both versions use the same initialized boolean values p and q. Which statement about their outputs is correct? // Version I if (p) if (q)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 293

Multiple choice Boolean Expressions
The int variables left and right and boolean enabled are initialized. Which condition is true…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 294

Multiple choice Boolean Expressions
Each version starts with int x = 1 and the same boolean values p and q. Which condition completes the rewrite so that both the final x and complete output are…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 295

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

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 296

Multiple choice Boolean Expressions
The boolean variables p, q and r are initialized and are not changed. Which condition completes the rewrite so that its output matches the original for every…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 297

Multiple choice Boolean Expressions
The int x is initialized and none of the bodies changes it. A programmer changes the second and third if statements to else if. Which statement…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 298

Multiple choice Boolean Expressions
Each version begins with the same int x from -3 through 6 inclusive. Which condition completes the rewrite so that final x is preserved for every allowed…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 299

Multiple choice Boolean Expressions
The boolean variables p and q are initialized. Which condition completes the rewrite while preserving the complete output for every input? // Original if (p) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 300

Multiple choice Boolean Expressions
Each version starts with int total = 0 and the same boolean values p and q. Which condition identifies exactly when the outputs differ but the final totals are…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 291 of 316
Page 30 of 32