This article is for people who want to prepare themselves for a job interview, or for people who wish to test their HTML mastery and learn new skills. Here we will discuss the top ten HTML5 questions asked in interviews and we will provide each one with a concise and clean answer.
- What’s new HTML 5 DocType and Charset?
- How can we embed Audio in HTML 5?
- How can we embed Video in HTML 5?
- What are the new media elements in HTML 5 other than audio and video?
- What is the usage of canvas Element in HTML 5?
- What are the different types of storage in HTML 5?
- What are the new Form Elements introduced in HTML 5?
- What are the deprecated Elements in HTML5 from HTML4?
- What are the new APIs provided by HTML 5 standard?
- What is the difference between HTML 5 Application Cache and regular HTML Browser Cache?
By the end of the article, you should have a grasp on your main HTML weaknesses. Then it’s only up to you to improve them and become a better coder. Also, don’t forget to check the sources section, where you’ll find more links and information to help you complement what you’ve learned in the questions.
1. What’s new HTML 5 DocType and Charset?
As HTML 5 is now not a subset of SGML, its DocType is simplified as follows:
And HTML 5 uses UTF-8 encoding as follows:
2. How can we embed Audio in HTML 5?
HTML 5 comes with a standard way of embedding audio files. Supported audio formats are MP3, Wav and Ogg.
<audio controls> <source src="jamshed.mp3" type="audio/mpeg"> Your browser doesn't support audio embedding feature. </audio>
3. How can we embed Video in HTML 5?
Same like audio, HTML 5 defined standard way of embedding video files. Supported video formats are MP4, WebM and Ogg.
<video width="450" height="340" controls> <source src="jamshed.mp4" type="video/mp4"> Your browser does'nt support video embedding feature. </video>
4. What are the new media elements in HTML 5 other than audio and video?
HTML 5 has strong support for media. Other than audio and video tags, it comes with the following tags:
<embed>acts as a container for external application.
<track>defines text track for media.
<source>is helpful for multiple media sources for audio and video.
5. What is the usage of canvas Element in HTML 5?
<canvas id="canvas1" width="300" height="100"> </canvas>
6. What are the different types of storage in HTML 5?
HTML 5 has the capability to store data locally. Previously, it was done with the help of cookies. The exciting thing about this storage is that it’s fast as well as secure.
There are two different objects which can be used to store data:
- localStorage object stores data for a longer period of time even if the browser is closed.
- sessionStorage object stores data for a specific session.
7. What are the new Form Elements introduced in HTML 5?
There are a number of new form elements that have been introduced in HTML 5 as follows:
8. What are the deprecated Elements in HTML5 from HTML4?
Elements that are deprecated from HTML 4 to HTML 5 are:
9. What are the new APIs provided by HTML 5 standard?
HTML 5 standard comes with a number of new APIs. Few of them are as follows:
- Media API
- Text Track API
- Application Cache API
- User Interaction
- Data Transfer API
- Command API
- Constraint Validation API
- History API and many more…
10. What is the difference between HTML 5 Application Cache and regular HTML Browser Cache?
<!doctype html> <html manifest="example.appcache"> ..... </html>
As compared with traditional browser caching, it’s not compulsory for the user to visit website contents to be cached.
Hopefully by now you acquired some taste of what an employer might ask in an interview. Even if that was not your goal, I am quite sure that learning how to add video and sound to your HTML documents will make everything a lot cooler. Still, feel free to make suggestions, we are always open to improvements!
- Top 40 HTML 5 Interview Questions: for the original article
- HTML5 Introduction: for an introduction to HTML5
- 28 HTML5 Features, Tips, and Techniques you Must Know: for more HTML5 stuff that you should know!
- Thank you Pedro Martins, former Codecademy Community Moderator, for compiling these resources and drafting this article!