HTML Questions & Answers – Traditional HTML and XHTML

This set of HTML Multiple Choice Questions & Answers (MCQs) focuses on “Traditional HTML and XHTML”.

1. State whether the given statement is true or false. !DOCTYPE is case sensitive”.
a) True
b) False
View Answer

Answer: b
Explanation: XML is a case sensitive while HTML is case insensitive. So the declaration “!DOCOTYPE” is case sensitive in XML and it is not case sensitive in HTML, we can write the “!DOCTYPE” declaration in both lowercase and uppercase, thus both are valid.

2. Choose the correct statement.
a) In traditional XHTML close tag for some elements is optional but not encouraged
b) In traditional HTML close tag for some elements is optional but not encouraged
c) In both traditional XHTML and HTML close tag for some elements is not optional
d) In both traditional XHTML and HTML close tag for some elements is optional
View Answer

Answer: b
Explanation: In XHTML all elements must always be closed and empty elements also be closed. XHTML close tags are not optional neither they are encouraged. HTML is case insensitive and thus closing tags for some elements including empty elements is optional and is ignored by browsers.

3. Which of the following XHTML doctype declaration contains all HTML elements and attributes, including presentational and deprecated elements (like font) but not framesets?
a) !DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”
b) !DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”
c) !DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Frameset//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd”
d) <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN” “http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>
View Answer

Answer: b
Explanation: The !DOCTYPE declaration is not an HTML tag; it is an instruction to the web browser about what version of HTML the page is written in. The XHTML doctype declaration “!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”” is of XHTML 1.0 strict, “!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”” is of XHTML 1.0 transitional, “!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Frameset//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd”” is of XHTML 1.0 frameset and “<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN” “http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>” is of XHTML 1.1.
advertisement
advertisement

4. Which of the following is not a difference between HTML and XHTML?
a) Charset in html is “text/html” where as in xhtml it is “application/xml+xhtml”
b) Charset in both html and xhtml is “text/html”
c) Tags and attributes are case-insensitive in HTML but not in XHTML
d) Special characters must be escaped using character entities in XHTML unlike HTML
View Answer

Answer: b
Explanation: HTML is case insensitive while XHTML is case sensitive. In XHTML, special characters can be escaped using character entites but not in HTML. Charset in HTML is “text/html” where as it is “application/xml+xhtml” for XHTML.

5. What indicates the content in file is HTML when delivered on the network.
a) The extension of the file “.html”
b) The “content-type” header
c) Both “.html” extension and “content-type” header
d) The “content_type” header
View Answer

Answer: b
Explanation: Content-type: header indicates the content in the file is HTML and we can see file content through it when delivered on the network. “.html” is the file extension for HTML.
Note: Join free Sanfoundry classes at Telegram or Youtube

6. State whether the given statement is true or false. “We can intermix XHTML and HTML 4.01 documents”
a) True
b) False
View Answer

Answer: b
Explanation: HTML is not in XML format. You have to make the changes necessary to make the document proper XML before you can get it accepted as XML.

7. HTML and XHTML stands for ______
a) Hyper Text Markup Language and Extensible HyperText Markup Language
b) Hyper Text Markup Language and Extensible HyperText Marking Language
c) Hyper Text Marking Language and EXtensible HyperText Marking Language
d) Hyper Text Marking Language and Extensible HyperText Markup Language
View Answer

Answer: a
Explanation: HTML stands for “Hyper Text Markup Language” and XHTML stand for “Extensible HyperText Markup Language”.
advertisement

8. Choose the correct tag for the largest heading in HTML.
a) h6
b) heading
c) h1
d) head
View Answer

Answer: c
Explanation: Headings in HTML starts from <h1> to <h6> in which <h1> heading is the largest one and <h6> is smallest one among those. The heading tags are <h1> <h2> <h3> <h4> <h5> and <h6> that are used for the creations of headings.

9. Which of the following are table tags?
a) table, thead, tr, td
b) colspan, table, tr
c) table, tt, tr, td
d) thead, colspan, td, tr
View Answer

Answer: a
Explanation: Table has different tags such as table, thead, tr, td, etc whereas colospan is an attribute of table.
advertisement

10. Choose the correct HTML for width attribute and its value.
a) width=80
b) width=”80″
c) WIDTH=”80″
d) WIDTH=80
View Answer

Answer: b
Explanation: Always mention the attribute value in quotes in HTML. It is one of the rule of HTML attributes.

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.