MTA HTML5 Application Development Fundamentals 1 — Questions and Answers
Question 1: Which HTML5 element is used to draw graphics and animations using JavaScript?
- <svg>
- <canvas> (Correct answer)
- <figure>
- <graphic>
Correct answer: <canvas>
The <canvas> element provides a bitmap drawing surface that JavaScript can use to render 2D graphics, animations, games, and data visualizations.
Question 2: What does the HTML5 doctype declaration <!DOCTYPE html> do?
- Links an external stylesheet
- Tells the browser to render the page in HTML5 standards mode (Correct answer)
- Declares the page encoding as UTF-8
- Imports JavaScript libraries
Correct answer: Tells the browser to render the page in HTML5 standards mode
The <!DOCTYPE html> declaration instructs the browser to use the HTML5 specification and render the page in standards mode rather than quirks mode.
Question 3: Which CSS property is used to control the layout of child elements in a flex container?
- display: grid
- display: flex (Correct answer)
- position: absolute
- float: left
Correct answer: display: flex
Setting display: flex on a container element activates CSS Flexbox, enabling flexible one-dimensional layouts and alignment control over child elements.
Question 4: What is the purpose of the HTML5 localStorage API?
- Storing data on the server
- Storing key-value data persistently in the browser with no expiration (Correct answer)
- Caching network requests
- Managing user sessions on the server
Correct answer: Storing key-value data persistently in the browser with no expiration
localStorage allows web applications to store key-value pairs in the browser persistently with no expiration date, surviving browser sessions and restarts.
Question 5: Which HTML5 input type is used to collect email addresses with built-in validation?
- <input type='text'>
- <input type='email'> (Correct answer)
- <input type='url'>
- <input type='string'>
Correct answer: <input type='email'>
The email input type provides browser-level validation ensuring the entered value matches an email format, and shows a suitable keyboard on mobile devices.
Question 6: What is the Document Object Model (DOM) in web development?
- A CSS styling framework
- A programming interface representing the HTML document as a tree of objects that scripts can manipulate (Correct answer)
- A server-side rendering engine
- A database for storing web content
Correct answer: A programming interface representing the HTML document as a tree of objects that scripts can manipulate
The DOM is a tree-structured programming interface that represents an HTML document's elements as objects, allowing JavaScript to dynamically read and modify content and structure.
Which HTML5 element is used to draw graphics and animations using JavaScript?