Which of the following mathematical functions in SQL returns the smallest…

2024

Which of the following mathematical functions in SQL returns the smallest integer greater than, or equal to, the specified numeric expression?

Answer: B. CEILINGSQL provides several built-in numeric functions that transform a value in different ways: ROUND adjusts to the nearest value at a given precision, ABS strips…

  1. A.

    ROUND

  2. B.

    CEILING

  3. C.

    ABS

  4. D.

    FLOOR

Attempted by 633 students.

Show answer & explanation

Correct answer: B

SQL provides several built-in numeric functions that transform a value in different ways: ROUND adjusts to the nearest value at a given precision, ABS strips the sign to give magnitude, and CEILING and FLOOR round toward a fixed direction rather than to the nearest value.

The question asks for the function that always returns the smallest integer that is greater than or equal to the given expression, the mathematical "ceiling" operation. Testing this against CEILING: CEILING(3.2) evaluates to 4, and CEILING(-3.2) evaluates to -3, in both cases the result is the smallest integer that is still greater than or equal to the input, exactly matching what the question describes.

Contrasting this with the other three functions on the same inputs makes the distinction explicit:

  • ROUND(3.2) evaluates to 3 and ROUND(3.6) evaluates to 4, it snaps to whichever integer is numerically nearest, not always the one above the input.

  • ABS(-3.2) evaluates to 3.2, it only removes a negative sign; it does not round to an integer at all.

  • FLOOR(3.2) evaluates to 3 and FLOOR(-3.2) evaluates to -4, it returns the largest integer less than or equal to the expression, the opposite direction from what the question asks.

Since CEILING is the only one of the four functions defined to round toward positive infinity to the nearest integer that is still greater than or equal to the input, for both positive and negative values, CEILING is the function the question describes.

Explore the full course: Uppsc Polytechnic Lecturer 2025 Cs

Loading lesson…