Unit 3: Introduction to Cascading Style Sheets - Practice Quiz

CSE326 — Internet Programming Laboratory 50 Questions
0 Correct 0 Wrong 50 Left
0/50

1 What does CSS stand for?

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

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

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

3 Which HTML attribute is used to define inline styles?

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

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

A. <link rel="stylesheet" type="text/css" href="mystyle.css">
B. <style src="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. background-color
C. background-style
D. bgcolor

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

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

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

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

10 Which CSS property controls the text size?

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

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

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

12 How do you display hyperlinks without an underline?

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

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

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

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

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

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. Margin
B. Border
C. Content
D. Padding

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

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

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

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

21 How do you specify a background image?

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

22 How do you prevent a background image from repeating?

A. background: unique;
B. background-repeat: no-repeat;
C. background-repetition: none;
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-width: 1px solid black;
C. border: solid black 1px;
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. spacing-height
D. font-height

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

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

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

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

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

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

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

A. 30px
B. 10px
C. 20px
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. :hover
B. :visited
C. :focus
D. :active

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

A. tr:zebra {background-color: #f2f2f2;}
B. tr:nth-child(even) {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[type='text']
B. input:text
C. input.text
D. input#text

33 Which property specifies the stack order of an element?

A. x-index
B. z-index
C. s-index
D. d-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. Internal CSS
B. Inline CSS
C. Browser default
D. External CSS

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

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

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

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

38 Which property specifies the width of a table border?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

47 What is the default positioning of HTML elements?

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

48 Which property specifies the transparency of an element?

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

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

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

50 Which property adds a shadow to text?

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