Q1
Q1 What is the primary purpose of CSS in web development?
To create web pages
To style web pages
To store data
To program web applications
Q2
Q2 Which of the following is a valid way to integrate CSS into a webpage?
Inline
External
Internal
All of the above
Q3
Q3 Which CSS property is used to change the text color of an element?
text-color
color
font-color
background-color
Q4
Q4 Given the following CSS, what color will the text be?
body { color: red; } h1 { color: blue; }
Red
Blue
Green
Black
Q5
Q5 Which selector is used to target an element based on its id?
#id
.id
*id
id
Q6
Q6 What does the universal selector (*) do in CSS?
Targets all elements in a document
Targets no elements
Targets the body element
Targets elements with a specific id
Q7
Q7 Which property is used to set the background color of an element?
color
background-color
bgcolor
background
Q8
Q8 How do you select elements with the class name "example"?
.example
#example
example
*example
Q9
Q9 What is the correct syntax to select all elements inside elements?
div p
div + p
div > p
p > div
Q10
Q10 Which of the following is true about the CSS selector div.example?
Selects all divs with the class "example"
Selects the first div with the class "example"
Selects all divs
Selects all elements with the class "example"
Q11
Q11 What will be the font size of with the CSS .text { font-size: 20px; }?
15px
20px
25px
30px
Q12
Q12 Given the CSS div > p { color: red; }, what color will the text be in ?
Red
Blue
Green
Black
Q13
Q13 Identify the error in the CSS code:
.class { color: blue; font-weight; bold; }
Syntax error in property declaration
Missing class name
Incorrect property value
No error
Q14
Q14 Why might the CSS rule .container p { color: green; } not apply to a paragraph inside a div with class "container"?
The div does not have the "container" class
The paragraph is not a direct child
There is a more specific rule overriding this one
The CSS file is not linked properly
Q15
Q15 What components make up the CSS Box Model?
Content, Padding, Border, Margin
Padding, Margin, Border, Shadow
Content, Margin, Border, Outline
Content, Padding, Shadow, Margin
Q16
Q16 Which property is used to set the space between the border of an element and its content?
Margin
Padding
Border
Outline
Q17
Q17 What does the 'box-sizing' property do?
Changes the CSS Box Model calculation
Alters the display property
Adjusts the border thickness
Modifies the margin size
Q18
Q18 Which CSS property is used to control the outer space around an element?
Padding
Margin
Border
Content
Q19
Q19 How can you make the total width of an element be 100px including padding and border?
Use 'box-sizing: border-box;' with width set to 100px
Set width to 100px without 'box-sizing' property
Use 'box-sizing: content-box;' with width set to 100px
Set width, padding, and border so their sum is 100px
Q20
Q20 What is the default value of the 'box-sizing' property?
content-box
border-box
padding-box
margin-box
Q21
Q21 Which property would you use to create space between elements?
Padding
Margin
Border
Outline
Q22
Q22 If an element has a width of 100px, padding of 10px, and border of 5px, what is the total width of the element if 'box-sizing' is set to 'border-box'?
100px
120px
130px
150px
Q23
Q23 How does setting 'margin: auto;' affect an element?
Centers the element horizontally
Increases the element's height
Adds automatic padding
Does nothing specific
Q24
Q24 Given an element with padding: 20px; and width: 200px;,
what is the total width of the element?
200px
220px
240px
260px
Q25
Q25 What is the effect of setting margin: 0 auto; on an element?
It removes the element's margins
It centers the element horizontally
It sets the margin on all sides to auto
It increases the margin size
Q26
Q26 If an element has margin: 10px; and padding: 20px;,
what is the space between the element and its neighboring element?
10px
20px
30px
40px
Q27
Q27 An element has width: 100px; padding: 15px; border: 5px solid black;.
What is its total width if box-sizing: content-box;?
100px
115px
130px
150px
Q28
Q28 Identify the issue: div { width: 100%; padding: 20px; } without using box-sizing: border-box;.
The div will be wider than its parent
The div's width is too small
No issue
The padding is ignored
Q29
Q29 What is the problem with using margin: 0 auto; on an inline element?
Inline elements cannot be centered this way
The margin will collapse
The auto value is invalid for inline elements
No issue
Q30
Q30 A block element inside a container does not respect the specified margin-top. What could be the reason?
Margin collapse
Incorrect box-sizing
Border interference
Padding on the container