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 1,081–1,090 of 2,811
  1. 1081
  2. 1082
  3. 1083
  4. 1084
  5. 1085
  6. 1086
  7. 1087
  8. 1088
  9. 1089
  10. 1090

Question 1081

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

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1082

Multiple choice Unit 2: Selection and Iteration
Suppose a, b, and c are int variables. Which of the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1083

Multiple choice Unit 2: Selection and Iteration
Consider the following code segment.
int n = 81;
int count = 0;
while (n > 1)
{
    if (n % 3 == 0)
        n = n / 3;
    else
        n = n - 1;
    count++;
}
What value is stored in count after the loop terminates?
Pick an answer, then check it. The solution opens in a window.

Question 1084

Multiple choice Unit 2: Selection and Iteration
Consider the following code segment. int value = 3; for (int k = 0; k…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1085

Multiple choice Unit 2: Selection and Iteration
Consider the following method.
public static int process(int n)
{
    int result = 0;
    while (n > 0)
    {
        result = result + n % 10;
        n = n / 100;
    }
    return result;
}
What value is returned by process(58364) ?
Pick an answer, then check it. The solution opens in a window.

Question 1086

Multiple choice Unit 2: Selection and Iteration
Consider the following code segment. int total = 0; for (int i = 1; i <= 6; i++) { if (i % 2 == 0 && i > 2)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1087

Multiple choice Unit 2: Selection and Iteration
Consider the following code segment. int n = 50; int count = 0; while (n > 4) { if (n % 2 ==…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1088

Multiple choice Unit 2: Selection and Iteration
Which of the following is…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1089

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

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1090

Multiple choice Unit 2: Selection and Iteration
Consider the following method. public static int mystery(int n) { int count = 0; while (n > 0) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1,081 of 2,811
Page 109 of 282