SASS Sass 2 — Questions and Answers
Question 1: Which Sass directive imports another partial file at compile time using the modern module system?
- @use (Correct answer)
- @require
- @include
- @extend
Correct answer: @use
@use loads another stylesheet as a module and is the modern replacement for @import.
Question 2: What naming convention identifies a Sass partial that should not be compiled to its own CSS file?
- A leading underscore in the filename (Correct answer)
- A .partial extension
- A trailing dollar sign
- An uppercase filename
Correct answer: A leading underscore in the filename
Files beginning with an underscore (e.g. _buttons.scss) are partials and are not output directly.
Question 3: Which symbol is used to define a variable in SCSS syntax?
- $ (Correct answer)
- @
- %
- #
Correct answer: $
Sass variables are declared with the dollar sign, such as $primary: blue.
Question 4: What does the @mixin directive allow you to do?
- Define reusable groups of CSS declarations (Correct answer)
- Import external files
- Loop over a list
- Concatenate strings
Correct answer: Define reusable groups of CSS declarations
@mixin defines reusable blocks of styles that are inserted with @include.
Question 5: Which operator performs string concatenation in Sass?
- + (Correct answer)
- &
- .
- ~
Correct answer: +
The plus operator concatenates strings in Sass expressions.
Question 6: In SCSS, what does the parent selector & refer to?
- The enclosing parent selector (Correct answer)
- The root element
- The global scope
- The last declared variable
Correct answer: The enclosing parent selector
The ampersand references the parent selector in nested rules, useful for pseudo-classes like &:hover.
Question 7: Which built-in module must you load with @use to access functions like map.get in modern Sass?
- sass:map (Correct answer)
- sass:list
- sass:core
- sass:object
Correct answer: sass:map
The sass:map module provides map functions such as map.get and map.set.
Which Sass directive imports another partial file at compile time using the modern module system?