WorksheetsQuiz 05 - Math in Java
Total questions: 10
Worksheet time: 50mins
Which symbols is used to find the remainder when dividing two numbers?
*
/
%
#
What is the result of evaluating the expression "29 % 6"?
4
5
1
0
Which is NOT a valid Java expression?
base * height / 2
(base)(height) / 2
(base * height) / 2
base * (height / 2)
What is the result of this Java math expression:
4 + 12 / 5
6
3
6.4
3.2
Which Math class method can be used to calculate square roots?
Math.sqrt()
Math.root()
Math.squareroot()
Math.squirt()
Which Math class method can be used to calculate exponents?
Math.exponent()
Math.raise()
Math.pow()
Math.ceil()
Which Math class method will round any number down (towards negative infinity)?
Math.round()
Math.floor()
Math.ceil()
Math.roundDown()
You want to divide "total" by 5 and get a decimal number. Which of the following will NOT work correctly?
double each = total / 5;
double each = (double) total / 5;
double each = total / (double) 5;
double each = total / 5.0;
Java does NOT follow BEDMAS
True
False
When you try to square root a negative number in Java, what happens?
It returns the value NaN
It raises an error
It returns the value undefined
It returns an imaginary number
