Advertisements
Advertisements
Question
Given: double m = Math.max(Math.cei1(14.55),15.5);
What will be the final value stored in the variable m?
Options
15.0
14.0
15.5
14.5
MCQ
Solution
15.5
Explanation:
- Math.ceil(14.55): This function returns the smallest integer larger than or equal to the specified number. For 14.55, Math.ceil(14.55) gives 15.0.
- Math.max(15.0, 15.5): This function returns the bigger of two values. Between 15.0 and 15.5, the greater value is 15.5.
- So the final amount saved in the variable m is 15.5.
shaalaa.com
Is there an error in this question or solution?