Chapter 6 of HTML, covering Images and Multimedia Basics, is essential for building rich, interactive websites. It delves into adding images using <img>, image attributes, video and audio embedding with <video> and <audio>, and related concepts like sizing. This knowledge is crucial for modern web design and development. Below are 30 multiple-choice questions (MCQs) to help you assess your understanding of this topic.
MCQs on “Images and Multimedia Basics in HTML”
Section 1: Adding Images (<img>)
What does the <img> tag in HTML represent?
a) A link
b) An image
c) A video
d) An audio file
Which attribute of the <img> tag specifies the image source?
a) href
b) src
c) alt
d) link
The alt attribute in an <img> tag is used for:
a) Providing the image title
b) Specifying image size
c) Displaying alternative text for accessibility
d) Determining image location
How do you make an image appear as a link in HTML?
a) By using the <link> tag
b) By wrapping the <img> tag inside an <a> tag
c) By using the href attribute inside <img>
d) By setting the image’s background property
Which of the following is a correct example of an <img> tag in HTML?
a) <img alt="flower" src="flower.jpg">
b) <img href="flower.jpg" alt="flower">
c) <img source="flower.jpg" alt="flower">
d) <img link="flower.jpg" alt="flower">
What happens if the alt attribute is not included in an <img> tag?
a) The image will not be displayed
b) The page will break
c) The image will display a broken link icon
d) Nothing will happen; it’s optional
How would you prevent an image from being stretched when resizing it?
a) Set both width and height attributes to auto
b) Use the object-fit property
c) Use image-width and image-height
d) Use the size property
The width and height attributes in an <img> tag specify:
a) The resolution of the image
b) The dimensions in pixels
c) The file size of the image
d) The border around the image
To make an image responsive (scale with screen size), which CSS property is typically used?
a) max-width: 100%;
b) width: 100%;
c) display: flex;
d) object-fit: contain;
Which of the following is a valid image file format supported in HTML?
a) .html
b) .jpg
c) .css
d) .js
Section 2: Image Sizing
The object-fit property is used to control:
a) Image compression
b) How an image is resized to fit its container
c) The image’s background color
d) The image alignment
How can you set a fixed width for an image while keeping its aspect ratio intact?
a) Set only the width property, leave height blank
b) Set both width and height properties
c) Use object-fit: fill
d) Set both width and height to auto
What does the max-width property ensure when applied to an image?
a) It prevents the image from exceeding the specified width
b) It fixes the height of the image
c) It adds a border around the image
d) It makes the image stretch to fit the container
Which CSS property would you use to center an image horizontally?
a) text-align: center;
b) align-content: center;
c) margin: 0 auto;
d) position: absolute;
Which value of object-fit property will make the image fill the container while preserving its aspect ratio?
a) contain
b) cover
c) fill
d) none
Section 3: Adding Simple Videos and Audios (<video> and <audio>)
Which tag is used to add video content in HTML?
a) <media>
b) <video>
c) <movie>
d) <film>
What attribute is used to specify the video file in the <video> tag?
a) src
b) type
c) file
d) srcfile
The <audio> tag is used for:
a) Displaying audio controls
b) Embedding video content
c) Adding audio files to the page
d) Displaying image captions
Which attribute would you use to autoplay a video as soon as the page loads?
a) autoplay
b) play
c) start
d) auto
What is the correct syntax to embed an audio file in HTML?
a) <audio src="audio.mp3" controls>
b) <audio file="audio.mp3" controls>
c) <audio controls src="audio.mp3">
d) <audio control="audio.mp3" src="audio.mp3">
Which tag would you use to add multiple video formats for compatibility in HTML?
a) <video>
b) <source>
c) <files>
d) <formats>
How would you enable controls (play, pause, etc.) for a video element?
a) By adding the controls attribute to the <video> tag
b) By using JavaScript functions
c) By adding autoplay and loop attributes
d) By adding the play attribute
To make an audio or video file play continuously in a loop, which attribute should you use?
a) loop
b) repeat
c) auto-loop
d) replay
Which of the following is a valid file format for embedding video using the <video> tag?
a) .docx
b) .mp4
c) .html
d) .js
What is the purpose of the <source> tag inside a <video> or <audio> element?
a) To specify alternative formats of the media file for better compatibility
b) To provide metadata about the file
c) To display a source URL
d) To add a title to the media file
What does the controls attribute do in a video tag?
a) It allows users to adjust video settings
b) It makes the video loop continuously
c) It adds a play/pause, volume, and progress bar interface
d) It makes the video play automatically
Which file type is supported by the <audio> tag for embedding sound?
a) .mp3
b) .avi
c) .html
d) .png
The poster attribute is used in the <video> tag to:
a) Define the first frame of the video shown before it plays
b) Add a logo to the video
c) Make the video responsive
d) Set a play button on the video
How do you mute a video or audio element by default?
a) Set muted="true"
b) Use muted="false"
c) Use volume="0"
d) Set auto-play="true"
What is the correct HTML syntax to add multiple <source> elements within a <video> tag for different formats?
a) <video><source src="video.mp4" type="video/mp4"><source src="video.ogv" type="video/ogv"></video>
b) <video src="video.mp4"><source src="video.ogv" type="video/ogv"></video>
c) <video><source type="video/mp4" src="video.mp4"></video>