Computer Applications
Given: double m = Math.max(Math.ceil(14.55),15.5);
What will be the final value stored in the variable m?
- 15.0
- 14.0
- 15.5
- 14.5
Java Math Lib Methods
21 Likes
Answer
15.5
Reason — ceil() returns the whole number greater than or equal to the number and max() returns the greater number between its arguments. So, the expression is solved as follows:
m = Math.max(Math.ceil(14.55),15.5);
⇒ m = Math.max(15.0,15.5);
⇒ m = 15.5
Answered By
11 Likes
Related Questions
Given: double a = -8.35;
double p = Math.abs(Math.floor(a));
What will be the final value stored in the variable p?- 9.0
- 8.0
- 7.0
- 8.5
Given: d = Math.min(-15.5, -19.5);
What data type will you refer for the variable d?- int
- float
- double
- None
Given: double k = Math.rint(-9.4) + Math.sqrt(9.0);
What will be the final value stored in the variable k?- -5.0
- -6.0
- -6.4
- -5.4
Given double b = Math.ceil(3.4) + Math.pow(2,3);
What will be the final value stored in the variable b?- 12.0
- 11.0
- 11.4
- 11.5