SASS (Syntactically Awesome Style Sheets) Certificate Exam — Questions and Answers
Question 1: What does the `grayscale()` function do in Sass?
- Converts a color to pure black or white only
- Converts a color to grayscale by setting its HSL saturation to 0% (Correct answer)
- Reduces the lightness of a color to exactly 50%
- Removes the alpha channel from the color
Correct answer: Converts a color to grayscale by setting its HSL saturation to 0%
`grayscale($color)` sets the HSL saturation of a color to 0%, producing a grayscale equivalent while preserving the original lightness.
Question 2: How deep should Sass nesting ideally go to maintain readable CSS?
- No more than 3 levels (Correct answer)
- As deep as needed
- Exactly 5 levels
- No more than 10 levels
Correct answer: No more than 3 levels
Best practice recommends limiting Sass nesting to 3 levels to avoid specificity issues and unreadable output.
Question 3: How do you break out of a Sass `@while` loop?
- Set the loop condition to false (Correct answer)
- Use `@break`
- Use `@stop`
- Use `@exit`
Correct answer: Set the loop condition to false
Sass does not have a `@break` statement; you exit a `@while` loop by making its condition evaluate to false.
Question 4: What does the `@extend` directive do in Sass?
- Shares styles by adding the extending selector to the extended selector's rule (Correct answer)
- Copies all the styles of a selector into another selector
- Creates a new CSS class with merged properties
- Imports another file's styles
Correct answer: Shares styles by adding the extending selector to the extended selector's rule
`@extend` adds the extending selector to the existing CSS rule, so both selectors share the same styles without duplicating declarations.
Question 5: What is the purpose of an `_index.scss` file in a Sass module directory?
- It stores global variables for the project
- It defines default styles for the module
- It is the first file to compile
- It acts as the entry point for a directory, auto-loaded when the directory is used (Correct answer)
Correct answer: It acts as the entry point for a directory, auto-loaded when the directory is used
When a directory is referenced in `@use` or `@forward`, Sass looks for `_index.scss` as the directory's entry point.
Question 6: How do you insert a variable's value inside a string or selector name in Sass?
- Using the + operator
- Interpolation with #{ } (Correct answer)
- Wrapping in quotes
- Using @content
Correct answer: Interpolation with #{ }
Interpolation #{$var} embeds a variable value into selectors, properties, or strings.
Question 7: Can one placeholder extend another placeholder in Sass?
- Only if they are in the same mixin
- Only if they are in the same file
- No, placeholders cannot extend each other
- Yes, placeholders can extend other placeholders (Correct answer)
Correct answer: Yes, placeholders can extend other placeholders
Placeholders can extend other placeholders, and the chained inheritance is resolved in the compiled output for any selector that extends the outermost placeholder.
Question 8: What is the result of `100% - 30px` in Sass?
- 70px
- calc(100% - 30px)
- 70%
- A compilation error because the units are incompatible (Correct answer)
Correct answer: A compilation error because the units are incompatible
Sass cannot perform arithmetic between values with incompatible units like `%` and `px` at compile time.
Question 9: What does the Sass `hue()` function return?
- The HSL lightness as a percentage
- The HSL saturation as a percentage
- The red channel value (0–255)
- The hue of a color in degrees (0–360) (Correct answer)
Correct answer: The hue of a color in degrees (0–360)
`hue($color)` returns the HSL hue of a color as a number between 0deg and 360deg, representing its position on the color wheel.
Question 10: In the new Sass module system, which built-in module provides color manipulation functions?
- sass:math
- sass:color (Correct answer)
- sass:string
- sass:palette
Correct answer: sass:color
The `sass:color` module, loaded with `@use 'sass:color'`, provides color functions like `color.mix()`, `color.adjust()`, `color.scale()`, and `color.change()`.
Question 11: Which built-in Sass function darkens a color by a given percentage?
- dim($color, $amount)
- shade($color, $amount)
- darken($color, $amount) (Correct answer)
- color.darken($color, $amount)
Correct answer: darken($color, $amount)
The `darken()` function reduces a color's lightness by the specified percentage amount.
Question 12: What is the purpose of `@use 'sass:math'` when using the division operator?
- It unlocks the `/` operator for Sass
- It provides `math.div()` as a safe division function since `/` is ambiguous in CSS (Correct answer)
- It enables integer division
- It improves division performance
Correct answer: It provides `math.div()` as a safe division function since `/` is ambiguous in CSS
Since `/` is a valid CSS separator (e.g., `font: 12px/1.5`), Sass introduced `math.div()` to perform unambiguous division.
Question 13: Why is `@use` preferred over `@import` in modern Sass?
- @use supports more file types
- @use provides namespacing and avoids global namespace pollution (Correct answer)
- @use is faster to compile
- @use works without a build step
Correct answer: @use provides namespacing and avoids global namespace pollution
`@use` loads a Sass file as a namespace, preventing variable/mixin name collisions and making dependencies explicit.
Question 14: What is the difference between a Sass mixin and a function?
- They are identical
- Mixins can only take one argument
- Functions output CSS rules; mixins return values
- Mixins output CSS rules; functions return a single value (Correct answer)
Correct answer: Mixins output CSS rules; functions return a single value
Sass mixins generate CSS declarations, while functions use `@return` to produce a single computed value.
Question 15: How do you access a variable from a `@use`d module?
- module-name::$variable
- @module-name.$variable
- module-name.$variable (Correct answer)
- $module-name.variable
Correct answer: module-name.$variable
Members from `@use`d modules are accessed using dot notation: `namespace.$variable`.
Question 16: How does `scale-color()` differ from `adjust-color()` in Sass?
- `scale-color()` scales values proportionally to their current value; `adjust-color()` changes values by fixed amounts (Correct answer)
- `scale-color()` adds fixed amounts; `adjust-color()` scales proportionally
- They are identical — just different aliases for the same function
- `scale-color()` only works with RGB; `adjust-color()` only works with HSL
Correct answer: `scale-color()` scales values proportionally to their current value; `adjust-color()` changes values by fixed amounts
`scale-color()` adjusts each property by a percentage of the distance to its maximum or minimum, while `adjust-color()` adds or subtracts a fixed absolute amount.
Question 17: In Sass, what does `%placeholder` define?
- A CSS custom property
- A placeholder selector used with `@extend` but not output on its own (Correct answer)
- An optional argument in a mixin
- A variable placeholder
Correct answer: A placeholder selector used with `@extend` but not output on its own
Placeholder selectors (`%name`) define reusable styles that are only output when extended, not on their own.
Question 18: What is the purpose of `@warn` in Sass?
- Suppresses style output
- Throws a compilation error
- Outputs a warning message to the compiler output without stopping compilation (Correct answer)
- Marks a block as deprecated
Correct answer: Outputs a warning message to the compiler output without stopping compilation
`@warn` prints a warning message during compilation but allows the build to continue.
Question 19: How do you configure a module's default variables when using `@use`?
- @use 'module' with ($var: value); (Correct answer)
- @use 'module'; $var: value !override;
- @use 'module' set $var: value;
- @use 'module' config ($var: value);
Correct answer: @use 'module' with ($var: value);
The `with` keyword in `@use` allows you to override a module's `!default` variables at load time.
Question 20: What does the `sass:meta` module's `meta.load-css()` function do?
- Converts a Sass file to CSS string
- Checks if a CSS file is valid
- Loads an external CSS file into the Sass output
- Dynamically loads and includes a Sass module's CSS at a specific point (Correct answer)
Correct answer: Dynamically loads and includes a Sass module's CSS at a specific point
`meta.load-css($url)` dynamically loads a Sass module and injects its compiled CSS output at the point where the function is called.
Question 21: Which Sass data type represents a list of values separated by spaces or commas?
- String
- Boolean
- List (Correct answer)
- Map
Correct answer: List
Sass lists are ordered sequences of values separated by spaces or commas.
Question 22: True/False: The SassScript values can be used as parameters in mixins, and are available as variables within the mixin when the mixin is included.
- B) True (Correct answer)
- A) False
Correct answer: B) True
Sass mixins are designed for reusability and accepting dynamic input. SassScript values can indeed be passed as parameters to a mixin, allowing for flexible and customizable styles. Once passed, these parameters become local variables within the mixin's scope, enabling their use in defining properties and values when the mixin is included.
Question 23: What is the Sass syntax for an if-else statement?
- @if condition { } @else { } (Correct answer)
- @if (condition) then { } else { }
- @if condition { } @otherwise { }
- @when condition { } @default { }
Correct answer: @if condition { } @else { }
Sass uses `@if` for the condition, `@else if` for additional conditions, and `@else` for the fallback.
Question 24: What is the `@forward` directive used for in Sass?
- To forward HTTP requests
- To re-export members from one module through another (Correct answer)
- To send variables to a mixin
- To create a link between two Sass files
Correct answer: To re-export members from one module through another
The `@forward` directive makes the public members of another Sass file available to consumers that `@use` the current file.
Question 25: Can `@extend` be used inside a `@media` block in Sass?
- Yes, always
- Only with placeholder selectors
- No, it can only extend selectors from the same media context (Correct answer)
- Only in Dart Sass
Correct answer: No, it can only extend selectors from the same media context
Sass restricts `@extend` inside `@media` so it can only extend selectors that appear within the same media block, preventing cross-context extension.
Question 26: In Sass, what is the @return directive used for?
- Used to include the mixins in the document.
- Used to call the return value for the function. (Correct answer)
- None of the above
- Used to define the mixin.
Correct answer: Used to call the return value for the function.
In Sass, the `@return` directive is exclusively used within functions to specify the value that the function will output. When a Sass function is called, it executes its logic and then uses `@return` to send a computed value back to the place where the function was invoked. This allows for dynamic value generation and complex calculations within stylesheets.
Question 27: Which Sass directive is used for conditional style output?
- @cond
- @when
- @if (Correct answer)
- @check
Correct answer: @if
The `@if` directive evaluates a condition and outputs the enclosed styles only when the condition is true.
Question 28: Which comparison operator checks if two Sass values are NOT equal?
- not ==
- <>
- != (Correct answer)
- !==
Correct answer: !=
Sass uses `!=` as the not-equal comparison operator in conditional expressions.
Question 29: What does the `meta.get-function()` function allow you to do?
- Store a reference to a function in a variable and pass it to other functions (Correct answer)
- Get the return type of a function
- Convert a mixin into a function
- Read the source code of a function
Correct answer: Store a reference to a function in a variable and pass it to other functions
`meta.get-function($name)` returns a first-class function reference that can be stored in a variable and passed to higher-order functions like `meta.call()`.
SASS (Syntactically Awesome Style Sheets) Certificate Exam
The SASS certificate exam tests knowledge of the SASS/SCSS CSS preprocessor, covering variables, nesting, mixins, functions, control directives, modules, imports, partials, and extends/inheritance.
Exam Rules
- You can skip questions and return to them later
- Flag questions for review before submitting
- No feedback shown until you submit the entire exam
- Unanswered questions count as wrong — answer everything
- 10 pretest questions are mixed in and don't affect your score
- Timer auto-submits when time runs out
- Your progress is auto-saved every 30 seconds