HTML Interview Questions Part 4

19. What is the use of <dl> tag in HTML?


The <dl> is a definition list tag used in HTML.

This tag is used with <dt> (defines terms/names) and <dd> (describes each term/name). The <dt> tag lists the item while <dd> describes it.

The <dl> tag defines a description list.


  <dd>HyperText Markup Language</dd>
  <dd>Cascading Style Sheets</dd>

dl tag

20. What is the differece between HTML and XHTML?


HTML is application of Standard Generalized Markup Language(SGML) whereas XHTML is application of Extensible Markup Language(XML).

HTML is a static web page whereas XHTML is dynamic web page.

XHTML is strict when compared to HTML and does not allow user to do any mistake in coding and structure.

HTML is about displaying information whereas XHTML is about describing the information.

21. Does HTML support Javascript?


Yes, HTML supports JavaScript. We can use JavaScript anywhere in the HTML Coding. There are four sections where we can add JavaScript in HTML:

1. Head Section : We can add JavaScript in Head section of HTML.
<head>…..Javascript…. </head>

2. Body Section : <body>….. Javascript…</body>

3. Head and Body both : We can add Javascript in both head and body section.
<body….Javascript…</body> and <head>…..Javascript…. </head>

4. External File : The <script> tag is used to include an external file. This tag is included in <head> ….. </head> section.

22. What do you know about GET and POST method in HTML?


GET Method
  • GET method data is encoded into a URL by the browser.
  • The data is visible in the URL which allows it to be bookmarked and stored in web history.
  • This method requests data from a specified resource.
  • In GET method, the data is restricted to ASCII codes. Because URL lengths are limited there can be limitations on how much form data can be sent.
  • GET requests should never be used when dealing with sensitive data because the requests remain in the browser history and the requests can be cached.
POST Method
  • In POST method, all the name value pairs are submitted in the message body of the HTTP request which has no restrictions on the length of the string.
  • The data is not visible in the web browser bar.
  • This method submits data to be processed to a specified resource.
  • POST requests are never cached and the requests do not remain in the browser history and cannot be bookmarked.

23. What is the importance of HTML <!DOCTYPE>?


The doctype declaration is the first thing in an HTML document, before the <html> tag.

This is not an HTML tag; The <!DOCTYPE> is an instruction to the web browser about what version of the markup language the page is written in.

The doctype declaration refers to a Document Type Definition (DTD). The DTD specifies the rules for the markup language, so that the browsers can render the content correctly.

24.  How to use JavaScript along with HTML?


JavaScript can be used along with HTML by including <script> tag in the HTML <body> tag.


            alert('Hello, World!')