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 541–550 of 692
  1. 541
  2. 542
  3. 543
  4. 544
  5. 545
  6. 546
  7. 547
  8. 548
  9. 549
  10. 550

Question 541

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 542

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 543

Multiple choice Boolean Expressions
A programmer changes only the second if below to else if, attaching it to the first if. What happens when the changed code runs? int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 544

Multiple choice Boolean Expressions
What is printed? The code intentionally has no braces. boolean p = true;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 545

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

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 546

Multiple choice Boolean Expressions
The boolean variables p, q and r are initialized. Which condition is true exactly when C is printed?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 547

Multiple choice Boolean Expressions
The boolean variables p and q are initialized, and int result starts at 0. Which braced…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 548

Multiple choice Boolean Expressions
What is printed? int x = 5; int y = 2; if (x > 0) if (y > 3) System.out.print("A");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 549

Multiple choice Boolean Expressions
The boolean variables a, b and c are initialized. Which condition is true exactly when Z is printed?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 550

Multiple choice Boolean Expressions
Both versions use the same initialized boolean values p and q. Which condition describes exactly the inputs for which their complete outputs differ? //…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 541 of 692
Page 55 of 70