CSS Mock Test



This section presents you various set of Mock Tests related to CSS. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.

Questions and Answers

CSS Mock Test I

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

A - Selector

B - Property

C - Value

D - All of the above.

Answer : D

Explanation

All of the above options are correct.

Q 4 - Which of the following selector matches all elements of a type?

A - The Type Selector

B - The Universal Selector

C - The Descendant Selector

D - The Class Selector

Answer : A

Explanation

The Type Selector selects all elements of a type.

Q 5 - Which of the following selector matches the name of any element type?

A - The Type Selector

B - The Universal Selector

C - The Descendant Selector

D - The Class Selector

Answer : B

Explanation

The Universal Selector matches the name of any element type.

Q 6 - Which of the following selector matches a particular element only when it lies inside a particular element?

A - The Type Selector

B - The Universal Selector

C - The Descendant Selector

D - The Class Selector

Answer : C

Explanation

The Descendant Selector matches a particular element only when it lies inside a particular element.

Q 7 - Which of the following selector matches a element based on its class attribute?

A - The Type Selector

B - The Universal Selector

C - The Descendant Selector

D - The Class Selector

Answer : D

Explanation

The Class Selector matches a element based on its class attribute.

Q 8 - Which of the following selector matches a element based on its id?

A - The Id Selector

B - The Universal Selector

C - The Descendant Selector

D - The Class Selector

Answer : A

Explanation

The Id Selector matches a element based on its id attribute.

Q 9 - Which of the following 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.

Q 10 - Which of the following selector selects all paragraph elements whose lang attribute has a value of exactly "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 has a value of exactly "fr".

Q 11 - Which of the following selector 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".

Q 12 - Which of the following selector selects all paragraph elements whose lang attribute contains values that are exactly "fr", or begin 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 contains values that are exactly "fr", or begin with "fr-".

Q 13 - Which of the following is a way to associate styles with your HTML document?

A - Embedded CSS - The tags or rules defined in any external style sheet file.

B - Any rule defined in tags will override rules defined in any external style sheet file.

C - Any rule defined in external style sheet file takes lowest priority, and rules defined in this file will be applied only when above two rules are not applicable.

D - All of the above.

Answer : D

Explanation

All of the above.

Q 16 - Which of the following defines a measurement as a percentage relative to another value, typically an enclosing element?

A - %

B - cm

C - em

D - ex

Answer : A

Explanation

% − Defines a measurement as a percentage relative to another value, typically an enclosing element.

Q 17 - Which of the following defines a measurement in centimeters?

A - %

B - cm

C - em

D - ex

Answer : B

Explanation

cm − Defines a measurement in centimeters.

Q 18 - Which of the following defines a relative measurement for the height of a font in em spaces?

A - %

B - cm

C - em

D - ex

Answer : C

Explanation

em − A relative measurement for the height of a font in em spaces. Because an em unit is equivalent to the size of a given font, if you assign a font to 12pt, each "em" unit would be 12pt; thus, 2em would be 24pt.

Q 19 - Which of the following defines a measurement relative to a font's x-height?

A - %

B - cm

C - em

D - ex

Answer : D

Explanation

ex − This value defines a measurement relative to a font's x-height. The x-height is determined by the height of the font's lowercase letter x.

Q 20 - Which of the following defines a measurement in inches?

A - in

B - mm

C - pc

D - pt

Answer : A

Explanation

in − Defines a measurement in inches.

Q 21 - Which of the following defines a measurement in millimeters?

A - in

B - mm

C - pc

D - pt

Answer : B

Explanation

mm − Defines a measurement in millimeters.

Q 22 - Which of the following defines a measurement in picas?

A - in

B - mm

C - pc

D - pt

Answer : C

Explanation

pc − Defines a measurement in picas. A pica is equivalent to 12 points; thus, there are 6 picas per inch.

Q 23 - Which of the following defines a measurement in points?

A - in

B - mm

C - pc

D - pt

Answer : D

Explanation

pt − Defines a measurement in points. A point is defined as 1/72nd of an inch.

Q 24 - Which of the following defines a measurement in screen pixels?

A - px

B - vh

C - vw

D - vmin

Answer : A

Explanation

px − Defines a measurement in screen pixels.

Q 25 - Which of the following defines 1% of viewport height?

A - px

B - vh

C - vw

D - vmin

Answer : B

Explanation

vh − 1% of viewport height.

Answer Sheet

Question Number Answer Key
1 D
2 D
3 D
4 A
5 B
6 C
7 D
8 A
9 A
10 B
11 C
12 D
13 C
14 C
15 D
16 A
17 B
18 C
19 D
20 A
21 B
22 C
23 D
24 A
25 B
css_questions_answers.htm
Advertisements