with complete solution 2025
1. 2. The equal comparison operator in Java is area of a
circle if the
. radius is
positive.
a. <>
b. !=
c. ==
d. ^=
2. 1. The "less than or equal to" comparison
operator in Java is .
a. <
b. <=
c. =<
d. <<
e. !=
3. 3. What is 1 + 1 + 1 + 1 + 1 == 5?
a. true
b. false
c. There is no guarantee that 1 + 1 + 1 + 1 +
1 == 5 is true.
4. 5. In Java, the word true is .
a. a Java keyword
b. a Boolean literal
c. same as value 1
d. same as value 0
5. 6. Which of the following code displays the
1/
27
,CPS 1231 Chapter 3-4.2 Exam Study Guide Review Questions
with complete solution 2025
c
Note that there is no space separating the dou- ble equal signs.
b
It reads less than or equal to. So write the less than symbol before the
equal sign. Note that there is no space separating the two symbols.
a
These are all integers. In- teger arithmetic is accu- rate.
b
true is a Boolean literal just like integer literal 10.
c
Positive means > 0.
2/
27
, CPS 1231 Chapter 3-4.2 Exam Study Guide Review Questions
with complete solution 2025
a. if (radius != 0) System.out.println(radius * { System.
radius * 3.14159); out.println
b. if (radius >= 0) System.out.println(radius * ("Income
radius * 3.14159); is greater
c. if (radius > 0) System.out.println(radius * than
radius * 3.14159); 4000");
d. if (radius <= 0) System.out.println(radius * }
radius * 3.14159);
6. 7. What is the output of the following
code? int x = 0;
if (x <
4) { x
=x+
1;
}
System.out.println("x is " + x);
a. x is 0
b. x is 1
c. x is 2
d. x is 3
e. x is 4
7. Section 3.4 Two-Way if-else Statements
8. Suppose income is 4001, what is the output
of the following code?
if (income > 3000) {
System.out.println("Income is greater than
3000");
}
else if (income > 4000)
3/
27