nerdexam
Microsoft

98-382 · Question #25

You are planning to use the Math object in a JavaScript application. You write the following code to evaluate various Math functions: ``javascript var ceil = Math.ceil(100.5); var floor =…

Math.ceil(100.5) rounds up to the nearest integer, so ceil will be 101. Math.floor(100.5) rounds down to the nearest integer, so floor will be 100. Math.round(100.5) rounds to the nearest integer (up if the fractional part is 0.5 or greater), so round will be 101. Correct…

Performing Operations

Question

You are planning to use the Math object in a JavaScript application. You write the following code to evaluate various Math functions:
var ceil = Math.ceil(100.5);
var floor = Math.floor(100.5);
var round = Math.round(100.5);
What are the final values for the three variables? To answer, select the appropriate values in the answer area. NOTE: Each correct selection is worth one point.

Explanation

Math.ceil(100.5) rounds up to the nearest integer, so ceil will be 101. Math.floor(100.5) rounds down to the nearest integer, so floor will be 100. Math.round(100.5) rounds to the nearest integer (up if the fractional part is 0.5 or greater), so round will be 101.

Correct selections for the answer area are: ceil = 101, floor = 100, round = 101.

Topics

#Math.ceil#Math.floor#Math.round#Math object

Community Discussion

No community discussion yet for this question.

Full 98-382 Practice