HTML Questions & Answers – Fonts in HTML

This set of HTML Multiple Choice Questions & Answers (MCQs) focuses on “Fonts in HTML”.

1. How many standard color names does HTML supports?
a) 120
b) 130
c) 140
d) 90
View Answer

Answer: c
Explanation: In HTML one can use a color name to specify a color e.g. Tomato, Orange, DodgerBlue, MediumSeaGreen, Gray, SlateBlue, Violet, LightGray etc. For colored fonts, we used text-decoration property to set the color of the text.

2. Which of the following is not set with font-style property?
a) font-style: normal
b) font-style: italic
c) font-style: oblique
d) font-style: capitalize
View Answer

Answer: d
Explanation: Text-transform: capitalize, capitalizes the first letter of each word whereas font-style set font as normal, italic, oblique. We use text-transform: uppercase and text-transform: lowercase to change the text from lowercase to uppercase and from uppercase to lowercase respectively.

3. What should be set with text-align property so that every line has equal width like in magazines and newspapers?
a) text-align: justify
b) text-align: none
c) text-align: bottom
d) text-align: top
View Answer

Answer: a
Explanation: By setting text-align property to “justify”, each line is stretched so that every line has equal width, left and right margins are straight like in magazines and newspapers. Text-align: center, text-align: right, text-align: left is also used for aligning the text at center, right and left respectively.
advertisement
advertisement

4. Which of the following is not used with text-decoration property?
a) overline
b) underline
c) line-through
d) inline
View Answer

Answer: d
Explanation: overline, underline, line-through properties are used to decorate the text.

Syntax: 
h1{text-decoration: line-through; }, 
h2 {text-decoration: overline ;}, 
h3{text-decoration: underline;}

it will produce headings h1 with text having line-through, h2 with text having overline and h3 with text having underline.

Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

5. Which works similar to <i> element?
a) <strong>
b) <em>
c) <b>
d) <blockquote>
View Answer

Answer: b
Explanation: <strong> element shows the importance of text/paragraph between it’s tags. <b></b> makes text bolder. A section which is quoted from another source is specified by <blockquote>. <em> element indicates emphasis, browser will show the contents of <em> element in italic.

advertisement
<p>I <em>like</em> dog.</p>

Output: I like dog.

advertisement

6. Which works similar to <b> element?
a) <strong>
b) <em>
c) <i>
d) <blockquote>
View Answer

Answer: a
Explanation: The words written inside <strong> can be said with strong emphasis. Browser shows contents written inside <strong> element in bold.

<p><strong>Dog is</strong> an animal.</p>

Output: Dog is an animal.

7. Which element is used for short quote?
a) <q>
b) <blockquote>
c) <em>
d) <abbr>
View Answer

Answer: a
Explanation: <em> element indicates emphasis, browser will show the contents of <em> element in italic. A section which is quoted from another source is specified by <blockquote>. The <abbr> defines abbreviation. We used <q> element for shorter quote. Browser put quote around <q> element.

<p>This is a <q>black dog</q>.</p>

Output: This is a “black dog”.

8. Which element is used for abbreviation or acronym?
a) <em>
b) <q>
c) <abbr>
d) <blockquote>
View Answer

Answer: c
Explanation: <em> element indicates emphasis, browser will show the contents of <em> element in italic. We used <q> element for shorter quote. Browser put quote around <q> element. A section which is quoted from another source is specified by <blockquote>. For using, abbreviation or acronym <abbr> element is helpful. A title element is to be used with abbr.

<p>The <abbr title=”Doctor”>Dr.</abbr> is on the way.</p>

Output: The Dr. is on the way.

9. What is the work of <address> element?
a) contains contact details for author
b) contains IP address
c) contains home address
d) contains url
View Answer

Answer: a
Explanation: The contact details for author of a page is specified by <address> attribute. The content is often displayed in italics,

e.g. 
<address>
<a href="mailto:[email protected]">Sanfoundry</a>
</address>

Output:

Sanfoundry

10. To show deleted text, which element is used?
a) <ins>
b) <del>
c) <em>
d) <strong>
View Answer

Answer: b
Explanation: <strong> element shows the importance of text/paragraph between it’s tags. <em> element indicates emphasis, browser will show the contents of <em> element in italic. <ins> element shows the content that has been inserted, usually it has underline. <del> element shows text that has been deleted from, usually it has a line through the content.

<p>This is <del>not</del> for deletion </p>

Output: This is not for deletion.

11. Which element is used to show inserted element?
a) <ins>
b) <del>
c) <strong>
d) <em>
View Answer

Answer: a
Explanation: <del> element shows text that has been deleted from, usually it has a line through the content. <strong> element shows the importance of text/paragraph between it’s tags. <em> element indicates emphasis, browser will show the contents of <em> element in italic. <ins> element shows the content that has been inserted, usually it has underline.

<p>This is the <ins>inserted </ins> element.</p>

Output: This is the inserted element.

12. How <bdo> element works?
a) override text direction
b) stops writing in the current text direction
c) only override direction of rtl text
d) only changes the direction of ltr text
View Answer

Answer: a
Explanation: For bidirectional override of current text direction, we used <bdo> element, e.g. <bdo dir=”rtl”>Text is right to left</bdo>. This element was already there before HTML5. It is supported by all the browsers.

13. Which property is similar to C/C++ can be applied to comments?
a) for loop
b) while loop
c) ifelse
d) switch case
View Answer

Answer: c
Explanation: We can add conditional comments in our web page using if and endif, e.g. <!–[if age 9]>..text….<![endif]–>, there is no provision of “for” or “while” loop in HTML, same apply with switch case also.

14. Which element defines a title of the Work?
a) <abbr>
b) <cite>
c) <address>
d) <blockquote>
View Answer

Answer: b
Explanation: For using, abbreviation or acronym <abbr> element is helpful. The contact details for author of a page is specified by <address> attribute. A section which is quoted from another source is specified by <blockquote>. The tittle of a Work is defined by <cite> elements, usually it displays in italics.

<p><cite>Hamlet</cite> by William Shakespeare</p>

Output: Hamlet by William Shakespeare.

15. For smaller text which element is used?
a) <tiny>
b) <min>
c) <small>
d) <em>
View Answer

Answer: c
Explanation: min is an attribute for input method for inserting minimum value. smaller text is define by <small>element. <em> is used for emphasis usually it is display in italics.

<p>This is text in <small>small</small>.</p>

Output: This is text in small.

Sanfoundry Global Education & Learning Series – HTML.

To practice all areas of HTML, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.