CSS Multiple Choice Questions & Answers on Using Advanced Selectors for Freshers

https://www.computersprofessor.com/2017/12/css-multiple-choice-questions-answers_12.html
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: b
Explanation:
Example: p[title$="!"] {color: red;}
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: c
Explanation:
Example: :checked {color: blue;}
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: a
Explanation:
Example: :default {background-color: red;}
4. Which of the following selector selects an element that has no children?
a) :empty b) :nochild c) :inheritance d) :no-child
Answer: a
Explanation: None.
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: c
Explanation:
Example: input:enabled {background-color:white;}
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: a
Explanation:
Example: strong:first-of-type {font-size:bigger;}
7. Which of the following selector selects elements that do not match the selector s?
a) :!(s) b) :nth-child(s) c) :not(s) d) none of the mentioned
Answer: c
Explanation:
Example: *:not(h1) {color: black;}
8. Which of the following selector selects an element if it’s the only child of its parent?
a) :root b) :nth-oftype(n) c) :only-child d) none of the mentioned
Answer: c
Explanation:
Example: h1:only-child {color: blue;}
9. Which of the following selector selects the element that is the target of a referring URI?
a) :target b) :selection c) ::selection d) :URI
Answer: a
Explanation:
Example: :target{color:red;}
10. Which of the following selector applies styles to elements that are valid per HTML5 validations set either with the pattern or type
attributes?
a) :valid b) :required c) :optional d) :invalid
Answer: a
Explanation:
Example: :valid {color: green;}