Web Technology Basics

Which of the following correctly describes the DOM (Document Object Model) used in browsers?

  1. AA form into which the table structure of a server's database is converted, as HTML tables (table elements), to be sent to the browser
  2. BA representation of an HTML document as a tree whose nodes are elements and so on, which JavaScript can read and write
  3. CA format in which CSS rules are compressed by removing whitespace, to make files smaller and load faster
Show answer and explanation

Answer: B. A representation of an HTML document as a tree whose nodes are elements and so on, which JavaScript can read and write

The browser parses HTML and builds a tree structure (the DOM tree) whose root is the html element and whose nodes include head, body and the paragraphs inside them. JavaScript changes the page through the DOM, finding elements with document.querySelector, rewriting text and attributes, and adding elements. When the DOM changes, the browser redoes the layout calculation and painting as needed. The DOM is standardized as an interface for manipulating documents that does not depend on any particular programming language.

  • A. The DOM is the structure of the document inside the browser and has nothing to do with databases.
  • B. Correct. It represents the document as a tree so that scripts can manipulate it.
  • C. It has nothing to do with compressing CSS. The structure built from CSS is called the CSSOM.
Practice this topic Back to topic

Books on Web Technology Basics Ad

As an Amazon Associate I earn from qualifying purchases.

More Web Technology Basics questions

  1. For the element styled with the CSS above, which of the following is the width from the outer edge of the left border to the outer edge of the right border?
  2. Assume there are no other style specifications. In the HTML above, which of the following is the color of the text "Hello"?
  3. In the processing a browser does before showing the first screen (the critical rendering path), a <script src="app.js"> written without attributes inside <head> makes the HTML parser stop at that point. Which of the following correctly describes the behavior when the defer attribute is added to this element?
  4. When the JavaScript above is run in a browser, which of the following is the order in which the characters are shown on the console?
  5. Under the browser's same-origin policy, which of the following URLs is considered to have the same origin as https://www.example.com/app/index.html?