HTML5 interview questions

HTML5 interview questions | Freshers & Experienced

  • Janhavi Jaiswal
  • 13th Nov, 2019
  • 564 Followers

HTML5 interview questions

Q1. What is HTML5?

HTML5 is latest and current version HTML. It is the fifth major release of HTML that helps us to modify the appearance of web pages, as well as make adjustments to their appearance.

HTML5 works with browsers like Firefox, Chrome, Explorer, Safari and more, which makes the structure to display a particular web page, decides where the elements should put and where the images and the text should put. The basic structure of web page is first defined in the HTML5 language and with that, another language used to give a particular format and to get interactivity with the site.

Q2. Enlist few advantages of HTML5?

Advantages of HTML5 are as following:

  • Free: It is free and doesn't need any software to start working with HTML5. We can use any text editor like notepad and can open with any browser just saving with extension .html. We can other free text editors like notepad++, Atom, Eclipse.
  • Easy Structure: The HTML document can be structured in different parts using several tags like <header>, <section>, <footer>, etc.. HTML code can easily differentiate between tags and content, it allows the developer to work more effectively and detect errors more quickly. The tags are very clear and descriptive, so the developer can start writing code without any problems. It's a really easy and simple language to understand in this new version.
  • Browser Compatible: It is browser compatible. HTML5 can open with any modern browser like Firefox, Opera, Chrome, etc. Only old browsers sometimes do not support some functions of HTML5.
  • Adaptive Design: It is compatible with both computers as well as mobile phones.

Q3. What is difference between HTML and HTML5?

Some of the major differences between the HTML and HTML5 versions are:

  • HTML5 supports both audio and video without using flash or any other media player whereas HTML flash was needed.
  • HTML does not allow JavaScript to run within the web browser whereas HTML5 gives support for JavaScript to run in the background.
  • In HTML5, MathML and SVG can be used in text whereas this was not possible in HTML.
  • HTML5 supports new kinds of form controls, like dates and times, email, number, range, tel, URL, search, etc.
  • There are many new elements added in HTML5. Some of the most important ones are summary, time, audio, details, embed, figcaption, figure, footer, header, article, canvas, nav, output, section, source, track, video, etc.
  • HTML does not allow drag and drop effect while HTML5 allows drag and drop effect.
  • HTML code with old as well as new browsers whereas HTML5 code only works with modern browsers like Firefox, Google Chrome, Opera, etc.

Q4. Name the built-in object to draw on the canvas in HTML5?

In the HTML5 <canvas> element is used to draw graphics, using scripting (usually JavaScript).

The <canvas> element has no drawing ability of its own (it is only a container for graphics) - you must use a script to actually draw the graphics. The getContext("2d") object is being used to the 2D objects like draw text, lines, boxes, circles, and more on the canvas.

Q5. Enlist few tags that are no longer supported in HTML5?

The following elements are no longer supported in HTML5:

Tags (Elements) Description
<acronym> Defines an acronym
<applet> Defines an applet
<basefont> Defines an base font for the page.
<big> Defines big text
<center> Defines centered text
<dir> Defines a directory list
<font> Defines text font, size, and color
<frame> Defines a frame
<frameset> Defines a set of frames
<isindex> Defines a single-line input field
<noframes> Defines a noframe section
<s> Defines strikethrough text
<strike> Defines strikethrough text
<tt> Defines teletype text
<u> Defines underlined text

Q6. How to get Geolocation in HTML5?

HTML5 Geolocation API ( Application Programming Interface ) is used to get the geographical position of a user. This is related to privacy, you can’t find location unless the user approves it. navigator.geolocation.getCurrentPosition() function is used to get the user's position.

Q7. What is the sessionStorage Object in HTML5?

sessionStorage object is similar to localStorage only difference is that sessionStorage stores the data only for a session. Once the user closes the browser data is lost.

Q8. Enlist new input type attributes added in HTML5?

Following are list of new HTML5 attributes in <input>

  • autocomplete
  • autofocus
  • form
  • formaction
  • formenctype
  • formmethod
  • formnovalidate
  • formtarget
  • height and width
  • list
  • min and max
  • multiple
  • pattern (regexp)
  • placeholder
  • required
  • step

Q9. What is MathML in Html5?

MathML is an XML (Extensible Markup Language) application for describing Mathematical notations and capturing both the structure and contents. MathML is used to enable Mathematics to be served, received and processed in www. MathML elements would be used inside HTML5 document using <math>...</math> tags.

Q10. Explain web worker in HTML5?

A web worker is a JavaScript code that runs in the background without affecting the performance of the webpage. You can continue to do whatever you want: clicking, selecting things, etc.

Web Workers are designed to do computationally expensive tasks without interrupting the user interface.

Q11. How to read and write data to local storage in HTML5?

The localStorage object stores the data with no end date. The data will not be deleted when the browser is closed, and will be available the next day, week, or year untill user will remove it.

localStorage.setItem() used to write to local storage and localStorage.getItem() can be used to get data from storage

Example

localStorage.setItem('username','ankit');
var username=localStorage.getItem('username');
console.log(username); // ankit

Q12. What are new structuring tags introduced in HTML5?

New structuring or semantic tags introduced in HTML5 are <header> , <footer>,<article>,<section>,<aside> . Which are used to represent structure of web page.

Q13. What are Server-Sent Events in HTML5?

Server-Sent Events allow a web page to get updates from a server automatically. This was also possible before, but the web page needed to ask if any updates were available. With server-sent events, the updates come automatically from the server.

Examples: Facebook updates, Twitter updates, stock price updates, news feeds, sports results, etc.

Q14. What is difference between cookies, sessionStorage, and localStorage?

Difference between cookies, sessionStorage, and localStorage

Cookies: It is a small amount of data that the website uses to keep track of user visits and activity. Cookies are created by server code and saved on the user's computers. Cookies are read by the only server who created it.

Local storage: It is used to save data persistently on the user's computers and available until it is manually removed by the user.

Session storage: Data will be saved for the session, we close browser data will get removed.

Q15. Enlist new Form Elements introduced in HTML5?

datalist, output, keygen, progress, and meter are new Form Elements introduced in HTML5

Q16. What is Web Storage?

HTML5 provides web storage services that allow websites to store information on the browser. Web storage can store data locally and can store large data (5Mb).

Q17. What does RGB stand for?

RGB stands for Red Green Blue. It is used to create a broad array of colors by adding different values of red, blue, green colors.

Q18. Which tag is used to define deleted text?

The <del> tag is used to display the deleted text. Delete tag is markup updates and modifications in a document.

About Author :

  • Author of HTML5 interview questions

    Janhavi Jaiswal

    Janhavi is a Digital marketing expert and technical content writer. She like solving problems and delivering results that make positive impacts.She is quick learner.

Leave A Comment :

Valid name is required.

Valid name is required.

Valid email id is required.