WorksheetsMath_functions
Total questions: 12
Worksheet time: 4mins
Math.max(-6.43, -16.2)
-16.2
-6.43
6.43
Math.pow(3.0, 4.0)
27.0
81.0
81
64.0
Math.abs(-77.87)
77.80
77.90
-77.80
77.87
Math.sqrt(-16) gives
4
4.0
256
NaN
Math.round(7.5) & Math.round(-7.5)
8 , -7
8, 8
7, -8
System.out.println(Math.round(6.9) + Math.round(-4.6));
-2
2
10
-10
Math.rint(-3.2) & Math.rint(6.9)
3.0 , 7.0
-3.0 , 7.0
3 , 7
-3 , 7
What is the value of “d” in the following Java code snippet?
double d = Math.round ( 2.5 + Math.random() );
2
3
4
3.4
What will be the output of the following Java program?
class Output {
public static void main(String args[]) {
int x = 3.14;
int y = (int) Math.abs(x);
System.out.print(y);
}
}
0
3
3.0
3.1
What will be the output of the following Java program?
class Output {
public static void main(String args[ ]) {
double x = 3.1; double y = 4.5;
double z = Math.max( x, y );
System.out.print(z);
}
}
true
false
3.1
4.5
What will be the output of the following Java program?
class Output
{
public static void main(String args[])
{
double x = 4.0;
double y = 3.0;
double z = Math.pow( x, y );
System.out.print(z);
}
}
4.0
16.0
64.0
64
NaN means
Null value
Negative value
NaN is a term used in mathematics and computer science to describe a non-numeric value.
Not applicable
