This set of HTML Interview Questions and Answers for freshers focuses on “Major Themes of (X)HTML”.
1. Which tag is used if you want to highlight something that is important to the reader?
a) <b> b) <strong> c) <em> d) <i>
Explanation: : The <b> tag is used to make the text bold. The <strong> tag is used to highlight the importance of text. The <em> tag is emphasis tag and is displayed in italic by browser. <i> tag is used to write text in italic font.
2. Which tag is not used if you want to indicate the importance of the phrase?
a) <i> b) <h1> c) <em> d) <strong>
Explanation: Tags like <h1> (including all headings from h1 to h6), <em> and <strong> can be used to indicate the importance of the phrase. The <i> is none other than a type of font displaced in italic bond by the browsers.
3. Which of the following statement is not true?
a) XHTML DOCTYPE is mandatory b) The xmlns attribute in <html> is mandatory c) <html>, <head>, <title>, and <body> are mandatory d) None of the mentioned
Explanation: XHTML is a markup language. There are certain terms and conditions (rules and regulations) for it. There are as: 1) In XHTML, the DOCTYPE is compulsory, 2) Xmlns attribute in <html> in manndatory, 3) The basic building blocks of markup i.e. <html>, <head>, <title>, and <body> are must in one. 4) Last but not least, XHTML is case sensitive where as HTML is case in-sensitive.
4. According to the rules of XML and XHTML, all elements must be closed either with an end tag or by self-closing with space, slash, and a right-pointing angle bracket.
Explanation: XML and XHTML are markup languages used for creating web pages. XHTML is case sensitive, and thus they must be closed either an end tag or by self-closing with a space, slash, and a right pointing angle bracket. Ex) <p></p> is paragraph tag closed with ending tag. <br/> is break tag whose closing is done either by a slash or right pointing angle bracket.
5. __________ is the XML equivalent to strict HTML 4.01.
a) XHTML 1.0 Strict
b) XHTML 1.0 Frameset
c) XHTML 1.0 Transitional
d) XHTML 1.1 Strict
Explanation: XML is a markup language while XHTML is a extensible hypertext markup language. XHTML 1.0 Strict is the XML equivalent to strict HTML 4.01, and includes elements and attributes that have not been marked deprecated in the HTML 4.01 specification.
6. Which of the following statement is true?
a) Attribute names must be in uppercase
b) Attribute values must be quoted
c) Attribute minimization is mandatory
d) Attribute values should not be quoted
Explanation: HTML is hypertext markup language. There are many rules and regulations in HTML for attribute specification. HTML is case in-sensitive and thus we can write attribute name in either uppercase or lowercase, none of it is going to make difference. There is nothing like that atrribute name should be minimized, we can write attribute name as long as and as short as we want. The only rule for attribute name is that it should be in quoted form.
7. The root element of an XHTML document must be html, and must contain an __________ attribute to associate it with the XHTML namespace.
Explanation: The xmlns attribute specifies the xml namespace for a document. It is manadatory in XHTML while in HTML5 it is optional. The root element of an XHTML document must be html, and must contain an xmlns atrribute to associate it with the XHTML namespace.
8. Which of the following encoding an XML parser assumes?
d) Both UTF-8 and UTF-32
Explanation: Basically parsers are used in softwares and they convert user data into machine data in short in memory form to use. In XML, parser is used to read XML. If an XML document lacks encoding specification, an XML parser assumes that the encoding is UTF-8 or UTF-16.
9. __________ is an extended version of the XHTML markup language for supporting RDF through a collection of attributes and processing rules in the form of well-formed XML documents.
a) XHTML + RDFa
d) XHTML + RDF
Explanation: XHTML+RDFa (Extensible Hypertext Markup Language + Resource Description Framework in attributes) is an extended version of the XHTML markup language for supporting RDF through a collection of attributes and processing rules in the form of well-formed XML documents.
10. XML is a markup language where documents must be marked up correctly.
Explanation: XML is markup language while XHTML is extensible hypertext version of markup language. XHTML is HTML defined as an XML application. XHTML is stricter than HTML.
Sanfoundry Global Education & Learning Series – HTML.
To practice all areas of HTML for Interviews, here is complete set of 1000+ Multiple Choice Questions and Answers.