CSS Practice Exams

CSS Practice Exam

This section provides you with various practice exams related to CSS You can download these sample practice exams to your local machine and work through them offline at your convenience. Each practice exam comes with a practice exam key, allowing you to verify your final score and perform self-grading.

CSS Practice Exam

CSS Practice Test I

Q 1 – Which of the following statements about CSS is correct?


A – CSS is used to control the style of web documents in a simple and easy-to-use way.

B – CSS stands for “Cascading Style Sheets.”

C – You can write CSS once and reuse the same style sheet across multiple HTML pages.

D – All of the above are correct.

Answer: D

Explanation

All of the above are correct.

Show answer

Q 2 – Which of the following statements about CSS is correct?

A – Style sheets allow content to be optimized for multiple devices.

B – CSS can be used to store web applications locally with the help of offline caching.

C – Using CSS, we can view offline websites. Caching also ensures faster loading times and better overall performance.

D – All of the above are correct.

Answer: D

Explanation

All of the above are correct.

Show Answer

Q 3 – Which of the following is a component of a CSS style rule?

A – Selector

B – Property

C – Value

D – All of the above are correct.

Answer: D

Explanation

All of the above are correct.

Show Answer

Q 4 – Which of the following selectors matches all elements of a certain type?

A – Type Selector

B – Universal Selector

C – Descendant Selector

D – Class Selector

Answer: A

Explanation

Type selectors select all elements of a certain type.

Show Answer

Question 5 – Which of the following selectors matches the name of any element type?

A – Type Selector

B – Universal Selector

C – Descendant Selector

D – Class Selector

Answer: B

Explanation

Universal selectors match the name of any element type.

Show Answer

Question 6 – Which of the following selectors matches only when a specific element is within a specific element?

A – Type Selector

B – Universal Selector

C – Descendant Selector

D – Class Selector

Answer: C

Explanation

A descendant selector matches only when a specific element is within a specific element.

Show Answer

Question 7 – Which of the following selectors selects elements based on their class attribute?

A – Type Selector

B – Universal Selector

C – Descendant Selector

D – Class Selector

Answer: D

Explanation

Class selectors select elements based on their class attribute.

Show Answer

Question 8 – Which of the following selectors selects elements based on their id?

A – id Selector

B – Universal Selector

C – Descendant Selector

D – Class Selector

Answer: A

Explanation

ID selectors select elements based on their id attribute.

Show Answer

Question 9 – Which selector selects all paragraph elements with a lang attribute?

A – p[lang]

B – p[lang=”fr”]

C – p[lang~=”fr”]

D – p[lang|=”fr”]

Answer: A

Explanation

p[lang] – Selects all paragraph elements with a lang attribute.

Show Answer

Question 10: – Which of the following selectors selects all paragraph elements with a lang attribute value of “fr”?

A – p[lang]

B – p[lang=”fr”]

C – p[lang~=”fr”]

D – p[lang|=”fr”]

Answer: B

Explanation

p[lang=”fr”] – Selects all paragraph elements whose lang attribute value is “fr”.

Show Answer

Question 11: – Which of the following selectors selects all paragraph elements whose lang attribute contains the word “fr”?

A – p[lang]

B – p[lang=”fr”]

C – p[lang~=”fr”]

D – p[lang|=”fr”]

Answer: C

Explanation

p[lang~=”fr”] – Selects all paragraph elements whose lang attribute contains the word “fr”.

Show Answer

Question 12: – Which of the following selectors selects all paragraph elements whose lang attribute value is exactly “fr” or begins with “fr-”?

A – p[lang]

B – p[lang=”fr”]

C – p[lang~=”fr”]

D – p[lang|=”fr”]

Answer: D

Explanation

p[lang|=”fr”] – Selects all paragraph elements whose lang attribute value is exactly “fr” or begins with “fr-”.

Show Answer

Question 13: – Which of the following methods can be used to associate styles with an HTML document?

A – Inline CSS – rules defined in the

Leave a Reply

Your email address will not be published. Required fields are marked *