html and css in depth coursera week 2 quiz answers

Knowledge check: Creating layouts

1. Which of the following is not a valid value for the 'display' property?

  • grid 
  • inline-grid 
  • flex
  • box 

2. Which of the following is an absolute unit of measurement in CSS?

  • px
  • vh
  • ch
  • rem

3. Which of the following is a two-dimensional layout model that can be created in CSS?

  • Flex model
  • Box model
  • Floats model 
  • Grid model

4. Which of the following units of measurements are directly associated with the font sizing in CSS? Select all that apply.

  • rem 
  • vw
  • em
  • ch

5. Which of the following properties is not a part of the shorthand 'flex' property?

  • flex-basis
  • flex-shrink
  • flex-grow
  • flex-wrap

6. The box model consists of which of the following properties? Select all that apply.

  • Margin
  • Padding
  • Border 
  • Outline

7. The grid items by default will start at the ________ of the grid container.

  • bottom left 
  • top right
  • bottom right 
  • top left

8. Is the following statement true or false? The cross-axis will always be perpendicular to the main axis in a flexbox.

  • True
  • False 

Knowledge check: CSS selectors

9. While specifying the ideal logical order of the four link-states added as rules in CSS code, what pseudo-class will you add second?

  • Visited
  • Link
  • Hover
  • Active

10. For a given
tag and

tag, which of the following will be the correct syntax for use of adjacent sibling combinator?

  • div ~ p
  • div > p
  • div p
  • div + p

11. Calculate the specificity of the following selector:

```ul#alpha li.visited ```

  • 13
  • 22
  • 103
  • 112

12. ```nth-last-of-type``` is a pseudo element that matches the last sibling from a list of siblings of specific type inside a parent.

  • TRUE
  • False

13. For the given HTML code, irrespective of the effect on other list elements, which of the following will be a valid selector to ensure “Little” is coloured “red”? Select all that apply.

< body>
< ul>
< li class="red">Little
< li>Lemon
< li>Restaurant
< /ul>
< /body>

  • ul > .red{ color: red; }
  • li > red { color: red; }
  • #red { color: red; }
  • .red{ color: red; }
  • li { color: red; }

14. Which of the selectors below will select
tags with a title attribute in CSS?

  • div[title]
  • div#title
  • #title
  • div.title

Knowledge check: CSS effects

15. Which of the following properties is used to set the length of time in seconds for one iteration of animation in CSS?

  • animation-delay
  • animation-timeline
  • animation-timing-function
  • animation-duration

16. What are the benefits of using preprocessors such as SASS and SCSS? Select all that apply.

  • They allow for re-use of values across CSS rules
  • They reduce the amount of CSS to maintain
  • They provide audit functionality

17. The ______ suffix is used to define variables inside SCSS files used for CSS.

  • @
  • $
  • #
  • No special characters are needed

18. What styling property will you apply if you want to rotate an object 60 degrees in counter clockwise direction?

  • rotate: 60deg
  • transform: rotate(-60deg)
  • transform: rotate(60deg)
  • rotate: -60deg

19. You cannot apply more than one property inside a single ‘transform’ declaration rule in CSS.

  • True
  • False

20. Is this valid code for an animation-name ‘animate’?

@keyframes animate {
0% {
transform: rotate(60deg) scale(0.8);
}
25% {
transform: rotate(90deg) scale(1.2);
}
}

  • No, the animation transition is not fully defined
  • Yes, this should work fine
  • No, you cannot use the transform inside @keyframes

Knowledge check: Debugging

21. In a CSS selector such as 'div .alpha>p', what will be the element or class that will be read first by the CSS compiler?

  • div
  • the entire selector is read and interpreted
  • p
  • .alpha

22. What is the default behavior of CSS when it encounters an incomplete rule with missing values?

  • It will stop further compilation altogether without reporting the error
  • It will stop further compilation altogether after reporting the error
  • It will ignore the specific property-value pair and continue compilation
  • It will set default values for the property and continue compilation

23. A styling issue is occurring with an element on your web page. You can skip the missing delimiter for the last property but it is not a good practice.

  • True
  • False

24. Which of the following are ideal coding practices to reduce errors in CSS? Choose all that apply.

  • Overspecificity
  • Universal selectors
  • Shorthand properties

25. Modernizer, reset.css and normalize.css are types of:

  • CSS libraries for help in browser compatibility
  • CSS validators
  • CSS linters
  • CSS libraries for live previews

26. Which of the following types is the stylesheet created by the browser to render CSS?

  • User-agent stylesheet
  • Syntactically Awesome stylesheet
  • Author stylesheet
  • User stylesheet

Module quiz: Interactive CSS

27. Which of the following describes the CSS selector [href~="dog"] ?

  • Select all elements with the href attribute where the value starts with the word dog
  • Select all elements with the href attribute where the value contains the word dog
  • Select all elements with the href attribute where the value ends with the word dog

28. div + p is an example of which type of CSS selector?

  • General Sibling Selector
  • Adjacent Sibling Selector
  • Child Selector

29. Which of the following CSS selectors is suitable for changing an element's style based on the state of the element?

  • Pseudo-class Selector
  • Descendant Selector
  • Element Selector
  • Class Selector

30. True or false. The following CSS code will change the color of paragraph elements to red.

/*
p { color: red; }
*/

  • True
  • False

31. An element with the property set as ‘position: fixed' is placed relative to the parent (or ancestor) element, not the viewport.

  • True
  • False

32. Select the CSS units of measurement that are directly related to the viewport’s measurement. Choose all that apply.

  • vh
  • vi
  • vw
  • vb

33. Which of the following display CSS property values will result in a block-level element? Select all that apply.

  • grid
  • inline-grid
  • flex
  • none

34. Which of the following rules inside the @keyframes is valid code for moving an item by 100px from left to right, assuming elements have an absolute position. Select all that apply.

  • from {left:0px;} to {left:100px;}
  • from {top:0px;} to {top:100px;}
  • from {right:100px;} to {right:0px;}
  • None of the above

35. Which of the following are benefits of using preprocessors?

  • Loops
  • If-Else Statements
  • Variable re-use

36. You're developing a website and another developer noticed that your CSS contains errors. Which of the following will help resolve CSS errors?

  • Inspect the web page using the browser developer tools
  • Install and use a linter
  • Review CSS selectors used and ensure that they are more specific

Leave a Reply