Page 154 - CA_Blue( J )_Class9
P. 154
10. Which of the following does double a = Math.rint(-7.5); return?
a. 7.0 b. -7.0
c. 8.0 d. -8.0
Answers
1. d 2. b 3. c 4. b 5. b 6. c 7. c 8. c 9. d 10. d
B. Fill in the blanks.
1. ………………… can be created by programmers according to the requirement of the problem.
2. ………………… is used to find the square root of the argument.
3. Math.abs() returns the ………………… of the argument.
4. Math.round() method is used to return the rounded off value of the argument to its ………………… integer.
5. Math.pow() is used to return the “nth” power of a number “m” in the format ………………….
6. Math.round(5) returns ………………….
7. The output of Math.ceil() is of ………………… type.
8. Math.ceil(-53.49) returns ………………….
9. Math.floor(Math.max(4.5,6.8)) returns ………………….
10. Math.pow(4, 2) returns ………………….
Answers
n
1. User-defined methods 2. Math.sqrt() 3. absolute value 4. nearest 5. m 6. 5
7. double 8. -53.0 9. 6.8 10. 16.0
C. Answer the following questions.
1. Write the output of the following:
a. System.out.println((int)Math.ceil(3.6));
Ans. 4
b. double a=10.8, b=4.5;
System.out.println(Math.ceil(b)+Math.min(a,b));
Ans. 9.5
c. System.out.print(Math.pow(-3,4));
Ans. 81.0
2. Write the output of the program snippet:
class calculate
{
public static void main ()
{
int a=2;
double b=2.6, c;
System.out.println(Math.pow(a,a)+b);
c=Math.min(a,b);
System.out.println(c);
}
}
Ans. 6.6
2.0
3. What will be the output:
a. System.out.println(Math.rint(5.7));
Ans. 6.6
2.0
152 Touchpad Computer Applications-IX

