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 11–20 of 357
  1. 11
  2. 12
  3. 13
  4. 14
  5. 15
  6. 16
  7. 17
  8. 18
  9. 19
  10. 20

Question 11

Multiple choice Boolean Expressions
Consider the following code segment. double a = 1.1; double b = 1.2; if ((a + b) * (a - b) != (a * a) - (b * b)) { System.out.println("Mathematical error!");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 12

Multiple choice Boolean Expressions
Which of the following code segments is equivalent to…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 13

Multiple choice Boolean Expressions
The Boolean expression (x==y && !(x==y)) || ( x!=y &&…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 14

Multiple choice Boolean Expressions
Consider the following code segment. int x = 7; int y = 3; if ((x < 10) && (y < 0)) System.out.println("Value is: "…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 15

Multiple choice Boolean Expressions
Assume that a and b have been defined and initialized as int values. The expression !(!(a !=…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 16

Multiple choice Boolean Expressions
Assume that x and y have been declared and initialized with int values. Consider the following Java…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 17

Multiple choice Boolean Expressions
Assume that int variables x and y have been properly declared and…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 18

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 19

Multiple choice Boolean Expressions
What does this Java…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 20

Multiple choice Boolean Expressions
Consider the code snippet below. String name = "Karel"; String checkName = new String("Karel"); boolean nameMatches = name == checkName; Note that we forced…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 11 of 357
Page 2 of 36