Responsive Images and Media — Concept Check
Questions on Responsive Images and Media. Images are usually the largest thing on a page. srcset, modern formats and a reserved aspect ratio decide both how fast the page loads and whether it jumps while loading.
Questions in this quiz
8 questions on Responsive Images and Media — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.A webpage loads slowly on a mid-range Android device. The hero image is 2400px wide but the phone screen is only 360px wide. What is the best way to optimize this?
- ARemove the hero image for mobile devices
- BUse srcset to provide different image resolutions
- CCompress the image to reduce file size
- DUse a CDN to serve the image faster
2.A developer wants to ensure images on their site do not cause layout shifts as they load. Which method should they use?
- AUse CSS to hide images until fully loaded
- BSet width and height attributes on images
- CUse JavaScript to adjust layout after loading
- DLoad images asynchronously
3.A website uses a <picture> element to serve images. What is the primary benefit of using this element?
- AIt improves image loading speed
- BIt reduces the image file size
- CIt automatically compresses images
- DIt allows for art direction and format negotiation
4.A developer notices that their site's largest contentful paint (LCP) is delayed. The hero image is set to lazy-load. What should they do to improve LCP?
- AUse a smaller hero image
- BSet fetchpriority to high for the hero image
- CEnable lazy-loading for all images
- DRemove the hero image
5.What happens if the sizes attribute is omitted in an img tag with srcset?
- AThe browser assumes 100vw and may download a larger file than needed
- BThe browser will choose the smallest image
- CThe image will not load
- DThe image will be distorted
6.A developer uses object-fit: cover for an image. What is the effect of this CSS property?
- AThe image fills the box and crops overflow
- BThe image is stretched to fit
- CThe image is letterboxed to fit
- DThe image is displayed at its original size
7.A website uses AVIF images with WebP fallbacks. What is the advantage of this setup?
- AIt improves image quality
- BIt ensures images load faster
- CIt simplifies image management
- DIt reduces image file sizes significantly
8.A developer uses image-set for background images. Why might this be less preferable than using an <img> tag with object-fit?
- Aimage-set compresses images less efficiently
- B<img> loads images faster
- C<img> supports alt text and lazy loading
- Dimage-set is not supported in all browsers