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 141–150 of 357
  1. 141
  2. 142
  3. 143
  4. 144
  5. 145
  6. 146
  7. 147
  8. 148
  9. 149
  10. 150

Question 141

Multiple choice Boolean Expressions
Consider the following Java method, conditionTest, which takes two integer arguments, num1 and num2, and prints a letter based on their values: public static…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 142

Multiple choice Boolean Expressions
Consider the following Boolean expression where a and b are…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 143

Multiple choice Boolean Expressions
Consider the following method: public static void conditionTest(int num1, int num2) { if ((num1 > 0) && (num2 > 0)) { if (num1 > num2) System.out.println("A");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 144

Multiple choice Boolean Expressions
Given the Boolean expression: (x == y && !(x == y)) || (x != y && !(x…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 145

Multiple choice Boolean Expressions
Consider the following code segment. Which of the following…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 146

Multiple choice Boolean Expressions
Consider the following code. int x = 0; if (x == 0) System.out.print("1"); else System.out.print("2");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 147

Multiple choice Boolean Expressions
Consider the following boolean expression. (X && !Y) || (!X && Y) Which of…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 148

Multiple choice Boolean Expressions
Consider the following code segment. boolean a = true, b = false; if (/* missing code */) System.out.print("Nice job."); else System.out.print("Nicer job.");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 149

Multiple choice Boolean Expressions
Suppose p and q are declared as boolean variables and have been initialized to unknown…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 150

Multiple choice Boolean Expressions
Consider the following code segment: for (int i = 200; i > 0; i /= 3) { if (i % 2 == 0)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 141 of 357
Page 15 of 36