Verityprep
Question Bank

AP® Computer Science A Multiple Choice Questions

Work through AP Computer Science A multiple-choice 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 821–830 of 2,811
  1. 821
  2. 822
  3. 823
  4. 824
  5. 825
  6. 826
  7. 827
  8. 828
  9. 829
  10. 830

Question 821

Multiple choice Unit 2: Selection and Iteration
Consider the following code segment. int incr = 1; for (int i = 0; i < 10; i+= incr) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 822

Multiple choice Unit 2: Selection and Iteration
Which of the following code segments will print exactly eight "$" symbols? I. for (int i = 0; i < 8; i++) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 823

Multiple choice Unit 2: Selection and Iteration
Consider the following code segment. int a = /* value supplied within program */ int b = /* value supplied within program */ if (/* missing condition */) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 824

Multiple choice Unit 2: Selection and Iteration
Consider the following code segment. int n = 0 ; while ( n < 20) { System.out.print(n % 4 + " " ) ; if (…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 825

Multiple choice Unit 2: Selection and Iteration
Consider the following method. public int someMethod(int val) { for (int i = 2; i < 7; i++) { if…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 826

Multiple choice Unit 2: Selection and Iteration
Consider the following code segment. int num1 = 2; int num2 = 13; int result = 4; if ((num1 < 5) && (num2 < 5)) result = num1 - num2; else if ((num1 ==…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 827

Multiple choice Unit 2: Selection and Iteration
Assume that k, m, and n have been declared and correctly initialized with int values. Consider the following statement.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 828

Multiple choice Unit 2: Selection and Iteration
Consider the following code segment. for (int h = 2; h <= 6; h += 2) { for (int k = 30; k > 0; k -= 10) { System.out.print(h + k + " "); } } Consider these…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 829

Multiple choice Unit 2: Selection and Iteration
Assume that a, b, and c have been declared and correctly initialized with int values. Consider the following…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 830

Multiple choice Unit 2: Selection and Iteration
Consider the following method. public int pathways(int n) { int ans; if (n < -5) ans = 1; else if (n < 0) ans = 2; else if…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 821 of 2,811
Page 83 of 282