HTML Interview Questions Answers by tallboy20045

VIEWS: 224 PAGES: 5

									1 What is the full form of URI, URL, URN?
URI ­ Uniform Resource Identifier
URL ­ Uniform Resource Locator
URN ­ Uniform Resource Name

2 Write code for a html table that will have one row and one column?

<table>
         <tr>
                  <td>
               </td>
        </tr>
</table>


3 Whys Html used extensively for creating websites
   1.   It is easy to learn
   2.   It is markup language
   3.   Web designing is easy with HTMl
   4.   No other Option

Correct Ans : 3

4 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.

5 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.

6 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>

7 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.

8 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".

9 How to write bulleted point in HTML?
To write bulleted point, use <li> under <ul> like following.




                                                                                                                                                                    Page 1 of 5
       <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.

10 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>


11 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".

12 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.

13 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.

14 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>




                                                                                                                                                                  Page 2 of 5
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.

15 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.

16 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.

17 How to forbid autocomplete for a form ? 
use autocomplete="off"

18 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.

19 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.

20 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>


21 What is the tag for moving text Up to down or left ot right or vise versa ? 
Use the tag : <marquee> for this !!

22 What is the marquee property for text to move from bottom to upside 
apply : direction="up" property to move from bottom to upside !!

23 How do u manage the speed of <marquee> ?? 
with the use of : scrollamount peoperty !!
low means less and high means more speed !!

24 Which property will you use to restrict browser not to show the previous used values in the Textbox 
AutoComplete

25 What's the AutoComplete property's value to Restrict the previous values used not to appear in the textbox in browser ? 
AutoComplete = "off"

26 How can you restrict all the textbox's autocomplete to off in a form ? 
Set AutoComplete = "off" of the form.

27 What is the use of page­break­after? 
To Break (start new page) the page after the element. this is basically used while printing a form etc.
syntax:
<div style="page­break­after:always;">Lakhan Pal Garg </div>
<div>My Blog name is : http://lakhangarg.blogspot.com </div>
Out put will be as :
Lakhan Pal Garg (First Page)
My Blog name is : http://lakhangarg.blogspot.com (Second Page)

28 What is the use of page­break­before 
To Break (start new page) the page before the element. this is basically used while printing a form etc.
syntax:
<div>Lakhan Pal Garg </div>
<div style="page­break­before:always;">My Blog name is : http://lakhangarg.blogspot.com </div>
Out put will be as :
Lakhan Pal Garg (First Page)
My Blog name is : http://lakhangarg.blogspot.com (Second Page)

29 what to do when my Flash Object or Flash Embed is coming over the other controls like drop down menus. 
To avoid hiding the Menus by the Flash objects we can use WMODE property with EMBED Tag.
We need to Setwmode=transparent
For that we also need to at WMODE parameter with Object Tag.
Below is one Sample Example :
In Object Tag, we need to write
param name="wmode" value="transparent"
and with Embed Tag, we need to write wmode="transparent"
We can also use :
<param name="wmode" value="opaque" /> with object parameters.
You can Check this link as Reference :
http://kb2.adobe.com/cps/142/tn_14201.html




                                                                                                                                                            Page 3 of 5
Modified By :
Moderator3

30 What are differences between HTML and DHTML? 
HTML
1. It is referred as a static HTML and static in nature.
2.A plain page without any styles and Scripts called as HTML.
3.HTML sites will be slow upon client­side technologies.


DHTML
1.It is referred as a dynamic HTML and dynamic in nature.
2.A page with HTML, CSS, DOM and Scripts called as DHTML.
3.DHTML sites will be fast enough upon client­side technologies.

31 A URL specifies which of the following functionalities ? (a) protocol used (d) domain name of server hosting web page (c) name of folder with required information
(b) name of document formatted using HTML (e) the name of ISP 
   1.   Only a 
   2.   Both a & b & c 
   3.   Both d & e 
   4.   ALL OF THE ABOVE 

Correct Ans : 4 Since a request to be transmitted from client page to server system , the URL needs all the above mentioned properties . 

32 Among all the services which are provided by World Wide Web which of the following comes under that ? (a)Encryption (b)HTTP (c)HTML (d)Firewalls 
   1.   Only a & b 
   2.   Only b & c 
   3.   Only c & d 
   4.   Only d & a 

Correct Ans : 2 Encryption and Firewalls comes under Interner Secturity aspect where as HTML and HTTP are the services provided by WWW. 

33 What is the difference between <% %>, <%= %>, <%# %>? 
• The codes written in <% %> can be treated as server side code in script languages.
• The code written in <%= %> is used for accessing any server side variable into the HTML (in .aspx) page.
• The code written in <%# %> is for the binding control like repeater, gridview etc. Basically this is used to bind the particular column with the database value when the 
Autogenerate column of the binding control is false.

34 Can we have two body tags on a .html page? 
Yes, we can have 2 body tags on a .html page
example:

<html>
<body bgColor="lightblue">
<h1>First</h1>
</body>
<body bgColor="lightgreen">
<h1>second</h1>
</body>
</html>




//output: the backcolor of the body will be lightblue,
//but the headers of both the body tags will be visible in the output.

35 what are the different types of storage in HTML 5? 
HTML5 offers two new objects for storing data on the client:
LocalStorage ­ stores data with no time limit


<script type="text/javascript">
localStorage.lastname="Smith";
document.write(localStorage.lastname);
</script>



SessionStorage ­ stores data for one session.The data is deleted when the user closes the browser window.


<script type="text/javascript">
sessionStorage.lastname="Smith";
document.write(sessionStorage.lastname);
</script>



details on W3schools : http://www.w3schools.com/html5/default.asp




                                                                                                                                                             Page 4 of 5
36 Difference between XML and HTML. 
­Both XML and HTML are based on SGML – Standard Generalized Markup Language
Different goals
­ XML was designed to describe data and to focus on what data is
­ HTML was designed to display data and to focus on how data looks
­ XML fundamentally separates content (data and language) from presentation; HTML specifies the presentation
­ HTML explicitly defines a set of legal tags as well as grammar (intended meaning)
<Table>….</Table>
­ XML allows any tags or grammar to be used hence eXtensible
<Book>….</Book>




                                                                                                               Page 5 of 5

								
To top