HTML5 Interview Questions

HTML5 interview questions

These HTML5 questions have been designed for various interviews, competitive exams and entrance tests. We have covered questions on both basic and advanced concepts which will help you improve your skills to face interview questions on HTML5.

Who are these HTML5 interview questions designed for?

All the Front End developers, UI/ UX developers and designers will find these questions extremely useful. All freshers, BCA, BE, BTech, MCA and college students wanting to make a career in front end designing will be highly benefitted by these questions.

HTML5 interview questions topics

This section covers HTML5 topics like - Attributes, Events, SVG, MathML, Web Storage, Web SQL, WebSocket, Canvas, Audio and Video, Geolocation, Microdata, Web Workers, IndexedDB, Web Messaging, Modernizr etc.

1. What are the advantages of HTML5?

Answer:

HTML5 enables web designers to use cleaner code. We can replace div tags with semantic HTML5 elements like <section>, <article>, <header> and <nav> which enriches the semantic value of the document.

HTML5 offers type of inputs, search and different fields for different purposes, enables designer to use fancier forms.

HTML5 has an inbuilt capability to play audio and video, thus no need to use those plugin tags.

HTML5 offers an offline application cache facility that helps the files to load much faster and reduces load on server.

2. What is meant by Canvas in HTML5?

Answer:

Canvas is an HTML area on which you can draw graphics. It gives you an easy and powerful way to draw graphics on a web page using JavaScript.

By default, canvas has no border and no content.

Example:

<!DOCTYPE html>
<html>
    <body>
        <canvas id="myCanvas" height="100" style="border:2px solid red" width="150"></canvas>
    </body>
</html>


canvas

This tag has no drawing abilities of its own, it is only a container for graphics.

3. What is SVG?

Answer:

SVG stands for Scalable Vector Graphics is used to define vector-based graphics for the Web.

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.

It has several methods for drawing paths, boxes, circles, text, and graphic images.

Example:

<html>
    <body>
        <svg width="200" height="100">
            <rect width="200" height="100" style="fill:rgb(255,0,0);stroke-width:5;stroke:rgb(0,0,0)" />
        </svg>
    </body>
</html>


svg

4. Is it possible to locate the geographical position of a user in HTML5?

Answer:

Yes, HTML5 can get the location of a user using Geolocation API.

The getCurrentPosition() method can be used to get the user's current position.

5. What do you know about Web Worker?

Answer:

A web worker is a JavaScript, exists in external files and runs in the background.

Web workers are usually used for CPU intensive tasks and does not affect the performance of the page.

It allows long task without interrupting the user interface and typically run on separate threads to keep the page responsive.

web worker

The above dialog box shows the warning of unresponsive script. Web worker is a thread executing a javascript file and utilizes thread-like message passing to achieve parallelism.

They will help you to keep your UI refresh, performant, and responsive for users.