Css Selectors And Css Files MCQs with Explanations
Practice high-yield Programming & Software Development MCQs on Css Selectors And Css Files with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.
Questions
29
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
35 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus β’ Oct 14, 2026
29
Verified Practice Questions
Interactive test mode with detailed academic worked solutions
Live Progress|0/29 answered
β0 correct
β0 wrong
0% score
π Set complete! All 29 questions answered.
Question 1 of 29
β FPSC
β PPSC
β FPSC
β PPSC
Which of the following selector selects all elements of E that have the attribute attr that end with the given value?
Correct Answer: Option B β E[attr$=value]
Detailed Academic Explanation:
Example: p[title$="!"] {color: red;}
π‘Key Conceptual Anchor:Css Selectors And Css Files
Question 2 of 29
β FPSC
β PPSC
β FPSC
β PPSC
Which of the following selector selects the elements that are checked?
Correct Answer: Option C β :checked
Detailed Academic Explanation:
Example: :checked {color: blue;}
π‘Key Conceptual Anchor:Css Selectors And Css Files
Question 3 of 29
β FPSC
β PPSC
β FPSC
β PPSC
Which of the following selector selects the elements that are the default among a set of similar elements?
Correct Answer: Option A β :default
Detailed Academic Explanation:
Example: :default {background-color: red;}
π‘Key Conceptual Anchor:Css Selectors And Css Files
Question 4 of 29
β FPSC
β PPSC
β FPSC
β PPSC
Which of the following selector selects the elements that are currently enabled?
Correct Answer: Option C β :enabled
Detailed Academic Explanation:
Example: input:enabled {background-color:white;}
π‘Key Conceptual Anchor:Css Selectors And Css Files
Question 5 of 29
β FPSC
β PPSC
β FPSC
β PPSC
Which of the following selector selects the element that is the first child of its parent that is of its type?
Correct Answer: Option A β :first-of-type
Detailed Academic Explanation:
Example: strong:first-of-type {font-size:bigger;}
π‘Key Conceptual Anchor:Css Selectors And Css Files
Question 6 of 29
β FPSC
β PPSC
β FPSC
β PPSC
Which of the following selector selects elements that do not match the selector s?
Correct Answer: Option C β :not(s)
Detailed Academic Explanation:
Example: *:not(h1) {color: black;}
π‘Key Conceptual Anchor:Css Selectors And Css Files
Question 7 of 29
β FPSC
β PPSC
β FPSC
β PPSC
Which of the following selector selects an element if itβs the only child of its parent?
Correct Answer: Option C β :only-child
Detailed Academic Explanation:
Example: h1:only-child {color: blue;}
π‘Key Conceptual Anchor:Css Selectors And Css Files
Question 8 of 29
β FPSC
β PPSC
β FPSC
β PPSC
Which of the following selector selects the element that is the target of a referring URI?
Correct Answer: Option A β :target
Detailed Academic Explanation:
Example: :target{color:red;}
π‘Key Conceptual Anchor:Css Selectors And Css Files
Question 9 of 29
β FPSC
β PPSC
β FPSC
β PPSC
Which of the following selector applies styles to elements that are valid per HTML5 validations set either with the pattern or type attributes?
Correct Answer: Option A β :valid
Detailed Academic Explanation:
Example: :valid {color: green;}
π‘Key Conceptual Anchor:Css Selectors And Css Files
Question 10 of 29
β FPSC
β PPSC
β FPSC
β PPSC
p {line-height: 150%;}.What type of selector is used in this case?
Correct Answer: Option B β element Selectors
Detailed Academic Explanation:
These selectors are called element selectors and are simply used as follows: element-name { /* properties */ }
π‘Key Conceptual Anchor:Css Selectors And Css Files
Question 11 of 29
β FPSC
β PPSC
β FPSC
β PPSC
By applying an ___________ a style can be applied to just a single tag.
Correct Answer: Option C β id rule
Detailed Academic Explanation:
By applying an id rule, a style can be applied to just a single tag. For example, if we name a tag with a unique id attribute as follows <tag id="id-value"> Affected Text </tag>
π‘Key Conceptual Anchor:Css Selectors And Css Files
Question 12 of 29
β FPSC
β PPSC
β FPSC
β PPSC
What will happen in this case? p strong {background-color: yellow;}
Correct Answer: Option B β Strong element within a p element have a yellow background
Detailed Academic Explanation:
All occurrences of the strong element within a p element have a yellow background.
π‘Key Conceptual Anchor:Css Selectors And Css Files
Question 13 of 29
β FPSC
β PPSC
β FPSC
β PPSC
Which of the following selectors selects any tag with an id attribute set?
Correct Answer: Option C β #id
Detailed Academic Explanation:
Example:#test {color: green;} /* makes a tag with id=βtestβ green */
π‘Key Conceptual Anchor:Css Selectors And Css Files
Question 14 of 29
β FPSC
β PPSC
β FPSC
β PPSC
Which of the following selectors selects direct descendents?
Correct Answer: Option A β E > F
Detailed Academic Explanation:
Example: body > p {background-color: yellow;} /* makes all p tags that have the body tag as their immediate parent have the background color yellow */
π‘Key Conceptual Anchor:Css Selectors And Css Files
Question 15 of 29
β FPSC
β PPSC
β FPSC
β PPSC
Which of the following selectors selects siblings?
Correct Answer: Option B β E ~ F
Detailed Academic Explanation:
Example: p ~ strong {font-style: italic;} /* sets the font style to italic on all strong tags that have a p tag as a preceding sibling */
π‘Key Conceptual Anchor:Css Selectors And Css Files
Question 16 of 29
β FPSC
β PPSC
β FPSC
β PPSC
Which of the following selectors selects the specified elements of type E with a particular class value?
Correct Answer: Option A β E.class
Detailed Academic Explanation:
Example: h1.note {text-decoration: underline;} /* underlines all h1 tags with class='note' */
π‘Key Conceptual Anchor:Css Selectors And Css Files
Question 17 of 29
β FPSC
β PPSC
β FPSC
β PPSC
Which of the following selectors selects adjacent siblings?
Correct Answer: Option C β E + F
Detailed Academic Explanation:
Example: h1 + p {color: red;} /* makes all p tags that are immediately preceded by an h1 tag red */
π‘Key Conceptual Anchor:Css Selectors And Css Files
Question 18 of 29
β FPSC
β PPSC
β FPSC
β PPSC
What will happen in this case? <p style="color: red"> text </p>
Correct Answer: Option A β make that specific paragraph red.
Detailed Academic Explanation:
make that specific paragraph red. is the correct answer to βWhat will happen in this case? <p style="color: red"> text </p>β. This question is standard in competitive examination syllabi for Css Selectors And Css Files.
π‘Key Conceptual Anchor:Css Selectors And Css Files
Question 19 of 29
β FPSC
β PPSC
β FPSC
β PPSC
The _______property is used to set the color of the text.
Correct Answer: Option C β color
Detailed Academic Explanation:
color is the correct answer to βThe _______property is used to set the color of the text.β. This question is standard in competitive examination syllabi for Css Selectors And Css Files.
π‘Key Conceptual Anchor:Css Selectors And Css Files
Question 20 of 29
β FPSC
β PPSC
β FPSC
β PPSC
Which of the following is the correct way to apply Styles?
Correct Answer: Option D β all of the mentioned
Detailed Academic Explanation:
all of the mentioned is the correct answer to βWhich of the following is the correct way to apply Stylesβ. This question is standard in competitive examination syllabi for Css Selectors And Css Files.
π‘Key Conceptual Anchor:Css Selectors And Css Files
Question 21 of 29
β FPSC
β PPSC
β FPSC
β PPSC
Which of the following CSS list properties is/are correct?
Correct Answer: Option D β All of the mentioned
Detailed Academic Explanation:
All of the mentioned is the correct answer to βWhich of the following CSS list properties is/are correctβ. This question is standard in competitive examination syllabi for Css Selectors And Css Files.
π‘Key Conceptual Anchor:Css Selectors And Css Files
Question 22 of 29
β FPSC
β PPSC
β FPSC
β PPSC
A ___________ is used to define a special state of an element.
Correct Answer: Option D β pseudo-class
Detailed Academic Explanation:
pseudo-class is the correct answer to βA ___________ is used to define a special state of an element.β. This question is standard in competitive examination syllabi for Css Selectors And Css Files.
π‘Key Conceptual Anchor:Css Selectors And Css Files
Question 23 of 29
β FPSC
β PPSC
β FPSC
β PPSC
The __________ property specifies the type of positioning method used for an element.
Correct Answer: Option C β position
Detailed Academic Explanation:
position is the correct answer to βThe __________ property specifies the type of positioning method used for an element.β. This question is standard in competitive examination syllabi for Css Selectors And Css Files.
π‘Key Conceptual Anchor:Css Selectors And Css Files
Question 24 of 29
β FPSC
β PPSC
β FPSC
β PPSC
Which of the following selector selects an element that has no children?
Correct Answer: Option A β :empty
Detailed Academic Explanation:
:empty is the correct answer to βWhich of the following selector selects an element that has no childrenβ. This question is standard in competitive examination syllabi for Css Selectors And Css Files.
π‘Key Conceptual Anchor:Css Selectors And Css Files
Question 25 of 29
β FPSC
β PPSC
β FPSC
β PPSC
The _____________ attribute is used to define the name(s) of the class(es) to which a particular tag belongs.
Correct Answer: Option A β class
Detailed Academic Explanation:
class is the correct answer to βThe _____________ attribute is used to define the name(s) of the class(es) to which a particular tag belongs.β. This question is standard in competitive examination syllabi for Css Selectors And Css Files.
π‘Key Conceptual Anchor:Css Selectors And Css Files
Question 26 of 29
β FPSC
β PPSC
β FPSC
β PPSC
A similar rule called the ____________ is specified using the plus sign (+) and is used to select elements that would be siblings of each other.
Correct Answer: Option C β adjacent-sibling selector
Detailed Academic Explanation:
adjacent-sibling selector is the correct answer to βA similar rule called the ____________ is specified using the plus sign (+) and is used to select elements that would be siblings of each other.β. This question is standard in competitive examination syllabi for Css Selectors And Css Files.
π‘Key Conceptual Anchor:Css Selectors And Css Files
Question 27 of 29
β FPSC
β PPSC
β FPSC
β PPSC
What will be the output of following code snippet? <style h1 {color: green;}> <h1>Hello</h1>
Correct Answer: Option C β h1 heading disappears
Detailed Academic Explanation:
h1 heading disappears is the correct answer to βWhat will be the output of following code snippet? <style h1 {color: green;}> <h1>Hello</h1>β. This question is standard in competitive examination syllabi for Css Selectors And Css Files.
π‘Key Conceptual Anchor:Css Selectors And Css Files
Question 28 of 29
β FPSC
β PPSC
β FPSC
β PPSC
Which style is this? <body style="background-color: lightcyan">
Correct Answer: Option A β Inline Styles
Detailed Academic Explanation:
Inline Styles is the correct answer to βWhich style is this? <body style="background-color: lightcyan">β. This question is standard in competitive examination syllabi for Css Selectors And Css Files.
π‘Key Conceptual Anchor:Css Selectors And Css Files
Question 29 of 29
β FPSC
β PPSC
β FPSC
β PPSC
Is this correct way to apply css.State true or false. <link rel="stylesheet" type="text/css" href="mystyle.css">
Correct Answer: Option A β True
Detailed Academic Explanation:
True is the correct answer to βIs this correct way to apply css.State true or false. <link rel="stylesheet" type="text/css" href="mystyle.css">β. This question is standard in competitive examination syllabi for Css Selectors And Css Files.
π‘Key Conceptual Anchor:Css Selectors And Css Files
βLink copied to clipboard
Continue Your Practice
Advance Html β Part 1
Master the next curriculum module with 40 exam-standard MCQs.
π‘Examiner's Advisory for Programming & Software Development
In competitive commission exams (FPSC, PPSC, KPPSC, SPSC, CSS, PMS), questions are frequently phrased with distractor options designed to catch rote learners. Whenever you answer an MCQ, read the Detailed Academic Explanation and Conceptual Anchor to understand why the remaining options are incorrect.