Web Technologies - Old Questions

3.  What is DOM Hierarchy? Explain the use of *, ? and + in defining a DOM element.

10 marks | Asked in 2068-II

Every web page resides inside a browser window which can be considered as an object. A Document object represents the HTML document that is displayed in that window. The Document object has various properties that refer to other objects which allow access to and modification of document content.

The way a document content is accessed and modified is called the Document Object Model, or DOM. The Objects are organized in a hierarchy. This hierarchical structure applies to the organization of objects in a Web document.

Here is a simple hierarchy of a few important objects −

DOM HTML tree


*, ? and + are the part of regular expression.

A asterisk(*) indicates that the preceding character should appear zero or more times in the pattern.

  • The pattern fo* can be found in"fd", "fod", "food", "foood" etc.

A questionmark(?) indicates that the preceding character should appear zero or one times in the pattern.

  • The pattern foo? can be found in "food" and "fod" but not "faod".

A plus sign(+) indicates that the preceding character should appear one or more times in the pattern.

  • The pattern fo+ can be found in "fod", "food" and "foood", but not "fd".