CSS Multiple Choice Questions(MCQs)& Answers

Questions
1 Which of the following selector selects all elements of E that have the attribute attr that end with the given value?
A E[attr^=value]
B E[attr$=value]
C E[attr*=value]
D none of the mentioned

Answer: E[attr$=value]
2 Which of the following selector selects the elements that are checked?
A E ~ F
B ::after
C :checked
D none of the mentioned

Answer: :checked
Advertisement
3 Which of the following selector selects the elements that are the default among a set of similar elements?
A :default
B :%
C :disabled
D none of the mentioned

Answer: :default
4 Which of the following selector selects an element that has no children?
A :empty
B :nochild
C :inheritance
D :no-child

Answer: :empty
5 Which of the following selector selects the elements that are currently enabled?
A :element
B :empty
C :enabled
D none of the mentioned

Answer: :enabled
6 Which of the following selector selects the element that is the first child of its parent that is of its type?
A :first-of-type
B :last-child
C ::first-line
D ::first-letter

Answer: 2.0
7 What type of selector is used in this case?

p {line-height: 150%;}

A class Selectors
B element Selectors
C id Selectors
D none of the mentioned

Answer: element Selectors
8 The _____________ attribute is used to define the name(s) of the class(es) to which a particular tag belongs.
A class
B element
C id
D None of the mentioned

Answer: class
9 Which of the following selectors selects direct descendents?
A E > F
B E F
C E + F
D E ~ F

Answer: E > F
10 Which of the following selectors selects siblings?
A E.class
B E ~ F
C *
D E, F, G

Answer: E ~ F
11 Which of the following selectors selects the specified elements of type E with a particular class value?
A E.class
B E ~ F
C *
D E, F, G

Answer: E.class
12 Which of the following selectors selects adjacent siblings?
A E > F
B E F
C E + F
D E ~ F

Answer: E + F
13 Find the specificity of this “*”.
A specificity = 0,0,0,0
B specificity = 0,0,0,1
C specificity = 0,0,1,0
D specificity = 1,0,0,0

Answer: specificity = 0,0,0,0
14 Find the specificity of this “li”.
A specificity = 0,0,0,1
B specificity = 0,0,1,1
C specificity = 0,1,1,1
D specificity = 1,1,1,1

Answer: specificity = 0,0,0,1
15 Find the specificity of this ” ul li”.
A specificity = 0,0,0,0
B specificity = 0,0,1,2
C specificity = 0,0,0,2
D specificity = 2,0,0,0

Answer: specificity = 0,0,0,2
16 Find the specificity of this “li:first-line”.
A specificity = 0,0,1,1
B specificity = 0,0,0,2
C specificity = 0,1,0,1
D specificity = 1,0,0,1

Answer: specificity = 0,0,0,2
17 Find the specificity of this “ul ol+li”.
A specificity = 0,0,2,1
B specificity = 0,2,1,1
C specificity = 0,1,1,1
D specificity = 0,0,0,3

Answer:specificity = 0,0,0,3
18 Find the specificity of this “ul ol li.red”.
A specificity = 0,0,3,1
B specificity = 0,0,1,3
C specificity = 1,1,1,1
D specificity = 1,2,2,1

Answer: specificity = 0,0,1,3
19 Which of the following property specifies an element’s display type and can override an element’s defined presentation?
A content
B display
C visibility
D none of the mentioned

Answer: none of the mentioned
20 Find the specificity of this “li.red.leve”.
A specificity = 2,0,0,1
B specificity = 0,0,1,1
C specificity = 0,2,0,1
D specificity = 0,0,2,1

Answer: specificity = 0,0,2,1
apsc cce prelims 2025