Wednesday 15 March 2017

HTML5 interview questions Part 1

1. Ques: What is HTML5?
Answer:
HTML5 is the latest version of Hypertext Markup Language, the code that describes web pages. It's actually three kinds of code: HTML, which provides the structure; Cascading Style Sheets (CSS), which take care of presentation; and JavaScript, which makes things happen.

HTML5 has new features like Drawing, Animation, Video and Audio etc. It is used to solve some common structural problems encountered with HTML 4.1. It gives more flexibility to both the web developers, the web designers and enables more exciting and interactive websites in addition to more powerful and efficient applications.

HTML5 brings a whole new dimension to the web world. It can embed video on the web-pages without using any special software like Flash. Firefox, Chrome, Opera, Safari and Internet Explorer all support <! doctype html>.


2. Ques:  What are the new features in HTML5 ?
Answer:
Following are new features in HTML5
  • Local storage.
  • New form controls like calendar, date, time, email, URL and search etc.
  • canvas element is provided for 2D drawing.
  • video and audio elements for media playback.
  • New elements are provided. For e.g. article, header, footer, nav, section.

3. Ques: What are the various elements provided by HTML5 for media content?
Answer:
audio - It defines sound content.
video - It defines a video. 
source - This tag defines the source of video and audio.
embed - It provides a container for an external application. 
track - It defines text tracks for video and audio.


4. Ques:  What are the diffrent types of storage in html5 ?
Answer:
HTML5 offers two new objects for storing data on the client

LocalStorage – stores data with no time limit
<script type=“text/javascript”>
localStorage.lastname=“ZAG”;
document.write(localStorage.lastname);
</script>
SessionStorage – stores data for one session.The data is deleted when the user closes the browser window.
<script type=“text/javascript”>
sessionStorage.lastname=“ZAG”;
document.write(sessionStorage.lastname);
</script>


5. Ques: Differentiate between Canvas and SVG ?
Answer:
Differences between Canvas and SVG are given bellow

  • 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.

6. Ques: What are the new input types provided by HTML 5 for forms ?
Answer:
New input types for forms provided by HTML 5 are given bellow

  • color – Used for fields that should contain color.
  • date – Allows the user to select a date.
  • datetime - Allows the user to select a date and time (with time zone).
  • datetime-local - Allows the user to select a date and time (without time zone).
  • email - Used for input fields that should contain an e-mail address.
  • month - Allows the user to select a month and year.
  • number - Used for input fields that should contain a numeric value. Restrictions on type of numbers accepted can be set.
  • range - Used for input fields that should contain a value from a range of numbers. Restrictions on type of numbers accepted can be set here as well.
  • search - Used for search fields.
  • tel - Defines a field for entering a telephone number.
  • time - Allows the user to select a time.
  • url - Used for input fields that should contain a URL address.
  • week - Allows the user to select a week and year.


7. Ques: What is HTML5 Web Storage?
Answer:
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.
The data here is not included with every server request. It is used ONLY when it is asked for. It is only that particular web page that can access the data stored by itself.


8. Ques: What is the use of Canvas element in HTML5?
Answer:
The canvas element is used to draw graphics by making use of JavaScript. It is defined with the <canvas> tag. We write the following code.
This tag is nothing but a container for graphics. We need to use a script to provide the structure or shapes of the graphics.

We can have multiple Canvas elements in one HTML page.
The real power of the Canvas element is the scripting for which use JavaScript.
For the complete functionality of the HTML5 Canvas tag, we require an API which is made by writing JavaScript code that provides access to Canvas element functionality.

No comments:

Post a Comment

Thank you for comment