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.

Subtopic: Boolean Expressions Clear filter

Questions 171–180 of 316
  1. 171
  2. 172
  3. 173
  4. 174
  5. 175
  6. 176
  7. 177
  8. 178
  9. 179
  10. 180

Question 171

Multiple choice Boolean Expressions
Consider the following code segment. ArrayList<Integer> list = new ArrayList<Integer>(); list.add(3); list.add(6); list.add(3); list.add(3); list.add(9);…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 172

Multiple choice Boolean Expressions
Which of the following is equivalent to !(x > 5 && y != 2) ?
Pick an answer, then check it. The solution opens in a window.

Question 173

Multiple choice Boolean Expressions
Consider the following declarations.
int x = 4;
int y = 9;
boolean b = x > 5 || y / x == 2;
What is the value of b after the code segment executes?
Pick an answer, then check it. The solution opens in a window.

Question 174

Multiple choice Boolean Expressions
Which of the following conditions is true exactly…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 175

Multiple choice Boolean Expressions
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 176

Multiple choice Boolean Expressions
Which of the following is…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 177

Multiple choice Boolean Expressions
Consider the following declarations. int x = 0; int y = 5; boolean b…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 178

Multiple choice Boolean Expressions
Which of the following is true exactly when n is outside the range 5 through 12, inclusive?
Pick an answer, then check it. The solution opens in a window.

Question 179

Multiple choice Boolean Expressions
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 180

Multiple choice Boolean Expressions
Consider the following method.
public static int process(int n)
{
    int count = 0;

    while (n >= 10)
    {
        if (n % 2 == 0)
            n = n / 2;
        else
            n = n - 1;
        count++;
    }

    return count;
}
What value is returned by process(19) ?
Pick an answer, then check it. The solution opens in a window.
Question 171 of 316
Page 18 of 32