Wednesday, 19 February 2025

MCQs Of Class 5: Text Styling in CSS

 


MCQs Of Class 5: Text Styling in CSS

1.   Which CSS property is used to change the color of text?

o    a) font-family

o    b) color

o    c) text-decoration

o    d) font-size

Answer: b) color
Explanation: The color property in CSS is used to change the color of text.


2.   What does the font-family property do in CSS?

o    a) It sets the font size.

o    b) It changes the font color.

o    c) It specifies the font of the text.

o    d) It adds a border to the text.

Answer: c) It specifies the font of the text.
Explanation: The font-family property specifies which font should be used for the text.


3.   Which of the following is a valid value for the text-align property?

o    a) vertical

o    b) justify

o    c) spacing

o    d) color

Answer: b) justify
Explanation: The valid values for text-align include left, center, right, and justify.


4.   Which CSS property is used to change the size of the text?

o    a) font-size

o    b) text-decoration

o    c) text-align

o    d) color

Answer: a) font-size
Explanation: The font-size property defines the size of the text.


5.   What does the text-decoration property do?

o    a) It changes the font size.

o    b) It adds decoration to text (like underline, strikethrough).

o    c) It aligns the text.

o    d) It changes the text color.

Answer: b) It adds decoration to text (like underline, strikethrough).
Explanation: The text-decoration property is used to set decorations like underline, overline, line-through, or none on the text.


6.   Which property would you use to underline a word in a paragraph?

o    a) font-family

o    b) text-align

o    c) text-decoration

o    d) font-size

Answer: c) text-decoration
Explanation: The text-decoration property can be used to underline text using the value underline.


7.   What value of the text-align property would center the text horizontally?

o    a) left

o    b) center

o    c) right

o    d) justify

Answer: b) center
Explanation: The text-align: center; value centers the text horizontally within the container.


8.   Which unit can you use for the font-size property?

o    a) px

o    b) em

o    c) rem

o    d) All of the above

Answer: d) All of the above
Explanation: The font-size property can use multiple units like px (pixels), em, rem, %, etc.


9.   Which CSS property is used to specify the text color in a <span> tag?

o    a) background-color

o    b) color

o    c) text-color

o    d) font-color

Answer: b) color
Explanation: The color property is used to specify the text color.


10.                     How do you apply a Google font like Roboto in your HTML file?

o    a) font-family: 'Roboto';

o    b) link rel="stylesheet" href="..."

o    c) font-family: 'Arial';

o    d) text-decoration: 'Roboto';

Answer: b) link rel="stylesheet" href="..."
Explanation: You need to link the Google Fonts stylesheet in the <head> section of your HTML to use the Roboto font.


11.                     What happens when you apply font-size: 2em; in CSS?

o    a) The text becomes twice the size of the parent element's font size.

o    b) The text becomes 2px.

o    c) The text disappears.

o    d) The text becomes bold.

Answer: a) The text becomes twice the size of the parent element's font size.
Explanation: em is a relative unit, so 2em means the font size will be 2 times the size of the parent element's font size.


12.                     Which CSS property is used to make text bold?

o    a) font-weight

o    b) text-decoration

o    c) font-size

o    d) font-style

Answer: a) font-weight
Explanation: The font-weight property is used to make text bold.


13.                     Which of the following values can the text-decoration property take?

o    a) bold

o    b) underline

o    c) center

o    d) italic

Answer: b) underline
Explanation: text-decoration can be used to apply styles like underline, overline, line-through, etc.


14.                     What does the line-height property affect in CSS?

o    a) The space between text lines.

o    b) The font color.

o    c) The text size.

o    d) The space around the text block.

Answer: a) The space between text lines.
Explanation: The line-height property sets the amount of space between lines of text.


15.                     Which of the following is the default value of the text-align property?

o    a) left

o    b) center

o    c) right

o    d) justify

Answer: a) left
Explanation: The default text alignment in HTML is left.


16.                     Which of these units is best for responsive typography?

o    a) px

o    b) em

o    c) rem

o    d) All of the above

Answer: b) em
Explanation: em is relative to the parent element and is more responsive to different screen sizes compared to px.


17.                     How would you apply a line-through effect to a paragraph?

o    a) text-decoration: strikethrough;

o    b) text-decoration: underline;

o    c) text-decoration: line-through;

o    d) font-style: line-through;

Answer: c) text-decoration: line-through;
Explanation: The text-decoration: line-through; value adds a line-through effect to the text.


18.                     Which CSS property would you use to change the text alignment of a heading?

o    a) text-decoration

o    b) font-size

o    c) text-align

o    d) font-family

Answer: c) text-align
Explanation: The text-align property is used to align the text in a container.


19.                     How do you make text appear in a specific font, such as 'Arial' in CSS?

o    a) font-family: 'Arial';

o    b) font-style: 'Arial';

o    c) text-decoration: 'Arial';

o    d) font: 'Arial';

Answer: a) font-family: 'Arial';
Explanation: The font-family property specifies the font to be used.


20.                     Which of the following is not a valid text-align property value?

o    a) left

o    b) center

o    c) middle

o    d) justify

Answer: c) middle
Explanation: middle is not a valid value for the text-align property.


21.                     How do you make text bold using CSS?

o    a) font-style: bold;

o    b) font-weight: bold;

o    c) text-decoration: bold;

o    d) text-transform: bold;

Answer: b) font-weight: bold;
Explanation: font-weight: bold; is used to make text bold in CSS.


22.                     Which property would you use to change the spacing between characters?

o    a) line-height

o    b) word-spacing

o    c) letter-spacing

o    d) margin

Answer: c) letter-spacing
Explanation: The letter-spacing property adjusts the spacing between characters.


23.                     How do you remove the underline from a hyperlink in CSS?

o    a) text-decoration: none;

o    b) font-style: none;

o    c) text-transform: none;

o    d) text-decoration: remove;

Answer: a) text-decoration: none;
Explanation: text-decoration: none; removes the underline from hyperlinks.


24.                     What does font-size: 1.5em; mean in CSS?

o    a) The text will be 1.5 times the size of the parent element's font.

o    b) The text will have a fixed size of 1.5px.

o    c) The text will shrink to 1.5% of its original size.

o    d) The text will be 1.5 times the size of the body text.

Answer: a) The text will be 1.5 times the size of the parent element's font.
Explanation: 1.5em is relative to the parent element's font size.


25.                     Which CSS property is used to make the text italic?

o    a) font-weight

o    b) text-decoration

o    c) font-style

o    d) text-align

Answer: c) font-style
Explanation: The font-style property is used to make the text italic.


26.                     Which of the following values can the font-weight property take?

o    a) bold

o    b) normal

o    c) lighter

o    d) All of the above

Answer: d) All of the above
Explanation: font-weight can be bold, normal, lighter, or numeric values (100, 200, ..., 900).


27.                     What is the default font-size for text in most browsers?

o    a) 10px

o    b) 12px

o    c) 16px

o    d) 14px

Answer: c) 16px
Explanation: The default font-size for text in most browsers is 16px.


28.                     Which of the following properties controls the space between words in text?

o    a) line-height

o    b) word-spacing

o    c) letter-spacing

o    d) text-indent

Answer: b) word-spacing
Explanation: The word-spacing property controls the space between words in a block of text.


29.                     How do you make the text bold and italic simultaneously?

o    a) font-weight: bold; font-style: italic;

o    b) font-weight: italic; font-style: bold;

o    c) text-decoration: bold italic;

o    d) font: bold italic;

Answer: a) font-weight: bold; font-style: italic;
Explanation: You can combine both properties by applying font-weight: bold; and font-style: italic; to the text.


30.                     What does the text-transform property do in CSS?

o    a) It changes the color of text.

o    b) It changes the text alignment.

o    c) It transforms the case of the text (uppercase, lowercase, capitalize).

o    d) It adds spacing between characters.

Answer: c) It transforms the case of the text (uppercase, lowercase, capitalize).
Explanation: text-transform is used to control the case of text (e.g., uppercase, lowercase, capitalize).


31.                     Which property is used to add space before the text inside an element?

o    a) margin

o    b) padding

o    c) text-indent

o    d) text-align

Answer: c) text-indent
Explanation: text-indent is used to add space before the first line of text in a block.


32.                     Which of the following is true about the letter-spacing property?

o    a) It sets the space between lines of text.

o    b) It sets the space between paragraphs.

o    c) It sets the space between characters in text.

o    d) It sets the space between words in text.

Answer: c) It sets the space between characters in text.
Explanation: letter-spacing controls the space between characters in a block of text.


33.                     What does the text-shadow property do in CSS?

o    a) It changes the color of the text.

o    b) It adds a shadow effect to the text.

o    c) It adds a background color to the text.

o    d) It aligns the text.

Answer: b) It adds a shadow effect to the text.
Explanation: The text-shadow property is used to add a shadow effect to the text.


34.                     Which of these properties would you use to set the space between lines of text?

o    a) text-indent

o    b) letter-spacing

o    c) line-height

o    d) word-spacing

Answer: c) line-height
Explanation: The line-height property sets the space between lines of text.


35.                     Which of the following properties is used to italicize text in CSS?

o    a) text-decoration

o    b) font-style

o    c) text-transform

o    d) text-align

Answer: b) font-style
Explanation: The font-style property is used to italicize text.


36.                     Which property is used to make the text look strikethrough?

o    a) text-decoration

o    b) text-transform

o    c) font-weight

o    d) line-height

Answer: a) text-decoration
Explanation: text-decoration: line-through; is used to create a strikethrough effect on text.


37.                     What will the following CSS rule do: text-align: justify;?

o    a) It aligns text to the right.

o    b) It aligns text to the left.

o    c) It aligns text in a justified manner (stretches text across the container).

o    d) It centers the text.

Answer: c) It aligns text in a justified manner (stretches text across the container).
Explanation: text-align: justify; ensures the text spreads out to fill the width of the container.


38.                     Which of these properties will set the space between words in text?

o    a) text-decoration

o    b) word-spacing

o    c) letter-spacing

o    d) line-height

Answer: b) word-spacing
Explanation: The word-spacing property sets the space between words in a block of text.


39.                     Which of the following can the font-size property accept?

o    a) px

o    b) em

o    c) rem

o    d) All of the above

Answer: d) All of the above
Explanation: font-size can accept various units like px, em, rem, %, etc.


40.                     Which CSS property controls the weight of text?

o    a) font-size

o    b) text-align

o    c) font-weight

o    d) letter-spacing

Answer: c) font-weight
Explanation: The font-weight property is used to control the thickness (boldness) of the text.


41.                     What is the default value for font-weight in most browsers?

o    a) bold

o    b) normal

o    c) bolder

o    d) lighter

Answer: b) normal
Explanation: The default value of font-weight is normal (regular font thickness).


42.                     What does the font-style property in CSS do?

o    a) It defines the thickness of the text.

o    b) It sets the font family for the text.

o    c) It specifies the style (italic, oblique) of the text.

o    d) It sets the space between characters.

Answer: c) It specifies the style (italic, oblique) of the text.
Explanation: font-style defines the style of the text, like italic, normal, or oblique.


43.                     Which CSS property is used to change the weight of the text?

o    a) font-style

o    b) font-family

o    c) font-weight

o    d) text-align

Answer: c) font-weight
Explanation: font-weight is used to adjust the weight (boldness) of the text.


44.                     Which CSS rule would you use to underline text?

o    a) text-decoration: underline;

o    b) text-decoration: line-through;

o    c) text-decoration: overline;

o    d) text-transform: underline;

Answer: a) text-decoration: underline;
Explanation: The text-decoration: underline; rule applies an underline to the text.


45.                     How can you align text to the right in CSS?

o    a) text-align: center;

o    b) text-align: right;

o    c) text-align: left;

o    d) text-align: justify;

Answer: b) text-align: right;
Explanation: text-align: right; aligns the text to the right side of the container.


46.                     Which of these values would you use to make text appear uppercase?

o    a) text-transform: capitalize;

o    b) text-transform: lowercase;

o    c) text-transform: uppercase;

o    d) text-transform: none;

Answer: c) text-transform: uppercase;
Explanation: The text-transform: uppercase; value transforms text to uppercase letters.


47.                     Which property defines the space between lines of text in CSS?

o    a) letter-spacing

o    b) text-align

o    c) line-height

o    d) word-spacing

Answer: c) line-height
Explanation: line-height controls the space between lines of text in a block of text.


48.                     Which CSS property is used to align text vertically within a block?

o    a) text-align

o    b) vertical-align

o    c) line-height

o    d) text-indent

Answer: b) vertical-align
Explanation: vertical-align is used to align text vertically within its container.


49.                     Which property is used to specify the family of fonts for an element?

o    a) font-family

o    b) font-size

o    c) font-style

o    d) font-variant

Answer: a) font-family
Explanation: font-family specifies which font or group of fonts should be used for the text.


50.                     Which of the following is not a valid value for the font-style property?

o    a) italic

o    b) oblique

o    c) underline

o    d) normal

Answer: c) underline
Explanation: font-style can be italic, oblique, or normal, but not underline.

 


No comments:

Post a Comment

Search This Blog

Powered by Blogger.