Unit 3 - Practice Quiz

CSE326

1 What does CSS stand for?

A. Computer Style Sheets
B. Cascading Style Sheets
C. Creative Style Sheets
D. Colorful Style Sheets

2 Which HTML tag is used to define an internal style sheet?

A. <css>
B. <script>
C. <style>
D. <link>

3 Which HTML attribute is used to define inline styles?

A. class
B. style
C. font
D. styles

4 What is the correct HTML for referring to an external style sheet?

A. <style src="mystyle.css">
B. <link rel="stylesheet" type="text/css" href="mystyle.css">
C. <stylesheet>mystyle.css</stylesheet>
D. <a href="mystyle.css">

5 Which is the correct CSS syntax?

A. body:color=black;
B. {body;color:black;}
C. body {color: black;}
D. body = color: black;

6 How do you insert a comment in a CSS file?

A. // this is a comment
B. ' this is a comment
C. / this is a comment /
D. <!-- this is a comment -->

7 Which CSS property is used to change the background color?

A. color
B. bgcolor
C. background-color
D. background-style

8 How do you add a background color for all <h1> elements?

A. h1.all {background-color:#FFFFFF;}
B. h1 {background-color:#FFFFFF;}
C. all.h1 {background-color:#FFFFFF;}
D. #h1 {background-color:#FFFFFF;}

9 Which CSS property is used to change the text color of an element?

A. text-color
B. fgcolor
C. color
D. font-color

10 Which CSS property controls the text size?

A. font-style
B. text-size
C. font-size
D. text-style

11 What is the correct CSS syntax for making all the <p> elements bold?

A. p {text-size:bold;}
B. p {font-weight:bold;}
C. p {style:bold;}
D. p {text:bold;}

12 How do you display hyperlinks without an underline?

A. a {decoration:no-underline;}
B. a {text-decoration:none;}
C. a {underline:none;}
D. a {text-style:no-underline;}

13 How do you make each word in a text start with a capital letter?

A. text-style:capitalize
B. transform:capitalize
C. text-transform:capitalize
D. font-transform:capitalize

14 Which property is used to change the font of an element?

A. font-weight
B. font-style
C. font-family
D. font-typeface

15 How do you select an element with id 'demo'?

A. #demo
B. .demo
C. demo
D. *demo

16 How do you select elements with class name 'test'?

A. #test
B. .test
C. test
D. *test

17 How do you select all p elements inside a div element?

A. div.p
B. div p
C. div + p
D. div, p

18 In the CSS Box Model, what is the innermost component?

A. Border
B. Margin
C. Padding
D. Content

19 Which property is used to generate space around an element's content, inside of any defined borders?

A. padding
B. margin
C. border
D. spacing

20 Which property is used to generate space outside the border?

A. padding
B. margin
C. border-spacing
D. outline

21 How do you specify a background image?

A. background-img: url('image.jpg')
B. background-image: url('image.jpg')
C. background-source: 'image.jpg'
D. img-background: url('image.jpg')

22 How do you prevent a background image from repeating?

A. background-repeat: no-repeat;
B. background-repetition: none;
C. background: unique;
D. background-repeat: never;

23 Which CSS property specifies the alignment of text?

A. text-align
B. text-justify
C. font-align
D. text-position

24 What is the correct CSS shorthand for setting a border?

A. border: 1px solid black;
B. border: solid black 1px;
C. border-width: 1px solid black;
D. border-style: 1px black solid;

25 Which property is used to set the height of a line of text?

A. line-height
B. text-height
C. font-height
D. spacing-height

26 What is the difference between 'div' and 'span'?

A. div is inline, span is block
B. div is block, span is inline
C. Both are block elements
D. Both are inline elements

27 Which CSS property collapses table borders into a single border?

A. border-style: collapse;
B. border-collapse: collapse;
C. table-border: single;
D. border-spacing: 0;

28 How do you group multiple selectors to share the same styles?

A. Separate them with a comma
B. Separate them with a space
C. Separate them with a plus sign
D. Separate them with a semicolon

29 If 'margin: 10px 20px 30px 40px;' is set, what is the left margin?

A. 10px
B. 20px
C. 30px
D. 40px

30 Which pseudo-class is used to define a special state of an element when the user moves the mouse over it?

A. :active
B. :hover
C. :focus
D. :visited

31 How do you create a 'zebra-striped' table using CSS?

A. tr:nth-child(even) {background-color: #f2f2f2;}
B. tr:zebra {background-color: #f2f2f2;}
C. table:striped {background-color: #f2f2f2;}
D. tr:odd-even {background-color: #f2f2f2;}

32 Which selector is used to select input fields with a specific type attribute?

A. input#text
B. input.text
C. input[type='text']
D. input:text

33 Which property specifies the stack order of an element?

A. d-index
B. s-index
C. x-index
D. z-index

34 Which CSS property is used to italicize text?

A. font-weight
B. text-style
C. font-style
D. font-variant

35 Which of the following has the highest priority?

A. External CSS
B. Internal CSS
C. Inline CSS
D. Browser default

36 What value of the 'display' property makes an element completely disappear without occupying space?

A. hidden
B. none
C. invisible
D. block

37 How can you center-align a block element (like a div) horizontally?

A. margin-left: auto; margin-right: auto;
B. text-align: center;
C. align: center;
D. float: center;

38 Which property specifies the width of a table border?

A. border-width
B. border-size
C. table-border
D. width

39 Which pseudo-class is commonly used to style an input field when it is clicked on or selected via tab?

A. :selected
B. :active
C. :focus
D. :hover

40 How do you make a list not display bullet points?

A. list-style-type: none;
B. bullet-style: none;
C. text-decoration: none;
D. list: none;

41 What is the purpose of the Universal Selector (*) in CSS?

A. Selects the first element
B. Selects all elements on the page
C. Selects all elements with a specific ID
D. Selects all elements inside a div

42 Which CSS unit is relative to the font-size of the root element?

A. px
B. em
C. rem
D. %

43 Which property allows you to set the position of a background image?

A. background-location
B. background-position
C. background-origin
D. background-align

44 How can you specify that a text area in a form should not be resizable?

A. resize: none;
B. fixed: true;
C. size: fixed;
D. max-width: 100%;

45 Which property controls the space between the borders of adjacent table cells?

A. cell-padding
B. cell-spacing
C. border-spacing
D. border-collapse

46 How do you change the cursor to a pointer/hand when hovering over a submit button?

A. cursor: pointer;
B. mouse: pointer;
C. cursor: hand;
D. pointer: hand;

47 What is the default positioning of HTML elements?

A. relative
B. fixed
C. static
D. absolute

48 Which property specifies the transparency of an element?

A. filter
B. visibility
C. opacity
D. transparent

49 Which CSS selector selects all elements with the class 'intro' inside a div?

A. div.intro
B. div .intro
C. .intro div
D. div #intro

50 Which property adds a shadow to text?

A. font-shadow
B. text-shadow
C. shadow-text
D. text-effect