In the name of ALLAH, the most beneficient, the most merciful

MCQs (CSS)

Multiple Choice Questions

  1. Examine the HTML and accompanying CSS below.

    < p id="opening-paragraph" class="dorothea" >Miss Brooke had that kind of beauty which seems to be thrown into relief by poor dress.< /p >

    #opening-paragraph { color: blue; }
    .dorothea { color: red; }

    With which color will the paragraph appear on the page?

    1. green
    2. blue
    3. red
    4. black (the default)
  2. Which of the following is not an acceptable value for the list-style-position property?

    1. inside
    2. outside
    3. within
    4. None of the given.
  3. Pretend you have a rule that needs to be applied to both headings h1 and h2. What selector would you use?

    1. h1, h2
    2. h1
    3. h2
    4. .h1, .h2
  4. Which of the following is not a valid CSS unit?

    1. rem
    2. sem
    3. %
    4. vw
  5. .important {
    color:red;
    }

    In CSS, when we use a selector like .important, it means that:

    1. .important is not correct, there is no such selector in CSS
    2. We are going to select all HTML elements that have a class="important" attribute/value, and the CSS rule will be applied to all these elements
    3. We are going to select a single HTML element that has the id="important" attribute. Two HTML elements cannot have the same value for the id attribute (it must be unique and it acts as an identifier)
    4. None of the given.
  6. What is the general best practice for leveraging CSS from a Web page?

    1. Bind in CSS from an external file with a < link > tag
    2. Enter CSS directly into a < style > block
  7. < p id="physics" class="rainbow" >Rainbows result from refraction of sunlight in falling water droplets plus reflection of the light from the back of the droplet.< /p >

    #physics { color: red; }
    .rainbow { color: green; }


    With which color will the paragraph appear?

    1. black (no change)
    2. blue
    3. red
    4. green
  8. What is CSS?

    1. A subset of HTML
    2. A separate language
    3. Used to customize a page for each user
    4. None of the given.
  9. Which CSS property will let you apply an underline to the text of an element?

    1. text-underline
    2. text-decoration
    3. underline
    4. None of the given.
  10. Which CSS property allows you to control the spacing between html items?

    1. spacing
    2. padding
    3. margin
    4. None of the given.
  11. What tag will let you bind an external .css file to a parent .html file?

    1. link
    2. style
    3. css
    4. None of the given.
  12. < p >The proud-mooded < a href="#wederchief" >Wederchief< /a > replied to his question, < q >Hardy 'neath helmet: < q >< a href="#higelac" >Higelac's< /a > mates are we; < a href="beowulf" >Beowulf< /a > hight I. To the bairn of Healfdene, The famous folk-leader, I freely will tell To thy prince my commission, if pleasantly hearing He’ll grant we may greet him so gracious to all men < /q > < /q > < /p >

    In the HTML above, there are hyperlink tags both in a paragraph and within a nested quote. What CSS selector will select any hyperlink at the top of the paragraph, but not hyperlinks in the quotation?

    1. p a
    2. a p
    3. p>a
    4. p
  13. What tag will let you place CSS code directly into an HTML file?

    1. link
    2. style
    3. css
    4. None of the given.
  14. Your < article > contains several paragraphs of text (< p >). You want more space between the individual paragraphs.
    What CSS property should you use to put more space between the paragraphs?

    1. padding
    2. margin
    3. spacing
    4. text-height
  15. The list items (li) in a unordered list (ul) each have bullet points next to them by default. What is the CSS declaration you would use to remove them?

    1. list-style-type: none;
    2. list-style: none;
    3. list-type: none;
    4. None of the given.
  16. Which of the following is NOT an acceptable value for the font-size property?

    1. medium
    2. x-small
    3. .4page
    4. 1.2em
  17. If you wanted to move a banner to the right instead of the left, which of these would you set?

    1. margin-bottom:
    2. margin-left:
    3. margin-top:
    4. margin-right:
  18. Which of the following uses of the tag is correct?

    1. < link rel="stylesheet" href="css/my_styles.css" >
    2. < link rel="stylesheet" src="css/my_styles.css" >
    3. < link rel="css" >
    4. < link href="css/my_styles.css" >
  19. You have a long paragraph of text. You have already adjusted the font-size and are happy with it. But the lines of text in the paragraph are simply too cramped and you want to space them out more.
    What CSS property should you use to make the text less cramped?

    1. text-space
    2. spacing
    3. line-height
    4. line-space
  20. Does the CSS in an external CSS file, like my_file.css, need to be surrounded by < style > ... < /style > tags?

    1. Yes
    2. No
  21. < p id="physics" class="rainbow" >Rainbows result from refraction of sunlight in falling water droplets plus reflection of the light from the back of the droplet.< /p >

    p { color: blue; }
    html, body { color: black; }

    With which color will the paragraph appear?

    1. black
    2. blue
    3. red
    4. green
  22. Given the HTML below, how would you select it by class?
    < p id="dorothea" class="brooks" >Perhaps we don't always discriminate between sense and nonsense.< /p >

    1. brooks
    2. #brooks
    3. .brooks
    4. .dorothea
  23. Which tag supports CSS code between its opening and closing tag?

    1. < div > ... < /div >
    2. < css > ... < /css >
    3. < style > ... < /style >
    4. < link > ... < /link >
  24. What is CSS?

    1. Used to customize a page for each user
    2. A subset of HTML
    3. Used to control what a page looks like
    4. None of the given.
  25. Which CSS property lets you adjust the size of the text?

    1. text-size
    2. font-size
    3. display-size
    4. None of the given.
  26. For which is CSS an acronym?

    1. Canvas Styling System
    2. Cascading Style Sheets
    3. Control and Show Symbolic language
    4. Color Size Selectors
  27. The property that applies an underline does not accept which of the value below?

    1. underline
    2. overline
    3. line-through
    4. italic
  28. < ul id="forest" >
    < li class="evergreen" >< a >pine< /a >< /li >
    < li class="evergreen" >< a >lodgepole< /a >< /li >
    < li class="evergreen fruit" >< a >holly< /a >< /li >
    < li class="leaf fruit" >< a >apple< /a >< /li >
    < li class="leaf" >< a >oak< /a >< /li >
    < li class="leaf" >< a >maple< /a >< /li>
    < /ul >
    There may be other lists on the page, in addition to the one above. Given that, what selector would you use to select all the list items in the forest's unordered list?

    1. ul li
    2. #forest li
    3. ul>li
    4. li
  29. < ul id="forest" >
    < li class="evergreen" >< a >pine< /a >< /li >
    < li class="evergreen" >< a >lodgepole< /a >< /li >
    < li class="evergreen fruit" >< a >holly< /a >< /li >
    < li class="leaf fruit" >< a >apple< /a >< /li >
    < li class="leaf" >< a >oak< /a >< /li >
    < li class="leaf" >< a >maple< /a >< /li>
    < /ul >
    Assume that the evergreen, fruit and leaf classes are not used elsewhere on the page. What selector will select the apple tree, but none of the others?

    1. ul .fruit
    2. .fruit.leaf
    3. .leaf.fruit
    4. li .fruit
  30. Which of the following is not a valid CSS unit?

    1. vh
    2. px
    3. pix
    4. em
  31. Given the HTML below, how would you select it by id?
    < p id="dorothea" >Perhaps we don't always discriminate between sense and nonsense.< /p >

    1. dorothea
    2. #dorothea
    3. .dorothea
    4. None of the given.