HTML5 HTML5 Audio and Video 1 — Questions and Answers
Question 1: Which HTML5 element is used to embed audio content on a web page?
- <audio> (Correct answer)
- <sound>
- <media>
- <music>
Correct answer: <audio>
The <audio> element embeds sound content in a document and supports multiple source formats via nested <source> elements.
Question 2: Which attribute on the <video> element makes the video start playing automatically when the page loads?
- autoplay (Correct answer)
- autostart
- playonload
- start
Correct answer: autoplay
The autoplay attribute causes the video to begin playing as soon as it is ready, though browsers often require muted to be set as well.
Question 3: What does the 'controls' attribute on <video> or <audio> do?
- Displays the browser's native playback controls (Correct answer)
- Enables keyboard shortcuts for media
- Restricts third-party players from loading
- Shows a custom overlay UI
Correct answer: Displays the browser's native playback controls
The controls attribute tells the browser to display its built-in playback controls including play, pause, volume, and progress bar.
Question 4: Which element is used inside <video> or <audio> to specify multiple media file sources?
- <source> (Correct answer)
- <src>
- <media>
- <file>
Correct answer: <source>
The <source> element is placed inside <video> or <audio> to specify multiple media files in different formats, allowing the browser to choose the one it supports.
Question 5: What HTML5 element is used to provide text tracks (subtitles or captions) for a video?
- <track> (Correct answer)
- <subtitle>
- <caption>
- <text>
Correct answer: <track>
The <track> element specifies timed text tracks (subtitles, captions, chapters) for media elements in WebVTT format.
Question 6: Which format is natively supported for subtitles and captions in HTML5 <track> elements?
- WebVTT (.vtt) (Correct answer)
- SRT (.srt)
- SSA (.ssa)
- TTML (.ttml)
Correct answer: WebVTT (.vtt)
WebVTT (Web Video Text Tracks) is the native HTML5 format for timed text tracks, used with the <track> element.
Which HTML5 element is used to embed audio content on a web page?