+91 90691 39140 | +1 253 214 3115 | info@hub4tech.com | hub4tech

HTML5 Interview Questions and Answers

What are the new features provided in HTML5?

Some of the new features provided in HTML5 are:

  • It provides support for local storage
  • New form controls, like calendar, date, time, email, url, search
  • element is provided to facilitate 2D drawing
  • The and elements are provided for media playback
  • New content-specific elements are provided. For e.g. , , , ,
What is the origin of HTML5?

In 2004, HTML 4.01 was the standard, remaining stagnant and without updates since 2000. While the Web Hypertext Application Technology Working Group, or WHATWG, were working out a new standard, the World Wide Web Consortium, or W3C, was focusing their own efforts on XHTML 2.0.
In 2006, the two organizations decided to join forces and develop a new web standard for HTML. They are currently working on HTML5.

Tell us something about the new <canvas> element.
  • The new element provided by HTML 5 aids in 2D drawing.
  • It uses the tag .
  • This tag helps in drawing graphics through scripting usually JavaScript.
What are some of the key issues with previous HTML versions that HTML5 is addressing?

One main issue developers of HTML5 are aiming to reduce is the need for so many external plug-ins like Silverlight and Flash. HTML5 also offers improvements to error handling and scripting.

Which method is used to draw an image on the canvas?

drawImage(image,x,y) method is used to draw an image on the canvas.

What are the new form element types introduced in HTML5?
  • Date
  • Datetime-local
  • Time
  • Color
  • Email
  • URL
  • Range
  • Telephone
  • Number
  • Search
Which methods are used to draw a straight line on a Canvas?

Following methods are used to draw a straight line on a Canvas:

  • moveTo(x,y) – It defines the starting co-ordinates of the line
  • lineTo(x,y) – It defines the ending co-ordinates of the line
  • The actual line is drawn with the help of a method like stroke()
How do you enable the application cache?

To enable the application cache, just add the manifest attribute inside the tag and link to the manifest file. If a web user visits a page with the manifest attribute included, that page will be cached.
The suggested file extension for manifest files is “.appcache,” as seen in the example above.

What is the application cache, and what are its benefits?

The application cache generates offline versions of a web application, making it accessible offline. It also improves the site’s performance and speed.

What is a Canvas? What is the default border size of a canvas?

Canvas is a rectangular area on a HTML page, specified with the tag .
By default, a canvas has no border. To get a border on the canvas, a style attribute is required to be used.

What is the manifest file?

The manifest file is a text file that instructs the browser what it should and should not cache when the application cache is enabled. It is made up of three parts:

  • Cache Manifest: Indicates files to be cached after they are initially downloaded.
  • Network: Indicates files that require a server connection to load, and will not be cached.
  • Fallback: Indicates fallback pages in the case a page is not accessible.
Differentiate between Canvas and SVG.

The table below shows some important differences between Canvas and SVG:

  • Canvas is resolution dependent while SVG is not.
  • Canvas does not provide any support for event handlers while SVG does.
  • Canvas is suitable for graphic-intensive games while SVG is not suitable for gaming.
  • Canvas is suitable for small rendering areas while SVG is suitable for large rendering areas like Google maps.
Which file formats does the <audio> tag support? Which browsers support the different formats?

MP3, WAV, and OGG files are supported by the audio tag.
The MP3 file format is supported by Chrome, Internet Explorer, Safari, and Firefox 21 running on Windows Vista, Windows 7, Windows 8, and Android devices. It is not supported by other versions of Firefox, or Opera.
The WAV file format is supported by Chrome, Firefox, Safari, and Opera. It is not supported by Internet Explorer.
The OGG file format is supported by Chrome, Firefox, and Opera. It is not supported by Internet Explorer or Safari.

What is SVG?
  • SVG is the abbreviation for Scalable Vector Graphics and is recommended by W3C.
  • It is used to define vector-based graphics for the Web
  • The graphics are defined in XML format
  • An important quality of SVG graphics is that their quality is maintained even when they are zoomed or resized.
  • All the element and attributes of SVG files can be animated
  • 15
    What are the advantages of SVG over other image format like JPEG or GIF?

    Following are the main advantages of using SVG over other image formats:

    • It is possible to scale the SVG images.
    • They can be created and edited with any text editor
    • The print quality of these image is high at any resolution.
    • It is possible to zoom the SVG images without any degradation in the quality.
    • SVG images can be searched, indexed, scripted, and compressed
    Which JavaScript objects are not accessible to web worker?

    Following JavaScript objects are not accessible to web worker:

    • The window object
    • The document object
    • The parent object
    Can HTML 5 get the geographical position of a user?
    • Yes, HTML 5 can get the location of a user with the use of Geolocation API.
    • Use getCurrentPosition() method to get the user’s current position.
    What is a Web Worker?
    • A web worker is a JavaScript which runs in the background. It exists in external files.
    • It is independent of other scripts and does not affect the performance of the page.
    • Web workers are usually used for CPU intensive tasks.
    What is HTML5 Web Storage?

    With HTML5, it is possible for the web pages to store the data locally in the user's browser. This web storage is much faster and secured than the cookies. Also, a larger amount of data can be stored without causing any adverse effect to the performance of the website.

    Copyright ©2015 Hub4Tech.com, All Rights Reserved. Hub4Tech™ is registered trademark of Hub4tech Portal Services Pvt. Ltd.
    All trademarks and logos appearing on this website are the property of their respective owners.