Advanced Next.js test (Advanced)
40 questions · 40 minutes · Free
Rendering strategies, ISR, the edge runtime, performance and deployment.
Take the Advanced Next.js test
What it covers
- Incremental static regeneration
- Next.js edge runtime
- Streaming and Suspense in Next.js
- Next.js performance and Core Web Vitals
- Deploying Next.js
Interview format
- Questions: 40 questions — 24 multiple choice, 12 multi-answer, 4 predict-the-output
- Time: 40 minutes, timed from the first question
- Difficulty: Advanced
- Skill area: Frontend
- Price: Free
Earn a certificate
The Advanced Next.js test is one of the 7 tests of the Frontend Developer: Advanced learning path. Pass it and the other 6 tests at 70% or more and readyforhires issues you a verifiable certificate in your name, with its own code and verify link to share or add to LinkedIn.
Sample questions
5 sample questions from the Advanced Next.js test, with the answers. Samples are taken out of the live test, so you will not meet these when you sit it.
Which of the following is the correct method to trigger on-demand revalidation of a specific path in Next.js?
- revalidatePath('/blog', 60)
- revalidate('/blog')
- revalidateTag('blog')
- revalidatePath('/blog')
Answer: D. revalidatePath('/blog')
In Next.js, `revalidatePath('/blog')` is used to trigger on-demand revalidation of a specific path. This is typically called from a Server Action or Route Handler after a CMS webhook. The other options are not valid methods for triggering revalidation in this context.
How can you annotate a request for tracing in the Edge runtime of Next.js?
- Use `console.log()` to log request details for tracing purposes.
- Use the `fetch` API with `next: { tags: ['trace'] }` to annotate the request for tracing.
- Use `next.config.js` to enable tracing for all requests.
- Use the `trace` method on the `Request` object for tracing.
Answer: B. Use the `fetch` API with `next: { tags: ['trace'] }` to annotate the request for tracing.
In the Edge runtime, you can use the `fetch` API with the `next` option to annotate requests for tracing by adding a tag like `tags: ['trace']`. This helps in monitoring and debugging requests in a production environment. Other options like using `console.log()` or `next.config.js` are not specific to request tracing in the Edge runtime.
In Next.js, when multiple revalidation values are set for a route (e.g., in a page, layout, or fetch), which value takes precedence?
- The revalidate value set in getStaticPaths takes precedence
- The highest revalidate value in a route wins
- The revalidate value set in getStaticProps takes precedence
- The lowest revalidate value in a route wins
Answer: D. The lowest revalidate value in a route wins
In Next.js, when multiple revalidation values are set (e.g., in a page, layout, or fetch), the lowest revalidate value in the route takes precedence, ensuring the most frequent regeneration of the page.
What is the likely issue if the fallback UI is not displayed when using Incremental Static Regeneration (ISR) with a `loading.tsx` file or a `<Suspense>` boundary?
- The fallback UI is not needed, as the data is fetched synchronously.
- The fallback UI displays immediately, but the page is not rendered until the data is fetched.
- The fallback UI will not display until the data is fully fetched, causing a delay in rendering the page.
- The fallback UI is displayed, but the page is rendered before the data is fetched.
Answer: C. The fallback UI will not display until the data is fully fetched, causing a delay in rendering the page.
In Next.js, when using `loading.tsx` or a manual `<Suspense>` boundary, the fallback UI should display immediately while the data is being fetched. If the fallback UI is not displaying, it may be due to incorrect implementation, such as not using `loading.tsx` or not wrapping the component in a `<Suspense>` boundary.
In Next.js, when multiple revalidation settings are applied (e.g., in a page, layout, or fetch call), which rule determines the effective revalidation period for the route?
- The lowest revalidate value in a route wins
- Revalidate values are averaged across the route
- The highest revalidate value in a route wins
- Revalidate values are ignored if a tag is used
Answer: A. The lowest revalidate value in a route wins
In Next.js, when multiple revalidation settings are applied (e.g., in a page, layout, or fetch call), the lowest revalidate value takes precedence and determines the revalidation period for the route.
Frequently asked questions
- How many questions are in the Advanced Next.js test?
- 40 questions (24 multiple choice, 12 multi-answer, 4 predict-the-output), with 40 minutes to answer them.
- What does the Advanced Next.js test cover?
- Incremental static regeneration, Next.js edge runtime, Streaming and Suspense in Next.js, Next.js performance and Core Web Vitals, Deploying Next.js.
- Is the Advanced Next.js test free?
- Yes. It is free to take with a readyforhires account.
- What level is the Advanced Next.js test?
- Advanced, in Frontend.