Multiple choice technology programming languages

What is the output for the following expression = ceil {-4.5}

  1. 5

  2. -4

  3. 4

  4. -5

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The ceiling function ceil(x) returns the smallest integer greater than or equal to x. For -4.5, the integers greater than -4.5 are -4, -3, -2, etc. The smallest of these is -4, so ceil(-4.5) = -4. This is a common source of confusion with negative numbers.