Share
Explore

Markup Languages Test Questions


HTML DOM browser Object Model API test questions
What is the primary purpose of the HTML DOM? B
a. To provide a way for JavaScript to interact with the structure and content of a web page
b. To define the layout and design of a web page
c. To handle user input and form submissions
Which method can be used to access a specific element in the DOM by its ID? A
a. getElementById()
b. getElementsByTagName()
c. getElementsByClassName()
What is the difference between the Document Object Model (DOM) and the Browser Object Model (BOM)? A
a. The DOM deals with the structure and content of a web page, while the BOM deals with the browser window and its properties and methods
b. The DOM is used for client-side scripting, while the BOM is used for server-side scripting
c. The DOM is used for styling and layout, while the BOM is used for functionality and interactivity
How can you change the content of a specific element in the DOM using JavaScript? A
a. By using the innerHTML property
b. By using the outerHTML property
c. By using the value property
What is the difference between the parentNode and parentElement properties in the DOM? B
a. The parentNode property returns the parent node of an element, including text and comment nodes, while the parentElement only returns the parent element node
b. The parentNode property returns the parent element node, while the parentElement returns the parent node of an element, including text and comment nodes
c. The parentNode property returns the first parent element node, while the parentElement returns the last parent element node.
What is the use of Document.querySelector()?B
a. It returns the first element within the document that matches the specified group of selectors.
b. It returns all elements within the document that matches the specified group of selectors.
c. It returns the last element within the document that matches the specified group of selectors.
What is the use of Document.getElementsByTagName()?
a. It returns all elements in the document with the specified tag name.B
b. It returns the first element in the document with the specified tag name.
c. It returns last element in the document with the specified tag name.
How to change the value of an attribute of an element in the DOM using JavaScript?A
a. By using the setAttribute() method
b. By using the getAttribute() method
c. By using the value property
How to remove an element from the DOM using JavaScript?A
a. By using the remove() method
b. By using the removeChild() method
c. By using the delete() method
How can you create a new element and add it to the DOM using JavaScript?A
a. By using the createElement() method and appendChild() method
b. By using the createTextNode() method and append() method
c. By using the document.write() method



HTML CSS and JavaScript test questions:
What is the purpose of CSS in web development?A
a. To provide a way to style and layout HTML elements
b. To handle user input and form submissions
c. To provide a way for JavaScript to interact with the structure and content of a web page
What is the difference between an ID and a class in CSS?A
a. An ID can be used to target a single element on a web page, while a class can be used to target multiple elements
b. A class can be used to target a single element on a web page, while an ID can be used to target multiple elements
c. ID and class are used for different type of styling.
How can you use JavaScript to change the CSS styles of an element on a web page?A
a. By using the style property of the element
b. By using the getComputedStyle() method
c. By using the querySelector() method
How do you specify multiple CSS styles for a single HTML element?A
a. By separating the styles with a comma
b. By separating the styles with a semicolon
c. By applying multiple CSS classes to the element
What is the difference between the display: block and display: inline CSS properties?A
a. Block elements take up the full width of their parent container, while inline elements only take up as much width as necessary
b. Inline elements take up the full width of their parent container, while block elements only take up as much width as necessary
c. Block elements have margin and padding while Inline elements don’t have.
How do you target a specific element using its class name in CSS?C
a. By using the class selector (.)
b. By using the id selector (#)
c. By using the element selector
How do you target a specific element using its id in CSS?B
a. By using the class selector (.)
b. By using the id selector (#)
c. By using the element selector
How do you use JavaScript to change the content of an HTML element?A
a. By using the innerHTML property
b. By using the outerHTML property
c. By using the value property
How do you use JavaScript to listen for an event on an HTML element?A
a. By using the onclick property
b. By using the addEventListener() method
c. By using the querySelector() method
How do you use JavaScript to select all elements of a specific type on a web page?A
a. By using the getElementsByTagName() method
b. By using the querySelectorAll() method
c. By using the getElementsByClassName() method
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.