Selectors & Specificity interview questions

21 real Selectors & Specificity questions from the CSS bank, as asked in Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd — free to start.

1. What is specificity?

Mid
  1. A.a declaration flag that overrides normal specificity ordering and wins against unflagged rules
  2. B.a selector matching elements based on the presence or value of an attribute, written in square brackets
  3. C.the weighting that decides which conflicting rule wins, counting inline styles, IDs, classes, and type selectors
  4. D.a selector matching only the immediate descendants of an element, written with a greater-than sign
Reveal the answer + AI explanation — free account

2. Which term means: "the weighting that decides which conflicting rule wins, counting inline styles, IDs, classes, and type selectors"?

Mid
  1. A.ID selector
  2. B.adjacent sibling combinator
  3. C.child combinator
  4. D.specificity
Reveal the answer + AI explanation — free account

3. Which statement is correct?

Mid
  1. A.specificity — a selector matching the element immediately following another, written with a plus sign
  2. B.specificity — a selector matching the unique value of an element's id attribute, written with a leading hash
  3. C.specificity — the weighting that decides which conflicting rule wins, counting inline styles, IDs, classes, and type selectors
  4. D.specificity — a selector matching only the immediate descendants of an element, written with a greater-than sign
Reveal the answer + AI explanation — free account

4. What is ID selector?

Junior
  1. A.a selector matching only the immediate descendants of an element, written with a greater-than sign
  2. B.a selector matching the unique value of an element's id attribute, written with a leading hash
  3. C.a declaration flag that overrides normal specificity ordering and wins against unflagged rules
  4. D.a selector matching elements based on the presence or value of an attribute, written in square brackets
Reveal the answer + AI explanation — free account

6. Which statement is correct?

Junior
  1. A.ID selector — a selector matching the unique value of an element's id attribute, written with a leading hash
  2. B.ID selector — a declaration flag that overrides normal specificity ordering and wins against unflagged rules
  3. C.ID selector — a selector matching elements based on the presence or value of an attribute, written in square brackets
  4. D.ID selector — a selector matching elements by a shared class attribute value, written with a leading dot
Reveal the answer + AI explanation — free account

7. What is class selector?

Junior
  1. A.a selector matching the element immediately following another, written with a plus sign
  2. B.a selector matching the unique value of an element's id attribute, written with a leading hash
  3. C.a selector matching only the immediate descendants of an element, written with a greater-than sign
  4. D.a selector matching elements by a shared class attribute value, written with a leading dot
Reveal the answer + AI explanation — free account

9. Which statement is correct?

Junior
  1. A.class selector — a selector matching only the immediate descendants of an element, written with a greater-than sign
  2. B.class selector — a selector matching elements by a shared class attribute value, written with a leading dot
  3. C.class selector — a selector matching the element immediately following another, written with a plus sign
  4. D.class selector — a selector matching elements based on the presence or value of an attribute, written in square brackets
Reveal the answer + AI explanation — free account

10. What is child combinator?

Mid
  1. A.the weighting that decides which conflicting rule wins, counting inline styles, IDs, classes, and type selectors
  2. B.a selector matching elements based on the presence or value of an attribute, written in square brackets
  3. C.a selector matching the element immediately following another, written with a plus sign
  4. D.a selector matching only the immediate descendants of an element, written with a greater-than sign
Reveal the answer + AI explanation — free account

12. Which statement is correct?

Mid
  1. A.child combinator — a selector matching the element immediately following another, written with a plus sign
  2. B.child combinator — the weighting that decides which conflicting rule wins, counting inline styles, IDs, classes, and type selectors
  3. C.child combinator — a selector matching elements based on the presence or value of an attribute, written in square brackets
  4. D.child combinator — a selector matching only the immediate descendants of an element, written with a greater-than sign
Reveal the answer + AI explanation — free account

13. What is adjacent sibling combinator?

Mid
  1. A.a selector matching the element immediately following another, written with a plus sign
  2. B.the weighting that decides which conflicting rule wins, counting inline styles, IDs, classes, and type selectors
  3. C.a selector matching the unique value of an element's id attribute, written with a leading hash
  4. D.a selector matching elements based on the presence or value of an attribute, written in square brackets
Reveal the answer + AI explanation — free account

15. Which statement is correct?

Mid
  1. A.adjacent sibling combinator — a selector matching the unique value of an element's id attribute, written with a leading hash
  2. B.adjacent sibling combinator — the weighting that decides which conflicting rule wins, counting inline styles, IDs, classes, and type selectors
  3. C.adjacent sibling combinator — a selector matching the element immediately following another, written with a plus sign
  4. D.adjacent sibling combinator — a selector matching elements by a shared class attribute value, written with a leading dot
Reveal the answer + AI explanation — free account

16. What is !important?

Senior
  1. A.a declaration flag that overrides normal specificity ordering and wins against unflagged rules
  2. B.a selector matching elements based on the presence or value of an attribute, written in square brackets
  3. C.a selector matching only the immediate descendants of an element, written with a greater-than sign
  4. D.the weighting that decides which conflicting rule wins, counting inline styles, IDs, classes, and type selectors
Reveal the answer + AI explanation — free account

18. Which statement is correct?

Senior
  1. A.!important — a declaration flag that overrides normal specificity ordering and wins against unflagged rules
  2. B.!important — a selector matching elements based on the presence or value of an attribute, written in square brackets
  3. C.!important — a selector matching elements by a shared class attribute value, written with a leading dot
  4. D.!important — a selector matching the element immediately following another, written with a plus sign
Reveal the answer + AI explanation — free account

19. What is attribute selector?

Mid
  1. A.a selector matching elements by a shared class attribute value, written with a leading dot
  2. B.a selector matching only the immediate descendants of an element, written with a greater-than sign
  3. C.a selector matching the element immediately following another, written with a plus sign
  4. D.a selector matching elements based on the presence or value of an attribute, written in square brackets
Reveal the answer + AI explanation — free account

20. Which term means: "a selector matching elements based on the presence or value of an attribute, written in square brackets"?

Mid
  1. A.!important
  2. B.attribute selector
  3. C.class selector
  4. D.adjacent sibling combinator
Reveal the answer + AI explanation — free account

21. Which statement is correct?

Mid
  1. A.attribute selector — a selector matching elements by a shared class attribute value, written with a leading dot
  2. B.attribute selector — a selector matching the unique value of an element's id attribute, written with a leading hash
  3. C.attribute selector — a declaration flag that overrides normal specificity ordering and wins against unflagged rules
  4. D.attribute selector — a selector matching elements based on the presence or value of an attribute, written in square brackets
Reveal the answer + AI explanation — free account

Free to start

Answers, AI explanations, and a scored voice mock interview

Sign up free to check your answers with explanations, ask the AI tutor anything on any question, and take one full AI mock interview — scored like a real panel.

Practice Selectors & Specificity free