Course: PHP

Progress (0%)

# PHP Rounding Numbers Quiz

Quiz 5 6 questions

Prerequisites for the quiz

6 questions to solve

Instructions
1. This quiz goes to full-screen once you press the Start button.
2. At the end of the quiz, you are able to review all the questions that you answered wrong and see their explanations.
What does round(3.78, 1) return?
round(3.78, 1) rounds 3.78 to the nearest tenths place yielding 3.8.

The correct choice is therefore (B). Refer to PHP Rounding Numbers for more information.
What does round(378.52) return?
round(378.52) rounds 378.52 to the nearest units to give 379.0, which goes with choice (C). Refer to PHP Rounding Numbers for more information.
What does round(168.83, -1) return?
round(168.83, -1) rounds 168.83 to the nearest tens to give 170.0, which goes with choice (D). Refer to PHP Rounding Numbers for more information.
What does floor(10.9) return?
The floor() function returns the floor of a given number as a floating-point value. Hence, floor(10.9) returns 10.0, NOT 10. Refer to PHP Rounding Numbers — Floor and ceil for more information.
What does ceil(9.03) return?
The ceil() function returns the ceil of a given number as a floating-point value. Hence, ceil(9.03) returns 10.0, NOT 10. Refer to PHP Rounding Numbers — Floor and ceil for more information.
What does round(3.5, 3) return?
By definition, round(3.5, 3) rounds 3.5 to 3 decimal places, but since it's not possible to add ending zeroes to the number, the result remains what it is i.e 3.5. Hence, the correct choice is (A). Refer to PHP Rounding Numbers for more information.

"I created Codeguage to save you from falling into the same learning conundrums that I fell into."

— Bilal Adnan, Founder of Codeguage