Deployment & Environment Variables in Next.js Quiz – 15 Questions with Answers
15 questions · 12 min · Medium
Test your knowledge of dynamic routes, dynamic segments, catch-all routes, optional catch-all routes, route parameters, and file-based routing in Next.js.
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
20 questions · 15 min · Medium
15 questions · 12 min · Medium
15 questions · 12 min · Medium
15 questions · 12 min · Medium
15 questions · 12 min · Medium
A. Creating routes whose paths can contain dynamic values
Dynamic routes allow parts of a URL to be represented by values such as IDs, usernames, or slugs.
A. [id]
A folder such as app/products/[id] defines a dynamic route segment named id.
A. /products/[id]
The [id] segment is dynamic, so URLs such as /products/10 or /products/abc can match the route.
A. A dynamic route parameter
The [slug] folder creates a dynamic segment whose value is available as a route parameter.
A. A route that captures multiple URL segments
A catch-all segment can capture multiple path segments and expose them as an array of values.
A. [...slug]
The [...slug] syntax defines a catch-all dynamic segment that captures one or more path segments.
A. /docs/getting-started
A catch-all segment can match one or more segments after /docs, such as /docs/getting-started or /docs/api/reference.
A. An array of path segments
For a catch-all segment such as [...slug], the parameter contains the captured path segments as an array.
A. [[...slug]]
The [[...slug]] syntax defines an optional catch-all segment, which can also match the route without any additional path segments.
A. [[...slug]] can also match the route without the catch-all segments
A regular catch-all requires at least one captured segment, while an optional catch-all can match zero or more segments.
D. All of the above
An optional catch-all route can match /shop as well as paths containing one or more additional segments.
A. Through the params prop
App Router pages and layouts can receive dynamic route parameters through the params prop.
A. ["nextjs", "routing"]
The catch-all parameter captures each path segment after /blog as an array.
A. generateStaticParams
In the App Router, generateStaticParams can return parameter values used to statically generate dynamic routes.
A. Dynamic segments match a single path segment, while catch-all segments can match multiple path segments
A [segment] represents one dynamic path segment, while [...segment] captures multiple segments and [[...segment]] makes that catch-all portion optional.