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.

Questions 521–530 of 740
  1. 521
  2. 522
  3. 523
  4. 524
  5. 525
  6. 526
  7. 527
  8. 528
  9. 529
  10. 530

Question 521

Multiple choice Boolean Expressions
What happens when this code runs? int p = 5; int q = 2; boolean result…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 522

Multiple choice Boolean Expressions
What is printed? int a = 10; int b = 4; boolean earlier = a / b == 2; a %= b; b -=…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 523

Multiple choice Boolean Expressions
What is printed? int n = 13; int d = 5; double first = (double) (n / d); double second =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 524

Multiple choice Boolean Expressions
The variable n has type int. Which offered value makes the entire…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 525

Multiple choice Boolean Expressions
What is printed? double reading = -7.8; int whole = (int) reading; int half = (int) (reading / 2);…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 526

Multiple choice Boolean Expressions
The int variables completed and total satisfy 0 <= completed <= total and 1 <= total <= 1000. A task is sufficiently…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 527

Multiple choice Boolean Expressions
What happens when this code runs? int numerator = 9; int divisor = 2 / 3; boolean valid = divisor >=…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 528

Multiple choice Boolean Expressions
What is printed? int total = 6; int group = 2; total /= group; group -= total; boolean…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 529

Multiple choice Boolean Expressions
A request is valid only when used is from 0 through 10 inclusive. Within that range, it is allowed when space remains or…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 530

Multiple choice Boolean Expressions
An int x qualifies when it belongs to exactly one of these inclusive…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 521 of 740
Page 53 of 74