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.

Subtopic: Boolean Expressions Clear filter

Questions 211–220 of 357
  1. 211
  2. 212
  3. 213
  4. 214
  5. 215
  6. 216
  7. 217
  8. 218
  9. 219
  10. 220

Question 211

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 212

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 213

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 214

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 215

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 216

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 217

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 218

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 219

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 220

Multiple choice Boolean Expressions
Consider the following code segment. int x = 3; int y = 8; if (x > 4 && y++ > 7) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 211 of 357
Page 22 of 36