Deployment & Environment Variables in Next.js Quiz – 15 Questions with Answers
15 questions · 12 min · Medium
Test your knowledge of image and font optimization in Next.js, including next/image, next/font, responsive images, image formats, loading strategies, and performance optimization.
No sign-up needed · Last updated:
Score: 0 00:00
Create a free account to keep your scores and track your progress. It is optional.
15 questions · 12 min · Medium
15 questions · 12 min · Medium
20 questions · 15 min · Medium
15 questions · 12 min · Medium
15 questions · 12 min · Medium
15 questions · 12 min · Medium
C. next/image
The Image component is imported from next/image and provides features for optimized image loading, sizing, and responsive delivery.
B. It provides image optimization and responsive delivery features
Next.js Image provides optimization features such as responsive sizing, optimized formats, and lazy loading in appropriate situations.
A. src
The src prop specifies the image source. With statically imported local images, Next.js can also infer dimensions from the imported image.
A. They help prevent unexpected layout shifts
Knowing an image's dimensions allows the browser to reserve appropriate space before the image loads, helping reduce layout shifts.
A. fill
The fill prop makes the Image component fill the dimensions of its parent container, which should provide an appropriate positioning context.
A. object-fit
The CSS object-fit property can control how a replaced element such as an image fits within its container.
A. To indicate that the image is important for initial loading
For an image that is important to the initial viewport, Next.js provides mechanisms to prioritize its loading so it is not treated like a typical lazy-loaded image.
A. next/font
The next/font module provides built-in font optimization and allows fonts to be loaded efficiently as part of the application.
A. Inter
next/font/google exports individual Google Font functions, such as Inter, which can be imported and configured in a Next.js application.
B. It helps optimize font loading and can self-host supported fonts
next/font integrates font loading into the Next.js build process and can self-host supported fonts, helping reduce dependence on external font requests.
A. next/font/local
The next/font/local module allows local font files to be loaded and optimized within a Next.js application.
A. To tell the browser how large the image will appear at different viewport sizes
The sizes prop provides responsive size information that helps the browser select an appropriate image resource.
A. The remote image host must be allowed by the image configuration
For remote images, Next.js requires the remote source to be permitted through the appropriate image configuration, such as remotePatterns.
A. WebP
Next.js image optimization can serve modern formats such as WebP when appropriate and supported by the browser.
B. To improve loading performance and reduce unnecessary resource costs
Optimizing images and fonts can reduce resource size, improve loading behavior, minimize layout shifts, and contribute to better overall web performance.