HTML 5 Interview Questions and Answers (188) - Page 1

What is the full form of URI, URL, URN?

URI - Uniform Resource Identifier
URL - Uniform Resource Locator
URN - Uniform Resource Name
Whys Html used extensively for creating websites

NOTE: This is objective type question, Please click question title for correct answer.
Difference between GET and POST Metods

Difference Between GET and POST methods

GET:
1) Data is appended to the URL.
2) Data is not secret.
3) It is a single call system
4) Maximum data that can be sent is 256.
5) Data transmission is faster
6) This is the default method for many browsers

POST:
1) Data is appended to the URL.
2) Data is Secret
3) It is a two call system.
4) There is no Limit on the amount of data.That is characters any amount of data can be sent.
5) Data transmission is comparatively slow.
6) No default and should be Explicitly specified.
Why to specify the alt value in the img tag?

alt stands for alternate this means that for some reason if image can't be loaded on the page, the alt value will be displayed.

<img src="myimage.jpg" alt="this is my photo" title="click to go to my page" />


In the above code snippet when myimage.jpg is available on the web server, the image will be displayed and mouse ever on the image will show "click to go to my page" but in case myimage.jpg is not available on the server or by some reason it could't be rendered on the page, alt value (this is my photo) will be displayed in place of image. This hints the user that the picture that couldn't be loaded was my photo.
How to add javascript file reference in the web page?

We can use <script> tag to refer the .js file available on the server, we can not only refer only those file that are on our server but we cal also any .js file that is available on other server (on other domain.

<script src="/include/myjscode.js" type="text/javascript"></script> 


It is always suggested to place the script tag inside <head></head>
How to display the web page icon in the browser?

By placing the link tag inside the <head></head and specify rel value as "shortcut icon", you can display the page icon in the browser.

<link rel="shortcut icon" href="/images/myicon.gif" />


Here, you can either specify .gif, .jpg or .ico file, however many browser only support .ico file not .gif or .jpg file.
How to refer the .css file in the web page?

To refer .css file in the web page, use <link> tag. Generally it is suggested to keep this inside the <head></head> tag.

<link href="/css/mystyle.css" type="text/css" rel="stylesheet" />


Notice that the type attribute value should be "text/css" and rel attribute value should be "stylesheet".
How to write bulleted point in HTML?

To write bulleted point, use <li> under <ul> like following.

    <ul> 

<li>Point 1</li>
<li>Point 2</li>
<li>Point 3</li>
</ul>

In this case Point 1, Point 2 and Point 3 will appear as bulleted point.
How to display numbered list in HTML?

To display numbered list, use <li> under <ol> tag like below

 <ol>

<li>Point 1</li>
<li>Point 2</li>
</ol>

How to create a DropDown list box?

To create a dropdown list box in HTML, write following code

  <select name="drop1" id="drop1"> 

<option value="1">item 1</option>
<option value="2">item 2</option>
<option value="0">All</option>
</select>


This will create a dropdown with two list item "item 1" and "item 2".
How to create a ListBox in HTML?

To create a list box, write following code

<select name="drop1" id="Select1" size="4" multiple="multiple">

<option value="1">item 1</option>
<option value="2">item 2</option>
<option value="3">item 3</option>
<option value="4">item 4</option>
<option value="0">All</option>
</select>


This will create a listbox with 5 items. As multiple attribute value is specified as ="multiple" so it gives ability to select more than one item from the box by holding ctrl key or by dragging through items from the mouse.
Should we use table tag to design the layout of the webpage?

No, <table> tag is made for rendering the data in tabular format not to design the layout of the webpage, however this is massively used for the designer because its easy to use.

To design the layout we should use <div> and/or <span> along with css classes.
What is the code to write bulleted and numbered list in HTML.

To write bulleted list in the HTML, write following code:

<ul>

<li>fdasfadsf asdf</li>
<li>sfdafasdf</li>
<li>fdsafasfsa</li>
<li>fdsafsda</li>
</ul>


To write numbered list in the HTML, write following code:
<ol>

<li>fdasfadsf asdf</li>
<li>sfdafasdf</li>
<li>fdsafasfsa</li>
<li>fdsafsda</li>
</ol>


Notice the difference is only <ul> and <ol>. In the bulleted list, we need to use <ul> tag and in the numbered list we need to use <ol> tag.
What is <!DOCTYPE> defines in HTML?

Doctype defines as "document type declaration" (DTD).

All HTML pages should contain a <!DOCTYPE> declaration to define which HTML version we are using in our page. it gives important instruction to web browser about page's HTML version type. It also allows web validator to check the syntax of page.
How FontSize and Font Size is differ in HTML?

font size is an attribute that we used in font tag.
Ex : <font size="5"> use in font tag.

Where as font-size is an style property used for controls.
Ex : Font-Size="Small" use for style property For Controls.
What is the user of alt property in <img> tag?

The use of "alt" property of <img> tag is to display the alt value in case browser is unable to load the image so that the end user can understand what kind of image was actually there on the page that couldn't be loaded.
What is the use of title property of <img> tag?

The title property of <img> tag is used to describe about the image. The value of title property is displayed when the end user mouse over the image.
What should be the href property value of anchor tag in case we want to handle the click event

The href property of anchor tag should be "javascript:void(0)" when we want to handle the click event of the anchor tag. Many people keep href="#" that jump the screen to top when the link is clicked.

<a id="closeLink"  href="javascript:void(0)" onclick="Clicked()" title="Whatever">Whatever link</a>

In other way we can also write like this
<a id="closeLink"  href="javascript:Clicked()" title="Whatever">Whatever link</a>

Found this useful, bookmark this page to the blog or social networking websites. Page copy protected against web site content infringement by Copyscape

 Interview Questions and Answers Categories