Selectors & Specificity interview questions

21 Selectors & Specificity questions from the CSS bank, written for Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd.

Sign up free to see every answer with its explanation and ask the AI tutor.

Practice Selectors & Specificity free

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

Answer + AI explanation with a 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

Answer + AI explanation with a 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

Answer + AI explanation with a 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

Answer + AI explanation with a free account

5. Which term means: "a selector matching the unique value of an element's id attribute, written with a leading hash"?

Junior
  1. A.child combinator
  2. B.ID selector
  3. C.attribute selector
  4. D.!important

Answer + AI explanation with a 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

Answer + AI explanation with a 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

Answer + AI explanation with a free account

8. Which term means: "a selector matching elements by a shared class attribute value, written with a leading dot"?

Junior
  1. A.ID selector
  2. B.!important
  3. C.specificity
  4. D.class selector

Answer + AI explanation with a 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

Answer + AI explanation with a 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

Answer + AI explanation with a free account

11. Which term means: "a selector matching only the immediate descendants of an element, written with a greater-than sign"?

Mid
  1. A.adjacent sibling combinator
  2. B.class selector
  3. C.!important
  4. D.child combinator

Answer + AI explanation with a 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

Answer + AI explanation with a 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

Answer + AI explanation with a free account

14. Which term means: "a selector matching the element immediately following another, written with a plus sign"?

Mid
  1. A.adjacent sibling combinator
  2. B.ID selector
  3. C.class selector
  4. D.attribute selector

Answer + AI explanation with a 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

Answer + AI explanation with a 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

Answer + AI explanation with a free account

17. Which term means: "a declaration flag that overrides normal specificity ordering and wins against unflagged rules"?

Senior
  1. A.ID selector
  2. B.child combinator
  3. C.!important
  4. D.specificity

Answer + AI explanation with a 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

Answer + AI explanation with a 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

Answer + AI explanation with a 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

Answer + AI explanation with a 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

Answer + AI explanation with a free account

Free to start

Answers, AI explanations, and a free readiness check

Sign up free to check your answers with explanations, ask the AI tutor anything on any question, and take the free 2-minute readiness check for a scored result. One full AI mock interview, scored like a real panel, is free when you sign up.

Practice Selectors & Specificity free
24,000+ questions & coding problemsSoftware & IT16,274 questionsGovernment jobs26 examsAptitudenew questions every timeAI practice interviewwith feedback65 topics to practiseMechanical1,149 questionsGATE ME9 papersEngineering Mathematics381 questions2-minute checkfreeDSA Problems1,422Civil1,005 questionsGATE CE9 papersCS Fundamentals1,209 questionsYour scores6 skillsSystem Design25Electrical / EEE1,047 questionsGATE EE9 papersRun your codeC++ · Java · PythonLow-Level Design144Electronics & Comm.975 questionsGATE EC9 papersAI help on every questionFull-Stack6,282Chemical1,005 questionsGATE CH9 papersAI whiteboardsystem designWork abroadEurope · remote · transfersESE ME1 paperGATE practice papers2019–2026ESE CE1 paperDate alertsbefore the last dateESE EE1 paperBehavioural courseHR round practiceESE ET1 paperResume optimizerProSSC JE ME1 paperApplication trackerSSC JE CE1 paperCompany-wise prepSSC JE EE1 paperRole roadmapsRRB JE1 subjectPriced in ₹UPI · cardsISRO SC1 paperGATE CS9 papersIBPS SO IT1 paperUGC NET CS1 paperSSC CGL26 papersIBPS PO26 papersRRB NTPC26 papersSSC CHSL26 papersIBPS Clerk26 papersSBI Clerk26 papersRRB Group D26 papersSSC CPO26 papersSSC GD26 papers