Home Interview Questions and AnswersTechnical Interview Questions and AnswersHTML5 HTML5 Interview Questions and Answers For Freshers Part-4

html531.Can you use MathML tags directly in HTML5 without any plugin?
Yes! The HTML syntax of HTML5 allows for MathML elements to be used inside a document using <math>…</math> tags.

32.What are the drawbacks of cookies?
Cookies have following drawbacks−

Cookies are included with every HTTP request, thereby slowing down your web application by transmitting the same data.

Cookies are included with every HTTP request, thereby sending data unencrypted over the internet.

Cookies are limited to about 4 KB of data . Not enough to store required data.

33.What do you mean by session storage in HTML5?
HTML5 introduces the sessionStorage attribute which would be used by the sites to add data to the session storage, and it will be accessible to any page from the same site opened in that window i.e. session and as soon as you close the window, session would be lost.

34.What do you mean by local storage in HTML5?
HTML5 introduces the localStorage attribute which would be used to access a page’s local storage area without no time limit and this local storage will be available whenever you would use that page.

35.When a session storage data gets deleted?
The Session Storage Data would be deleted by the browsers immediately after the session gets terminated.

36.When a local storage data gets deleted?
local storage data has no time limit. To clear a local storage setting you would need to call localStorage.remove(‘key’); where ‘key’ is the key of the value you want to remove. If you want to clear all settings, you need to call localStorage.clear() method.

37.What is Server Side Events in HTML5?
Along with HTML5, WHATWG Web Applications 1.0 introduces events which flow from web server to the web browsers and they are called Server-Sent Events (SSE). Using SSE you can push DOM events continously from your web server to the visitor’s browser.

The event streaming approach opens a persistent connection to the server, sending data to the client when new information is available, eliminating the need for continuous polling.

Server-sent events standardizes how we stream data from the server to the client.

38.How to utilize a server-sent event in HTML5?
To use Server-Sent Events in a web application, you would need to add an <eventsource> element to the document.

The src attribute of <eventsource> element should point to an URL which should provide a persistent HTTP connection that sends a data stream containing the events.

The URL would point to a PHP, PERL or any Python script which would take care of sending event data consistently.

39.What are the steps of server side scripts for SSE?
server side script should send Content-type header specifying the type text/event-stream as follows−

print “Content-Type: text/event-stream\n\n”;
After setting Content-Type, server side script would send an Event − tag followed by event name. Following example would send Server-Time as event name terminated by a new line character.

print “Event: server-time\n”;
Final step is to send event data using Data − tag which would be followed by integer of string value terminated by a new line character as follows−

$time = localtime();
print “Data: $time\n”;

40.What are web sockets?
Web Sockets is a next-generation bidirectional communication technology for web applications which operates over a single socket and is exposed via a JavaScript interface in HTML 5 compliant browsers.

Once you get a Web Socket connection with the web server, you can send data from browser to server by calling a send() method, and receive data from server to browser by an onmessage event handler.

Following is the API which creates a new WebSocket object.

var Socket = new WebSocket(url, [protocal] );
Here first argument, url, specifies the URL to which to connect. The second attribute, protocol is optional, and if present, specifies a sub-protocol that the server must support for the connection to be successful.

You may also like

Leave a Comment