nerdexam
IBM

000-349 · Question #44

What is the difference between the INT function and the ROUND function? The INT function always discards the decimal, and the ROUND function:

The correct answer is C. rounds up or down to the number of decimal places specified. INT always truncates the decimal portion of a number entirely, while ROUND adjusts the value up or down and returns it to a caller-specified number of decimal places.

Development

Question

What is the difference between the INT function and the ROUND function? The INT function always discards the decimal, and the ROUND function:

Options

  • Arounds up and then always discards the decimal.
  • Brounds up or down and then always discards decimal places.
  • Crounds up or down to the number of decimal places specified.
  • Ddiscards unwanted decimal places and then rounds up or down.

How the community answered

(43 responses)
  • A
    5% (2)
  • B
    7% (3)
  • C
    74% (32)
  • D
    14% (6)

Why each option

INT always truncates the decimal portion of a number entirely, while ROUND adjusts the value up or down and returns it to a caller-specified number of decimal places.

Arounds up and then always discards the decimal.

ROUND does not always round up - it rounds up only when the following digit is 5 or greater and rounds down otherwise; it does not subsequently discard all decimal places.

Brounds up or down and then always discards decimal places.

ROUND does not discard all decimal places; it retains the number of decimal places specified by the caller, which is the key functional difference from INT.

Crounds up or down to the number of decimal places specified.Correct

The ROUND function evaluates the digit immediately following the target decimal position and rounds the number either up or down accordingly, then returns the result with the exact number of decimal places specified by the second argument. This is fundamentally different from INT, which performs no rounding and simply discards everything after the decimal point.

Ddiscards unwanted decimal places and then rounds up or down.

ROUND performs rounding as a single operation to the specified precision; it does not first discard unwanted decimal places and then round, as that sequence would produce incorrect intermediate values.

Concept tested: INT vs ROUND numeric precision functions

Source: https://www.ibm.com/docs/en/b2b-integrator/6.1.2?topic=functions-round

Topics

#INT function#ROUND function#decimal handling#numeric functions

Community Discussion

No community discussion yet for this question.

Full 000-349 Practice