Verityprep
Question Bank

AP® Computer Science A Practice Questions

Work through AP Computer Science A practice questions unit by unit, 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 811–820 of 3,140
  1. 811
  2. 812
  3. 813
  4. 814
  5. 815
  6. 816
  7. 817
  8. 818
  9. 819
  10. 820

Question 811

Multiple choice Unit 2: Selection and Iteration
Questions refer to the following method. public static int mystery(int n) { int x = 1; int y = 1; // Point A while (n > 2)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 812

Multiple choice Unit 2: Selection and Iteration
Consider the following code segment. for (int k = 1; k <= 100; k++) if ((k % 4) == 0)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 813

Multiple choice Unit 2: Selection and Iteration
Consider the following code segment. int sum = 0; int k = 1; while (sum < 12 || k < 4) sum…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 814

Multiple choice Unit 2: Selection and Iteration
Consider the following code segment. int num = 2574; int result = 0; while (num > 0) { result = result * 10 +…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 815

Multiple choice Unit 2: Selection and Iteration
Consider the following code segment. int x = 1; while ( /* missing code */ ) { System.out.print(x + " "); x = x + 2; } Consider the following possible…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 816

Multiple choice Unit 2: Selection and Iteration
Assume that x and y have been declared and initialized with int values. Consider the following Java…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 817

Multiple choice Unit 2: Selection and Iteration
Assume that int variables x and y have been properly declared and…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 818

Multiple choice Unit 2: Selection and Iteration
Why do we use…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 819

Multiple choice Unit 2: Selection and Iteration
What will this while loop do?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 820

Multiple choice Unit 2: Selection and Iteration
Why does the following code produce an infinite loop? Choose the best answer. public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 811 of 3,140
Page 82 of 314