Which attribute is used to express a high relative fetch priority for an important image?
loading="lazy"decoding="async"fetchpriority="high"alt="high"
19. Quiz Answer Key and Explanations
Check your answers and review the explanations to reinforce the concepts covered in this section.
Answer 1: B — <img>
The img element embeds an image resource in the document. The src attribute specifies the resource, while alt provides its text alternative.
Answer 2: C — Provide a text alternative
The alt attribute communicates the image's relevant information when the image cannot be seen or when assistive technology is used. Width, compression and fetch priority are controlled separately.
Answer 3: D — alt=""
An explicitly empty alt attribute indicates that the image is decorative and does not need a text alternative. Omitting alt entirely can cause the image's filename or URL to be exposed by some assistive technologies.
Answer 4: B — Reserve layout space
Accurate dimensions allow the browser to calculate the image's aspect ratio and reserve space before the image finishes loading. This can reduce layout shifts but does not guarantee successful loading.
Answer 5: False
The width attribute describes the intended display width in CSS pixels. It does not necessarily change the source file or the number of pixels downloaded. A separately optimized image resource may be needed to reduce download size.
Answer 6: C — SVG
SVG uses vector graphics. Shapes are represented mathematically rather than as a fixed grid of pixels, allowing them to scale smoothly in ordinary rendering scenarios.
Answer 7: B — Images far below the viewport
Lazy loading can defer images that are not immediately needed. Important above-the-fold images, especially the main hero image, should not be delayed without a good reason.
Answer 8: A, B and D
- A is correct because img is a void element and does not accept child content.
- B is correct because alt text should reflect the image's meaning and purpose in context.
- C is incorrect because CSS display size does not guarantee that the downloaded resource is small.
- D is correct because picture and its source elements allow the browser to select among alternative image resources.
Answer 9: True
When an image is the only content of a link, its alternative text normally provides the link's accessible name. The description should communicate the destination or action rather than merely describing irrelevant visual details.
Answer 10: C — fetchpriority="high"
The fetchpriority attribute communicates a relative priority hint to the browser. Use it selectively for important resources. The loading and decoding attributes serve different purposes.