The output of Math.round(6.6) + Math.ceil(3.4) is:

ICSE Class 10 Computer Applications PYQ · 2024 Specimen · Section A

1(viii)1 Mark · 2024 · Section A · 2024 Specimen

The output of Math.round(6.6) + Math.ceil(3.4) is:

Show SolutionHide Solution↓

11.0

Reason — The given expression is evaluated as follows:
Math.round(6.6) + Math.ceil(3.4)
⇒ 7 + 4.0
⇒ 11.0

Math.round() rounds off its argument to the nearest mathematical integer and returns its value as an int or long type. Math.ceil method returns the smallest double value that is greater than or equal to the argument and is equal to a mathematical integer. In the addition operation, the type of result is promoted to a double as one operand is double. Hence, the result is 11.0.

← Previous questionNext question →

Browse the free Computer Applications sample bank