What will be the results of math.floor(4.7) and math.ceil(4.7) respectively ?
2026
What will be the results of math.floor(4.7) and math.ceil(4.7) respectively ?
- A.
5 and 4
- B.
4 and 5
- C.
4.0 and 4.0
- D.
5.0 and 5.0
Attempted by 223 students.
Show answer & explanation
Correct answer: B
The math.floor() function rounds a number down to the nearest integer, so math.floor(4.7) equals 4. The math.ceil() function rounds a number up to the nearest integer, so math.ceil(4.7) equals 5.