CSS Media Queries: Top Interview Questions u0026 Example Scenarios Quiz

  1. Understanding Media Queries

    Which of the following best describes what a CSS media query is used for in web design?

    1. A. Applying styles based on device characteristics like screen size and orientation.
    2. B. Creating animations for user interactions.
    3. C. Storing user data across web pages.
    4. D. Embedding fonts from external sources.
    5. E. Increasing website loading speed directly.
  2. Media Types

    In the media query '@media print { ... }', what does the 'print' part specify?

    1. A. The query runs only for printed documents.
    2. B. The code will create a pop-up message.
    3. C. The style applies to mobile devices only.
    4. D. It indicates the text should be bold.
    5. E. It restricts styles to portrait orientation.
  3. Common Media Features

    Which of the following is a valid media feature you can target in a media query for responsive design?

    1. A. max-width
    2. B. font-family
    3. C. text-align
    4. D. hover-color
    5. E. data-src
  4. Combining Media Features

    How do you combine multiple conditions, such as screen width and orientation, in a single media query?

    1. A. By using the 'and' keyword between features.
    2. B. By separating conditions with a semicolon (;).
    3. C. By placing both conditions within parentheses without any keyword.
    4. D. By writing each condition in a separate media query.
    5. E. By using the 'with' keyword.
  5. Logical Operators

    Which operator allows you to write a media query that only applies if the condition is NOT met?

    1. A. not
    2. B. on
    3. C. in
    4. D. skip
    5. E. nor
  6. Breakpoints in Responsive Design

    What are 'breakpoints' in the context of CSS media queries?

    1. A. Specific screen widths where the layout should change.
    2. B. The points where a browser starts to lag.
    3. C. The maximum number of styles allowed.
    4. D. Predefined font sizes for mobile devices.
    5. E. Dividers for separating HTML elements.
  7. Placing Media Queries

    If you want to change the style of a '.container' class only for screens smaller than 600px, what is the correct way to nest the CSS?

    1. A. Place the rules for '.container' inside a '@media (max-width: 600px)' block.
    2. B. Put the '@media' rule inside the '.container' selector.
    3. C. Use 'container: (max-width: 600px) { ... }' directly.
    4. D. Only add 'max-width' to the '.container' class and it will work automatically.
    5. E. Use '!important' after every style property.
  8. Best Practices

    Which is considered a good practice when writing media queries for responsive design?

    1. A. Use 'max-width' for breakpoints and follow a mobile-first approach.
    2. B. Always use fixed pixel values for all elements.
    3. C. Avoid testing your design on different devices.
    4. D. Only focus on desktop layouts.
    5. E. Write overlapping queries for each device brand.
  9. Media Queries vs Responsive Images

    What is a main difference between CSS media queries and responsive images?

    1. A. Media queries change CSS styles, while responsive images load images based on device conditions.
    2. B. Media queries work only with photos, not layout.
    3. C. Responsive images only affect fonts, not visuals.
    4. D. Both must always be used together.
    5. E. Media queries require JavaScript, responsive images do not.
  10. Media Queries vs Frameworks

    How do custom media queries differ from using predefined CSS framework classes for responsiveness?

    1. A. Media queries offer more precise control, while frameworks use preset classes.
    2. B. Frameworks allow unlimited customization, media queries do not.
    3. C. Both approaches produce identical code with same results automatically.
    4. D. Framework classes require no CSS knowledge at all.
    5. E. Custom media queries are only for print layouts.