1.What’s new HTML 5 DocType and Charset?

As HTML 5 is now not subset of SGML so its DocType is simplified as follows:
<!doctype html>
And HTML 5 uses UTF-8 encoding as follows:
<meta charset=”UTF-8″>

2.How can we embed Audio in HTML 5?

HTML 5 comes with a standard way of embedding audio files. Supported audio formats are MP3, Wav and Ogg.

<audio controls>
<source src=”jamshed.mp3″ type=”audio/mpeg”>
Your browser does’nt support audio embedding feature.
3.How can we embed Video in HTML 5?

Same like audio, HTML 5 defined standard way of embedding video files.Supported video formats are MP4, WebM and Ogg.

<video width=”450″ height=”340″ controls>
<source src=”jamshed.mp4″ type=”video/mp4″>
Your browser does’nt support video embedding feature.
4.What are the new media element in HTML 5 other than audio and video?

HTML 5 has strong support for media. Other than audio and video tags, it comes with the following tags:

acts as a container for external application.
<track> defines text track for media.
<source> is helpful for multiple media sources for audio and video.
5.What is the usage of canvas Element in HTML 5?

<canvas> is an element in HTML5 which we can use to draw graphics with the help of scripting (which is most probably JavaScript).
This element behaves like a container for graphics and rest of things will be done by scripting. We can draw images, graphs and a bit of animations etc using <canvas> element.

<canvas id=”canvas1″ width=”300″ height=”100″>
6.What are the different types of storage in HTML 5?

HTML 5 has the capability to store data locally. Previously it was done with the help of cookies.
Exciting thing about this storage is that its fast as well as secure.

There are two different objects which can be used to store data.

localStorage object stores data for a longer period of time even if the browser is closed.
sessionStorage object stores data for a specific session.
7.What are the new Form Elements introduced in HTML 5?

There are a number of new form elements has been introduced in HTML 5 as follows:

8.What are the deprecated Elements in HTML5 from HTML4?

Elements that are deprecated from HTML 4 to HTML 5 are:

9.What are the new APIs provided by HTML 5 standard?

HTML 5 standard comes with a number of new APIs. Few of it are as follows:

Media API
Text Track API
Application Cache API
User Interaction
Data Transfer API
Command API
Constraint Validation API
History API
and many more….
10.What is the difference between HTML 5 Application Cache and regular HTML Browser Cache?

One of the key feature of HTML 5 is “Application Cache” that enables us to make an offline version of a web application. It allows to fetch few or all of website contents such as HTML files, CSS, images, javascript etc locally. This feature speeds up the site performance. This is achieved with the help of a manifest file defined as follows:

<!doctype html>
<html manifest=”example.appcache”>
As compared with traditional browser caching, Its not compulsory for the user to visit website
contents to be cached.




I am ASP.NET MVC developer and recently when I was looking for a job lot of questions were asked connected to HTML 5 and its new features. So below are 40 important questions which would help you brush up your knowledge on HTML 5.

These questions are not silver bullet to get a job but yes they are helpful when you want to quickly brush up the topic.

Happy job hunting.

Courtesy: –

What is the relationship between SGML,HTML , XML and HTML?

SGML (Standard generalized markup language) is a standard which tells how to specify document markup. It’s only a Meta language which describes how a document markup should be. HTML is a markup language which is described using SGML.

So by SGML they created DTD which the HTML refers and needs to adhere to the same. So you will always find “DOCTYPE” attribute at the top of HTML page which defines which DTD is used for parsing purpose.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "">

Now parsing SGML was a pain so they created XML to make things better. XML uses SGML. For example in SGML you have to start and end tags but in XML you can have closing tags which close automatically (“”).

XHTML was created from XML which was used in HTML 4.0. So for example in SGML derived HTML “
” is not valid but in XHTML it’s valid. You can refer XML DTD as shown in the below code snippet.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

In short SGML is the parent of every one. Older HTML utilizes SGML and HTML 4.0 uses XHTML which derived from XML.

What is HTML 5?

HTML 5 is a new standard for HTML whose main target is to deliver everything without need to any additional plugins like flash, Silverlight etc. It has everything from animations, videos, rich GUI etc.
HTML5 is cooperation output between World Wide Web Consortium (W3C) and the Web Hypertext Application Technology Working Group (WHATWG).

In HTML 5 we do not need DTD why?

HTML 5 does not use SGML or XHTML it’s completely a new thing so you do not need to refer DTD. For HTML 5 you just need to put the below doctype code which makes the browser identify that this is a HTML 5 document.

<!DOCTYPE html>

If I do not put <! DOCTYPE html> will HTML 5 work?

No, browser will not be able to identify that it’s a HTML document and HTML 5 tags will not function properly.

Which browsers support HTML 5?

Almost all browsers i.e. Safari, Chrome, Firefox, Opera, Internet Explorer support HTML 5.

How is the page structure of HTML 5 different from HTML 4 or previous HTML?

A typical web page has headers, footers, navigation, central area and side bars. Now if we want to represent the same in HTML 4 with proper names to the HTML section we would probably use a DIV tag.
But in HTML 5 they have made it more clear by creating element names for those sections which makes your HTML more readable.

Below are more details of the HTML 5 elements which form the page structure.

  • <header>: Represents header data of HTML.
  • <footer>: Footer section of the page.
  • <nav>: Navigation elements in the page.
  • <article>: Self-contained content.
  • <section>: Used inside article to define sections or group content in to sections.

What is datalist in HTML 5?

Datalist element in HTML 5 helps to provide autocomplete feature in a textbox as shown below.

Below is the HTML code for DataList feature:-

<input list="Country">
<datalist id="Country">
<option value="India">
<option value="Italy">
<option value="Iran">
<option value="Israel">
<option value="Indonesia">

What are the different new form element types in HTML 5?

There are 10 important new form elements introduced in HTML 5:-

  1. Color.
  2. Date
  3. Datetime-local
  4. Email
  5. Time
  6. Url
  7. Range
  8. Telephone
  9. Number
  10. Search

Let’s understand these elements step by step.

If you want to show color picker dialog box.

<input type="color" name="favcolor">

If you want to show calendar dialog box.

<input type="date" name="bday">

If you want to show calendar with local time.

<input type="datetime-local" name="bdaytime">

If you want to create a HTML text with email validation we can set the type as “email”.

<input type="email" name="email">

For URL validation set the type as “url” as shown in the below HTML code.

<input type="url" name="sitename">

For URL validation set the type as “url” as shown in the below HTML code.

If you want to display textbox with number range you can set type to number.

<input type="number" name="quantity" min="1" max="5">

If you want to display a range control you can use type as range.

 <input type="range" min="0" max="10" step="2" value="6">

Want to make text box as search engine box.

<input type="search" name="googleengine">

What to only take time input.

<input type="time" name="usr_time">

If you want to make text box to accept telephone numbers.

<input type="tel" name="mytel">

What is output element in HTML 5?

Output element is needed when you need calculation from two inputs to be summarized in to a label. For instance you have two textboxes( see the below figure) and you want to add numbers from these textboxes and send them to a label.

Below goes the code of how to use output element with HTML 5.

<form onsubmit="return false"  öninput="o.value = parseInt(a.value) + parseInt(b.value)">
<input name="a" type="number"> +
<input name="b" type="number"> =
<output name="o" />

You can also replace “parseInt” with “valueAsNumber” for simplicity. You can also use “for” in the output element for more readability.

<output name="o" for="a b"></output>

What is SVG?

SVG stands for scalable vector graphics. It’s a text based graphic language which draws images using text, lines, dots etc. This makes it lightweight and renders faster.

Can we see a simple example of SVG using HTML 5?

Let’s say we want to display the below simple line using HTML 5 SVG.

Below is how the code of HTML 5. You can see the SVG tag which encloses the polygon tag for displaying the star image.

<svg id="svgelem" height="[object SVGAnimatedLength]" xmlns="">
<line style="stroke: rgb(255, 0, 0); stroke-width: 2px;" y2="[object SVGAnimatedLength]" x2="[object SVGAnimatedLength]" y1="[object SVGAnimatedLength]" x1="[object SVGAnimatedLength]">

What is canvas in HTML 5?

Canvas is an HTML area on which you can draw graphics.

So how can we draw a simple line on Canvas?

  • Define the Canvas area.
  • Get access to canvas context area.
  • Draw the graphic.

Define the canvas area

So to define canvas area you need to use the below HTML code. This defines the area on which you can draw.

<canvas id="mycanvas" width="600" height="500" style="border:1px solid #000000;"></canvas>

Get access to canvas area

To draw on the canvas area we need to first get reference of the context section. Below is the code for canvas section.

var c=document.getElementById("mycanvas");
var ctx=c.getContext("2d");

Draw the graphic

Now once you have access to the context object we can start drawing on the context. So first call the “move” method and start from a point , use line method and draw the line and then apply stroke over it.


Below is the complete code.

<body  önload="DrawMe();">
<canvas id="mycanvas" width="600" height="500" style="border:1px solid #000000;"></canvas>
function DrawMe()
var c=document.getElementById("mycanvas");
var ctx=c.getContext("2d");

You should get the below output.

What is the difference between Canvas and SVG graphics?

Note: – If you see the previous two questions both canvas and SVG can draw graphics on the browser. So in this question interviewer wants to know when will you use what.



Here’s it’s like draw and remember. In other words any shape drawn by using SVG can be remembered and manipulated and browser can render it again. Canvas is like draw and forget. Once something is drawn you cannot access that pixel and manipulate it.
SVG is good for creating graphics like CAD software’s where once something is drawn the user wants to manipulate it. Canvas is good for draw and forget scenarios like animation and games.
This is slow as it needs to remember the co-ordinates for later manipulations. This is faster as there is no intention of remembering things later.
We can have event handler associated with the drawing object. Here we cannot associate event handlers with drawing objects as we do not have reference of them.
Resolution independent. Resolution dependent.

How to draw rectangle using Canvas and SVG using HTML 5?

HTML 5 code Rectangle code using SVG.

<svg xmlns="" version="1.1">
<rect style="fill: rgb(0, 0, 255); stroke-width: 1px; stroke: rgb(0, 0, 0);" height="[object SVGAnimatedLength]" width="[object SVGAnimatedLength]">

HTML 5 Rectangle code using canvas.

var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
<svg xmlns="" version="1.1">
  <circle fill="red" stroke-width="2" stroke="black" r="[object SVGAnimatedLength]" cy="[object SVGAnimatedLength]" cx="[object SVGAnimatedLength]">

var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
var centerX = canvas.width / 2;
var centerY = canvas.height / 2;
var radius = 70;

context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);
context.fillStyle = 'green';
context.lineWidth = 5;
context.strokeStyle = '#003300';

<!DOCTYPE html>
<body  önload="DrawMe();">
<svg height="[object SVGAnimatedLength]" width="[object SVGAnimatedLength]">
<circle id="circle1" cx="[object SVGAnimatedLength]" cy="[object SVGAnimatedLength]" r="[object SVGAnimatedLength]" style="stroke: none; fill: rgb(255, 0, 0);">


 var timerFunction = setInterval(DrawMe, 20);

function DrawMe()
var circle = document.getElementById("circle1");
var x = circle.getAttribute("cx");
var newX = 2 + parseInt(x);
if(newX > 500) 
            newX = 20;
        circle.setAttribute("cx", newX);


What are selectors in CSS?

Selectors help to select an element to which you want to apply a style. For example below is a simple style called as ‘intro” which applies red color to background of a HTML element.


To apply the above “intro” style to div we can use the “class” selector as shown in the below figure.

<div class="intro">
<p>My name is Shivprasad koirala.</p>
<p>I write interview questions.</p>

How can you apply CSS style using ID value?

So let’s say you have a HTML paragraph tag with id “mytext” as shown in the below snippet.

<p id="mytext">This is HTML interview questions.</p>

You can create a style using “#” selector with the “id” name and apply the CSS value to the paragraph tag. So to apply style to “mytext” element we can use “#mytext” as shown in the below CSS code.


Quick revision of some important selectors.

Set all paragraph tags back ground color to yellow.


Sets all paragraph tags inside div tag to yellow background.

div p

Sets all paragraph tags following div tags to yellow background.


Sets all attribute with “target” to yellow background.


<a href="">ASP.NET interview questions</a>
<a href="" target="_blank">c# interview questions</a>
<a href="" target="_top">.NET interview questions with answers</a>

Set all elements to yellow background when control gets focus.


Set hyperlinks according to action on links.

a:link    {color:green;}
a:visited {color:green;}
a:hover   {color:red;}
a:active  {color:yellow;}

What is the use of column layout in CSS?

CSS column layout helps you to divide your text in to columns. For example consider the below magazine news which is one big text but we need to divide the same in to 3 columns with a border in between. That’s where HTML 5 column layout comes to help.

To implement column layout we need to specify the following:-

  • How many columns we want to divide the text in to ?

To specify number of columns we need to us column-count. “webkit” and “moz-column” are needed for chrome and firefox respectively.

-moz-column-count:3; /* Firefox */
-webkit-column-count:3; /* Safari and Chrome */
  • How much gap we want to give between those columns ?
-moz-column-gap:40px; /* Firefox */
-webkit-column-gap:40px; /* Safari and Chrome */
  • Do you want to draw a line between those columns , if yes how much thick ?
-moz-column-rule:4px outset #ff00ff; /* Firefox */
-webkit-column-rule:4px outset #ff00ff; /* Safari and Chrome */
column-rule:6px outset #ff00ff;

Below is the complete code for the same.

-moz-column-count:3; /* Firefox */
-webkit-column-count:3; /* Safari and Chrome */

-moz-column-gap:40px; /* Firefox */
-webkit-column-gap:40px; /* Safari and Chrome */

-moz-column-rule:4px outset #ff00ff; /* Firefox */
-webkit-column-rule:4px outset #ff00ff; /* Safari and Chrome */
column-rule:6px outset #ff00ff;

You can then apply the style to the text by using the class attribute.

<div class="magazine">

Your text goes here which you want to divide in to 3 columns.


Can you explain CSS box model?

CSS box model is a rectangular space around a HTML element which defines border, padding and margin.

Border: – This defines the maximum area in which the element will be contained. We can make the border visible, invisible, define height and width etc.

Padding: – This defines the spacing between border and element.

Margin: – This defines the spacing between border and any neighboring elements.

For instance below is a simple CSS code which defines a box with border , padding and margin values.

.box {
    width: 200px;
    border: 10px solid #99c;
    padding: 20px;
    margin: 50px;

Now if we apply the above CSS to a DIV tag as shown in the below code , your output would be as shown in the figure below. I have created two test “Some text” and “Some other text” so that we can see how margin property functions.

<div align="middle" class="box">
Some text

Some other text

Can you explain some text effects in CSS 3?

Here the interviewer is expecting you to answer one of two text effects by CSS.Below are two effects which are worth noting.

Shadow text effect

text-shadow: 5px 5px 5px #FF0000;

Word wrap effect


What are web workers and why do we need them ?

Consider the below heavy for loop code which runs above million times.

function  SomeHeavyFunction()
for (i = 0; i < 10000000000000; i++)
x = i + x;

Let’s say the above for loop code is executed on a HTML button click. Now this method execution is synchronous. In other words the complete browser will wait until the for loop completes.

<input type="button" onclick="SomeHeavyFunction();" />

This can further lead to browser getting freezed and unresponsive with an error message as shown in the screen below.

So if we can move this heavy for loop in a JavaScript file and run it asynchronously that means the browser does need to wait for the loop then we can have a more responsive browser. That’s what web worker are for.

Web worker helps to execute JavaScript file asynchronously.

What are the restrictions of Web Worker thread?

Web worker threads cannot modify HTML elements, global variables and some window properties like Window.Location. You are free to use javascript data types, XMLHttpRequest calls etc.

So how do we create a worker thread in JavaScript?

To create a worker thread we need to pass the JavaScript file name and create the worker object.

var worker = new Worker("MyHeavyProcess.js");

To send message to the worker object we need to use “PostMessage” , below is the code for the same.


When the worker thread sends data we get it in the “OnMessage” event on the callers end.

worker.onmessage = function (e) 
document.getElementById("txt1").value =;

The heavy loop is in the “MyHeavyProcess.js” javascriptfile , below is the code for the same. When the JavaScript file wants to send message he uses “postmessage” and any message sent from the caller is received in the “onmessage” event.

var x =0
self.onmessage = function (e) {
    for (i = 0; i < 1000000000; i++)

        x = i + x;



How to terminate a web worker?


Why do we need HTML 5 server-sent events?

One of the common requirements in web world is getting updates from the server. Take example of a stock ticker application where the browser has to take regular updates from the server for the recent stock value.

Now to implement this kind of requirement developers normally write some kind of PULL code which goes to the server and fetches data in certain interval. Now PULL solution is good but it makes the network chatty with lot of calls and also it adds load on the server.

So rather than PULL it would be great if we can have some kind of PUSH solution. In simple words when the server has updates it will send updates to the browser client. That can be achieved by using “SERVER SENT EVENTS”.

So the first thing the browser needs to do is connect to the server source which will send updates. Let’s say we have page “stock.aspx” which sends stock updates. So to connect to the page we need to use attach to the event source object as shown in the below code.

   var source = new EventSource("stock.aspx");

We also need to attach the function where we will receive messages when server sends update. For than we need to attach function to the “onmessage” event as shown in the below code.

        source.onmessage = function (event) {
            document.getElementById("result").innerHTML += + "<br>";

Now from the server side we need to send events. Below are some lists of important events with command that needs to be sent from the server side.

Event Command
Send data to the client. data : hello
Tell client to retry in 10 seconds retry : 10000
Raise a specific event with data event : successdata : You are logged in.

So for example if we want to send data below is the ASP.NET code for the same. Please note the content type is set to text/event.

Response.Write("data: " + DateTime.Now.ToString());

To retry after 10 second below is the command.

Response.Write("retry: 10000");

If you want to attach an event we need to use the “addEventListener” event as shown in the below code.

source.addEventListener('message', function(e) {
}, false);

From the server side the below message will trigger the “message” function of javascript.

event: message
data : hello

What is local storage concept in HTML 5?

Many times we would like to store information about the user locally in the computer. For example let’s say user has half-filled a long form and suddenly the internet connection breaks off. So the user would like you to store this information locally and when the internet comes back.He would like to get that information and send it to the server for storage.

Modern browsers have storage called as “Local storage” in which you can store this information.

How can we add and remove data from local storage?

Data is added to local storage using “key” and “value”. Below sample code shows country data “India” added with key value “Key001”.


To retrieve data from local storage we need to use “getItem” providing the key name.

var country = localStorage.getItem(“Key001”);

You can also store JavaScript object’s in the local storage using the below code.

var country = {}; = “India”;
country.code = “I001”;
localStorage.setItem(“I001”, country);
var country1 = localStorage.getItem(“I001”);

If you want to store in JSON format you can use “JSON.stringify” function as shown in the below code.


What is the lifetime of local storage?

Local storage does not have a life time it will stay until either the user clear it from the browser or you remove it using JavaScript code.

What is the difference between local storage and cookies?

Cookies Local storage
Client side / Server side. Data accessible both at client side and server side. Cookie data is sent to the server side with every request. Data is accessible only at the local browser side. Server cannot access local storage until deliberately sent to the server via POST or GET.
Size 4095 bytes per cookie. 5 MB per domain.
Expiration Cookies have expiration attached to it. So after that expiration the cookie and the cookie data get’s deleted. There is no expiration data. Either the end user needs to delete it from the browser or programmatically using JavaScript we need to remove the same.

What is session storage and how can you create one?

Session storage is same like local storage but the data is valid for a session. In simple words the data is deleted as soon as you close the browser.

To create a session storage you need to use “sessionStorage.variablename” . In the below code we have a created a variable called as “clickcount”.

If you refresh the browser the count increases. But if you close the browser and start again the “clickcount” variable starts from zero.

sessionStorage.clickcount = 0;

What is difference between session storage and local storage?

Local storage data persists forever but session storage is valid until the browser is open, as soon as the browser closes the session variable resets.

What is WebSQL?

WebSQL is a structured relational database at the client browser side. It’s a local RDBMS inside the browser on which you can fire SQL queries.

Is WebSQL a part of HTML 5 specification?

No, many people label it as HTML 5 but it’s not part of HTML 5 specification. The specification is based around SQLite.

So how can we use WebSQL?

The first step we need to do is open the database by using “OpenDatabase” function as shown below. The first argument is the name of the database, the next is the version, then a simple textual title and finally the size of the database.

var db=openDatabase('dbCustomer','1.0','Customer app’, 2 * 1024 * 1024); 

To execute SQL we then need to use “transaction” function and call “executeSql” function to fire SQL.

db.transaction(function (tx) 
tx.executeSql('CREATE TABLE IF NOT EXISTS tblCust(id unique, customername)');
tx.executeSql('INSERT INTO tblcust (id, customername) VALUES(1, "shiv")');
tx.executeSql('INSERT INTO tblcust (id, customername) VALUES (2, "raju")');

In case you are firing “select” query you will get data is “results” collection which we can loop and display in the HTML UI.

db.transaction(function (tx) 
  tx.executeSql('SELECT * FROM tblcust', [], function (tx, results) {
   for (i = 0; i < len; i++)
     msg = "<p><b>" + results.rows.item(i).log + "</b></p>";
     document.querySelector('#customer).innerHTML +=  msg;
 }, null);

What is application cache in HTML5?

One of the most demanded things by end user is offline browsing. In other words if internet connection is not available page should come from browser cache i.e. offline and application cache helps you to achieve the same.

Application cache helps you to specify which files should be cached and not cached.

So how do we implement application cache in HTML 5?

The first thing in we need to specify is the “manifest” file. “manifest” file helps you to define how your caching should work. Below is the structure of the manifest file :-

# version 1.0
  • All manifest file starts with CACHE MANIFEST statement.
  • #( hash tag) helps to provide the version of the cache file.
  • CACHE command specifies which files needs to be cached.
  • The content type of the manifest file should be “text/cache-manifest”.

Below is how cache manifest has been provided using ASP.NET C#.

Response.ContentType = "text/cache-manifest";
Response.Write("CACHE MANIFEST \n");
Response.Write("# 2012-02-21 v1.0.0 \n");
Response.Write("CACHE : \n");
Response.Write("Login.aspx \n");

One the cache manifest file is created the next thing is to provide the link of the manifest file in the HTML page as shown below.

<html manifest="cache.aspx">

When the above file runs first time it gets added in the browser application cache and in case server goes down the page is served from the application cache.

So how do we refresh the application cache of the browser?

Application cache is removed by changing version number to a new version number as specified in the “#” tag in the below code.

# version 2.0(new)

What is fallback in Application cache?

Fallback in application cache helps you to specify the file which will displayed if the server is not reachable. For instance in the below manifest file we are saying if someone hits “/home” and if the server is not reachable then “homeoffline.html” file should be served.

/home/ /homeoffline.html

What is network in application cache?

Network command says files which should not be cached. For example in the below code we are saying that “home.aspx” should never be cached and or available offline.


Below is a webinar on HTML 5 which i had recently taken on In this webinar i have walked through 5 important features of HTML 5.




Interview questions – Web UI/UX

1) Explain about HTML5 local storage ?

There are two ways to store data in HTML as objects locally :

  1. localStorage – store data  across session acess
  2. sessionStorage – storing data for current session only

Data will be stored in key/value pair format.



sessionStorage.companyname = “SHARAG INFOTECH”;

2)  explain CSS media queries ?

CSS media queries are used to develop responsive templates for different layout of screen, print, mobile , tablet or any other resolutions

CSS media queries can be added in 3 ways as like CSS style sheet :

  1. Internal stylesheet :  <style type=”text/css”>
    @media only screen and (max-width: 600px){
    /* rules apply to the device resolution is 480px or less  */
  2. Imported stylesheet :   @import “tablet.css”   (min-width: 800px) and (max-width: 1200px);
  3. External stylesheet:  <link rel=”stylesheet” type=”text/css” href=”deskto.css” media=”screen and (min-width: 1200px), print and (min-resolution: 300dpi)” />

3) explain css inheritance ?

Inheritance propagates property values from parent elements to their children. The inherited value of a property on an element is the computed value of the property on the element’s parent element. For the root element, which has no parent element, the inherited value is the initial value of the property.

A property can also be explicitly inherited by using the inherit keyword in property.

CSS inheritance example:
class inheritance for an HTML tag :
<div class=”firstClass secondClass thirdClass fourthClass ” > </div >
CSS property inheritance from parent :
p {
color: #000;
p a:link {
color: inherit;

and using LESS method for inheritance example:
//through variable
@color: #123456;
#emp {
color: @color;
div {
color: @color;

//through class name calling [MIXINS]

.rounded-corners (@radius: 2px) {
-webkit-border-radius: @radius;
-moz-border-radius: @radius;
-ms-border-radius: @radius;
-o-border-radius: @radius;
border-radius: @radius;

#navtable {

#maintable {

4) what is javascript inheritance ?

In simple terms, inheritance is the concept of one thing gaining the properties or behaviours of something else.
Inherited children inherit their parent’s behaviour To say A inherits from B, is saying that A is a type of B.
In JavaScript You must use a special object called prototype.
function Animal() {}; // This is the Animal *Type* = function () {
alert(“All animals can eat!”);

function Bird() {}; // Declaring a Bird *Type*
Bird.prototype = new Animal(); // Birds inherit from Animal = function() {
alert(“Birds are special, they can fly!”);

The effect of this is that any Birds you create (called an instance of Bird) all have the properties of Animals
var aBird = new Bird(); // Create an instance of the Bird Type; // It should alert, so the inheritance worked; // Important part of inheritance, Bird is also different to Animal

var anAnimal = new Animal(); // Let’s check an instance of Animal now; // Alerts, no problem here; // Error will occur, since only Birds have fly() in its prototype

5) explain javascript associative array ?

Associative arrays are where we can associate a key string with a value string
JavaScript objects are also associative arrays.
i.e the property  emp.Name can also be read by calling emp[‘Name’]
We can access each property by entering the name of the property as a string into the array
it refers to accessing the DOM elements of HTML also [as object or associative array]
6) explain JS Namespace ?

Namespacing is a technique employed to avoid collisions with other objects or variables in the global namespace
and also helps to organize blocks of functionality into easily manageable groups that can be uniquely identified.

JavaScript doesn’t  builtin support of namespacing but using objects and closures we can achieve a similar effect.
javascript Namespacing patterns :
1)    Single global variables :
var myApplication =  (function(){

2)    Object literal notation :

var myApplication = {
getInfo:function(){ /**/ },
// we can also populate our object literal to support
// further object literal namespaces containing anything
// really:
models : {},
views : {
pages : {}
collections : {}

3)    Nested namespacing :

var myApp =  myApp || {};
// perform a similar existence check when defining nested
// children
myApp.routers = myApp.routers || {};
myApp.model = myApp.model || {};
myApp.model.special = myApp.model.special || {};
// nested namespaces can be as complex as required

4)    Immediately-invoked Function Expressions :

// an (anonymous) immediately-invoked function expression
(function(){ /*…*/})();
// a named immediately-invoked function expression
(function foobar(){ /*..*/}());
// this is technically a self-executing function which is quite different
function foobar(){ foobar(); }
5)   Namespace injection :

// define a namespace we can use later
var ns = ns || {}, ns2 = ns2 || {};
// the module/namespace creator
var creator = function(val){
var val = val || 0; = function(){
return val++

this.reset = function(){
val = 0;

//, ns.reset now exist, 5000);
// ns2 contains the same methods
// but has an overridden value for val
// of 5000
for more details on namespace read
7) explain Jquery live and bind methods ?
.bind() attacheds events to elements that exist or match the selector at the time the call is made.
Any elements created afterwards or that match going forward because the class was changed, will not fire the bound event.

$(‘img’).bind(‘click’, function(){…});

.live() works for existing and future matching elements.
Before jQuery 1.4 this was limited to the following events:
click, dblclick mousedown, mouseup, mousemove, mouseover, mouseout, keydown, keypress, keyup
$(‘img’).live(‘click’, function(){…});

8) what is bootstrap ?

Bootstrap is an open-source Javascript framework developed by the team at Twitter.
It is a combination of HTML, CSS, and Javascript code designed to help build user interface components.
Bootstrap is Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
Bootstrap was also programmed to support both HTML5 and CSS3
Bootstrap is a CSS and Javascript framework that is used within your HTML. Bootstrap provides more advanced functionality to your web site.
More details
9) type of webservice ?

there are two types of web service….1. SOAP [Simple Object Access Protocol] Webservice and 2. RESTful [REpresentational State Transfer] Webservice.
SOAP is a messaging protocol , REST is a design philosophy , not a protocol.

you define your interface in a .wsdl file, which describes exactly which input parameters are expected and how the return values will look like
there are tools to generate the .wsdl files out of java class hirarchies. JAXB for example
there are also tools to generate java objects/classes as part of eclipse for example (don’t know the name in the moment).
SOAP is very strict. Every request is validatet against the wsdl before processing.

A good but not so easy to start with framework for SOAP WS is Apache CXF

REST (no hands on experience up to now, feel free to correct and improve 😉 ):

a way to access a webserver or web application to retrieve data from or send to it.
it’s only negotiated, how it is accessed.
common is something like this to retrieve object of type type with id=123
very intuitive, but no automatic validation of requests.

The main advantages of REST web services are:

Lightweight – not a lot of extra xml markup
Human Readable Results
Easy to build – no toolkits required

SOAP also has some advantages:

Easy to consume – sometimes
Rigid – type checking, adheres to a contract
Development tools