The abs() function returns the absolute value of a number, which means it removes any negative sign and gives the positive value.
Click to reveal answer
beginner
How does the ceil() function work in Sass?
The ceil() function rounds a number up to the nearest whole number. For example, ceil(4.2) becomes 5.
Click to reveal answer
intermediate
Explain the difference between floor() and round() in Sass.
floor() rounds a number down to the nearest whole number, while round() rounds a number to the nearest whole number based on normal rounding rules (up if decimal ≥ 0.5, down otherwise).
Click to reveal answer
beginner
What does the percentage() function do in Sass?
The percentage() function converts a decimal number to a percentage by multiplying it by 100 and adding the % unit. For example, percentage(0.5) returns 50%.
Click to reveal answer
intermediate
How can you use the min() and max() functions in Sass?
The min() function returns the smallest number from a list of numbers, and max() returns the largest. They help pick limits or boundaries in styles.
Click to reveal answer
What will ceil(3.1) return in Sass?
A3
B4
C3.1
DError
✗ Incorrect
ceil() rounds up to the nearest whole number, so 3.1 becomes 4.
Which function rounds a number down to the nearest whole number?
Around()
Bceil()
Cfloor()
Dabs()
✗ Incorrect
floor() always rounds down to the nearest whole number.
What does abs(-7) return?
A7
BError
C0
D-7
✗ Incorrect
abs() returns the positive value, so -7 becomes 7.
How does percentage(0.25) evaluate?
A0.25%
B250%
C2.5%
D25%
✗ Incorrect
percentage() multiplies by 100 and adds %, so 0.25 becomes 25%.
Which function returns the largest number from a list?
Amax()
Bmin()
Cabs()
Dfloor()
✗ Incorrect
max() returns the largest number from the given list.
Describe how you would use Sass built-in math functions to control layout spacing.
Think about rounding sizes and limiting values.
You got /5 concepts.
Explain the difference between round(), ceil(), and floor() in Sass with examples.
Consider how each function treats decimal numbers.
You got /5 concepts.
Practice
(1/5)
1. What is the purpose of Sass built-in math functions?
easy
A. To perform calculations like rounding and comparing numbers in styles
B. To create animations in CSS
C. To add images to the webpage
D. To write HTML code inside Sass files
Solution
Step 1: Understand Sass math functions
Sass math functions help with calculations such as rounding, min/max, and converting units.
Step 2: Identify the correct purpose
Only To perform calculations like rounding and comparing numbers in styles describes calculation tasks related to styles, which is what Sass math functions do.
Final Answer:
To perform calculations like rounding and comparing numbers in styles -> Option A
Quick Check:
Math functions = calculations [OK]
Hint: Math functions handle numbers and calculations in Sass [OK]
Common Mistakes:
Confusing math functions with animation or HTML tasks
Thinking math functions add images
Assuming math functions write HTML code
2. Which of the following is the correct way to import the Sass math module?
easy
A. @use 'sass:math';
B. @import 'math';
C. @include math();
D. @require 'sass/math';
Solution
Step 1: Recall Sass module import syntax
Sass uses the @use rule to import built-in modules like math.
Step 2: Match correct syntax
The correct syntax is @use 'sass:math';. Other options use outdated or incorrect syntax.
Final Answer:
@use 'sass:math'; -> Option A
Quick Check:
Import math module = @use 'sass:math'; [OK]
Hint: Use '@use' with 'sass:math' to import math functions [OK]
math.div divides numbers but cannot divide units like degrees directly.
Step 2: Understand unit division rules
Dividing 45deg by 2px is invalid because degrees and px are incompatible units; math.div expects unitless numbers or compatible units.
Final Answer:
math.div cannot divide units like degrees -> Option C
Quick Check:
math.div with units like deg = error [OK]
Hint: math.div only divides numbers without incompatible units [OK]
Common Mistakes:
Assuming math.div works with all units
Ignoring unit compatibility in division
Thinking transform can't use variables
5. You want to create a responsive font size that is the smaller of 3rem or 5rem using Sass math functions. Which code correctly sets $font-size to this value?
hard
A. @use 'sass:math';
$font-size: math.max(3rem, 5rem);
B. @use 'sass:math';
$font-size: math.min(3rem, 5rem);
C. $font-size: min(3rem, 5rem);
D. @use 'sass:math';
$font-size: math.round(3rem, 5rem);
Solution
Step 1: Understand the goal
You want the smaller value between 3rem and 5rem for responsive font size.
Step 2: Identify correct Sass math function
math.min() returns the smaller of two values. math.max() returns the larger, and math.round() rounds numbers, so they are incorrect here.
Final Answer:
@use 'sass:math';
$font-size: math.min(3rem, 5rem); -> Option B
Quick Check:
Use math.min for smallest value [OK]
Hint: Use math.min to pick smaller value between two units [OK]
Common Mistakes:
Using math.max instead of math.min
Omitting @use import for math module
Trying to round instead of compare values
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.