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

html541.What is the purpose of Socket.readyState atribute of WebSocket?
The readonly attribute readyState represents the state of the connection. It can have the following values:

A value of 0 indicates that the connection has not yet been established.

A value of 1 indicates that the connection is established and communication is possible.

A value of 2 indicates that the connection is going through the closing handshake.

A value of 3 indicates that the connection has been closed or could not be opened.

42.What is the purpose of Socket.bufferedAmount atribute of WebSocket?
What is the purpose of ‘canvas’ tag in HTML5?
HTML5 element <canvas> gives you an easy and powerful way to draw graphics using JavaScript. It can be used to draw graphs, make photo compositions or do simple (and not so simple) animations.

43.What is the purpose of ‘audio’ tag in HTML5?
HTML5 supports <audio> tag which is used to embed sound content in an HTML or XHTML document. The current HTML5 draft specification does not specify which audio formats browsers should support in the audio tag. But most commonly used audio formats are ogg, mp3 and wav.

You can use <source> tag to specify media along with media type and many other attributes. An audio element allows multiple source elements and browser will use the first recognized format.

44.What is the purpose of ‘video’ tag in HTML5?
HTML5 supports <video> tag which is used to embed a video file in an HTML or XHTML document.The current HTML5 draft specification does not specify which video formats browsers should support in the video tag. But most commonly used video formats are−

Ogg − Ogg files with Thedora video codec and Vorbis audio codec.

mpeg4 − MPEG4 files with H.264 video codec and AAC audio codec.

You can use <source> tag to specify media along with media type and many other attributes. An audio element allows multiple source elements and browser will use the first recognized format.

45.What is Geolocation API in HTML?
HTML5 Geolocation API lets you share your location with your favorite web sites. A Javascript can capture your latitude and longitude and can be sent to backend web server and do fancy location-aware things like finding local businesses or showing your location on a map.

Today most of the browsers and mobile devices support Geolocation API. The geolocation APIs work with a new property of the global navigator object ie. Geolocation object which can be created as follows:

var geolocation = navigator.geolocation;
The geolocation object is a service object that allows widgets to retrieve information about the geographic location of the device.

46.What is purpose of getCurrentPosition() method of geolocation object of HTML5?
This method retrieves the current geographic location of the user.

47.What is purpose of watchPosition() method of geolocation object of HTML5?
This method retrieves periodic updates about the current geographic location of the device.

48.What is purpose of clearPosition() method of geolocation object of HTML5?
This method cancels an ongoing watchPosition call.

49.What are Web Workers?
Web Workers do all the computationally expensive tasks without interrupting the user interface and typically run on separate threads.

Web Workers allow for long-running scripts that are not interrupted by scripts that respond to clicks or other user interactions, and allows long tasks to be executed without yielding to keep the page responsive.

50.What is the purpose of datetime-local input control in Web form 2.0?
It represents a date and time (year, month, day, hour, minute, second, fractions of a second) encoded according to ISO 8601 with no time zone information.

You may also like

Leave a Comment