• +91 9723535972
  • info@interviewmaterial.com

HTML Interview Questions and Answers

Related Subjects

HTML Interview Questions and Answers

Question - 91 : - Please explain whether an
element can have
elements and vice-versa.

Answer - 91 : -

Yes, an
element can have
element(s) and a
element can also have
elements. For example, a user panel for a website can have multiple
elements, intended for blog, analytics, payment options, news, et cetera.

Now, the
element for the blog can have multiple
elements to accommodate various articles. Further, each of these
elements can have two
elements, one for the comments section and the other for sharing section.

Question - 92 : - Explain the difference between Canvas and SVG elements.

Answer - 92 : -

Following are the various differences between and elements:

1. API Animation
Canvas has no provision for API animation. SVG, on the contrary, is capable of API animation.

2. Change Accommodation
Each drawn shape in SVG is remembered as an object by the web browser. If the attributes pertaining to an SVG object are changed, the browser automatically re-renders the shape.
The web browser forgets once the graphic is drawn in Canvas. If there is a change in the position of a Canvas graphic, the complete scene requires redrawing. While modification in Canvas is only allowed through the script, SVG supports modification via script as well as CSS.

3. Definition
SVG stands for Scalable Vector Graphics. It features many methods for drawing bitmap images, boxes, circles, paths, and text.
SVG is a language for describing 2D graphics, where the element is a container for SVG graphics. Canvas allows users to draw 2D graphics on the fly using J.S.

4. Dependency
SVG doesn't depend on the resolution, while Canvas completely depends on the same.

5. How is it handled?
SVG is XML-based, meaning that each element is available within the SVG DOM. For an element, you can attach several J.S. event handlers. Canvas is rendered pixel by pixel, i.e., it is pixel-based. There is no support for event handlers in elements.

6. Ideal for
While Canvas is suitable for small rendering areas and games graphics, SVG is the best option for large rendering areas and printing with high-quality at any resolution.

7. Scalability
Canvas has poor scalability. SVG, however, has better scalability.

Question - 93 : - What will happen if the doctype is not specified in an HTML web page?

Answer - 93 : - If the doctype is not specified in an HTML web page, then the web browser will be unable to interpret the new HTML5-specific tags.

Question - 94 : - List the various techniques for optimizing website assets.

Answer - 94 : -

To optimize website assets, one needs to decrease:

  • The download size, and
  • The total number of HTTP requests that are made
Following techniques can be used for optimizing website assets:

  • CDN hosting
  • File compression
  • File concatenation
  • Offloading assets
  • Re-organizing
  • Refining code

Question - 95 : - Please explain the Geolocation API in HTML5. How will you create a Geolocation object?

Answer - 95 : -

The Geolocation API in HTML5 allows users to share their location with selected websites. J.S. is capable of capturing a user's latitude and longitude and sending the same to the backend server.

Doing so enables location-aware features like finding local places of interest and finding out one's location on the map. A new geolocation object can be created using the following code:

var geolocation = navigator.geolocation;

The Geolocation object is actually a service object. It allows widgets to retrieve information about the geographical location of a user's device. Most browsers and mobile devices provide support for the Geolocation API. The API works with a new property of the global navigator object.

Question - 96 : - Explain the difference between div and span.

Answer - 96 : - Both div and span are used for giving out the output. While span gives the output with display: inline, div gives output with display: block. Typically, span is used when there is the need to display the elements one after the other, i.e., in a line.

Question - 97 : - What do you understand by HTML5 Web Storage? Is it any better than Cookies?

Answer - 97 : -

Prior to HTML5, web pages were able to store data locally within a browser using cookies. The HTML5 introduces Web Storage that allows a webpage to do the same as that of the cookies. Web Storage, however, is faster and more secure than cookies.

The HTML5 Web Storage is faster because the data isn't included with every server request. Instead, it is used when asked for. A web page can only access the data stored by itself, which is stored in name/value pairs

Another important distinction between the HTML5 Web Storage and Cookies is that:
  • Web Storage never transfers the data to the server, and
  • When compared to cookies, the storage limit for the HTML5 Web Storage is much larger, at least 5MB, and at max 10MB.

Question - 98 : - Why do you think the addition of drag-and-drop functionality in HTML5 is important? How will you make an image draggable in HTML5?

Answer - 98 : -

When it comes to UI interaction, the drag-and-drop is essential functionality. Almost all modern U.I.s have it. It makes copying, moving, and linking an object, such as an image or a link, very easy.

To make an image draggable in HTML5, we need to set the draggable image attribute true i.e.:

type =

Question - 99 : - What do you understand by image maps in HTML5? How many types does it have?

Answer - 99 : -

Image maps allow users to click on images for opening new web pages. As such, these are a combination of images and URLs. Image maps are of two types:

  • Client-side Image Map - Created using and elements. The map element holds the map information, and the area element takes the attributes for defining each section of the map.
  • Server-side Image Map - Created using the attribute, which is the name of the map.

Question - 100 : - Why do we need the MathML element in HTML5?

Answer - 100 : -

MathML stands for Mathematical Markup Language. It is a form of XML for describing the Math notation. MathML is a markup language for displaying mathematical and scientific expressions over web pages.

For implementing the MathML element i.e. displaying a mathematical equation, we put it inside the and tags.


NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners