Computer Applications
What is the output of Math.ceil(5.4)+Math.ceil(4.5)?
- 10.0
- 11.0
- 12.0
- 9.0
Java Math Lib Methods
ICSE 2024
2 Likes
Answer
11.0
Reason — The method Math.ceil(double value)
in Java rounds up a decimal number to the next highest integer, regardless of the fractional part.
Breakdown of the Expression:
Math.ceil(5.4)
:
5.4 is rounded up to 6.0.Math.ceil(4.5)
:
4.5 is rounded up to 5.0.
Adding the Results:
6.0 + 5.0 = 11.0
Answered By
2 Likes
Related Questions
Which of the following is an escape sequence character in Java?
/n
\t
/t
//n
if (a>b&&b>c) then largest number is:
- b
- c
- a
- wrong expression
What is the method to check whether a character is a letter or digit?
- isDigit(char)
- isLetterOrDigit()
- isLetterOrDigit(char)
- isLETTERorDIGIT(char)
The extension of a Java source code file is:
- exe
- obj
- jvm
- java