You are on page 1of 2

h. System.out.println(Math.rint(98.

5));
Chapter 8 i. System.out.println(Math.ceil(65.5));
j. System.out.println(Math.max(-77.66,-
Mathematical Library Methods 87.45));
8. Write down the syntax for the following
functions:
1. What will be the following function return a. To find the smaller between two
when executed? number p and q.
a. Math.max(-17,-19) b. To find the absolute value of a number
b. Math.ceil(7.8) m.
2. Give the output of the following program c. To find the square root of a number d.
segment: d. To find the rounded – off of a number
double x=2.9, y=2.5 b.
System.out.println(Math.min(Math.floor(x),y); e. To find the exponent of a number k.
System.out.println(Math.max(Math.ceil(x),y); 9. Predict the return data type of the following
3. What are final value stored in variables x and y functions:
below? double a. Math.sqrt()
a = -6.35; double b. Math.rint()
b=14.74; double x c. Math.ceil()
= Math.abs(Math.ceil(a)); d. Math.round()
double y= Math.rint(Math.max(a,b)); e. Math.floor()
4. Give the output of the following Math f. Math.log()
functions: 10. Choose the correct Answer:
a. Math.ceil(4.2) a. Which of the following is false to find
b. Math.abs(-4) square of a number?
5. What will the following function return when i. Math.pow(a,2)
executed? ii. Math.sqrt(a,2)
a. int p= Math.abs(Math.max(-91,-97)); iii. a*a
b. double m= Math.cbrt(9.261); iv. All of the above
6. What will the final values be stored in variables b. What type of value is returned by
when executed? double a Math.sqrt( )?
= -99.51; i. Int
double b= -56.25; ii. float
a. double p = Math.abs(Math.floor(a)); iii. Double
b. double q = Math.sqrt(Math.abs(b)); iv. All
7. Predict the output c. Which of the following syntax is true to
a. System.out.println(Math.sqrt(10.24)); find the square root of a number?
b. System.out.println(Math.rint(-99.4)); i. sqrt(a)
c. System.out.println(Math.cbrt(42.875)); ii. Math.sqrt(a)
d. System.out.println(Math.min(-25.5, iii. Squareroot(a)
-12.5)); iv. None
e. System.out.println(Math.ceil(-0.95));
f. System.out.println(Math.round(-
18.51));
g. System.out.println(Math.floor(-0.88));
d. Name the class that is used for different j. Which of the followng function is / are
Mathmatical functions. the correct java expression(s) for
i. Java.Math calculating the area of circle?
ii. Java.Power i. AreaCircle =
iii. Java.Sqrt Math.PI*Math.pow(r,2)
iv. None ii. AreaCircle = 3.14*r*r
e. Give the output of Math.abs(x) : iii. Both of these
when x = -9.99 iv. None of these
i. -9.99 k. Fill in the blanks.
ii. 9.99 i. The …………………. Method of
iii. 0.99 Math class of java.lang package
iv. None is used to calculate a number
f. Give the output of Math.sqrt(x); raise to the power of another
when x = 9.0 number.
i. 3 ii. The function, doube z =
ii. 3.0 Math.ceil(35.75); will return the
iii. 3.00 value of z equal to
iv. All ……………………. as a
g. Which method of Math class of ……………………..data type.
java.lang package calculates the closet iii. The java expression for
integer that is lower than or equal to calculating the volue of a cube
that number ? v=s3 is …………………………………
i. floor(x) iv. The funciton , double
ii. ceil(x) z=Math.cbrt(1000); will return
iii. round(x) of z equal to …………………
iv. abs(x) l. Write True or False
h. The round value of a number is the i. The ceiling value of a number is
nearest integer to that to that number the closet integer that is greater
in …………….. data type. than or equal to that number.
i. Int ……………………………
ii. short or int ii. The abs(x) method of Math
iii. int or long class of java.lang package
iv. long calculates the positive value of
i. The random () method of Math class of a number of int data type only.
java.lang package is used to generate a ……………………………
random number which is greater than iii. The function, double z =
of equal to ………………….. and less than Math.floor(546.66) ; will return
…………………. the value of z equal to 546.0 as
i. 1,10 a double data type. ……………
ii. 0.1,1.0 iv. The Math class of java.lang
iii. 0.1,1.1 package is by default included
iv. 0.0,1.0 inevery java program.
…………………

You might also like