Interview
Quiz
Test your Next.js knowledge across routing, rendering, Server Components, data fetching, authentication, SEO, performance, deployment, and projects.
1. Learning Objectives
By the end of this quiz, you will be able to assess your readiness across the full Next.js course and identify topics to review before interviews or project work.
Difficulty: Advanced.
2. Prerequisites
3. Overview
This quiz mixes recall, scenario questions, debugging prompts, and architecture tradeoffs. Answer before opening the solution blocks.
4. Why This Topic Matters
Quizzes expose fuzzy understanding. If you can explain an answer quickly and correctly, you are much closer to interview and production readiness.
5. Real-World Analogy
The quiz is a preflight check. It does not fly the plane for you, but it catches missing pieces before takeoff.
6. Core Concepts
| Quiz Area | Skills Tested |
|---|---|
| Routing | Route files, dynamic segments, layouts. |
| Rendering | SSG, SSR, ISR, CSR, streaming. |
| Components | Server/client boundaries and hydration. |
| Data | Fetching, Route Handlers, Server Actions. |
| Production | Auth, metadata, performance, env vars, deploys. |
7. Syntax & API Reference
8. Visual Diagram
9. Live Example - Full Working Code
What just happened? The page fetches post data on the server, then passes serializable props to a client-side interactive component.
10. Interactive Playground
Score yourself:
11. Multiple Choice
1. Which file makes/dashboard publicly routable?
A. app/dashboard/layout.tsx
B. app/dashboard/page.tsx
C. app/dashboard/loading.tsx
D. app/dashboard/template.tsx
Answer
B. A page.tsx file defines the route's UI and makes the route accessible.
A. Client Component B. Server Component C. Edge Component D. Static Component
Answer
B. Layouts and pages are Server Components by default.
A. Reading from a database
B. Using a secret API key
C. Handling onClick
D. Generating metadata
Answer
C. Event handlers require a Client Component.
generateStaticParams used for?
A. Creating API routes B. Prebuilding dynamic route params C. Loading browser state D. Defining middleware matchers
Answer
B. It returns params for dynamic routes that should be generated ahead of time.
A. Server Action B. Client Component C. Route Handler D. Template
Answer
C. Webhooks are external HTTP calls and belong in Route Handlers.
12. Scenario Questions
6. A marketing page changes once per week and must be very fast. Which rendering strategy fits?Answer
SSG or ISR. Use SSG if rebuilds are acceptable, ISR if content should refresh after a configured interval or on-demand trigger.
Answer
Dynamic server rendering with server-side auth and workspace checks. Avoid globally caching user-specific data.
Answer
Use Server Components with Suspense/streaming so the shell can render while the slower section loads.
Answer
Move the markdown rendering to a Server Component so the heavy library stays out of the browser bundle.
13. Debugging Questions
10. Production build fails becauseDATABASE_URL is undefined during module import. What is the likely fix?
Answer
Avoid initializing the DB client at module scope. Use lazy initialization inside a function that runs when server code actually needs the client.
Answer
Use loading.tsx for route-level loading, or around the slow child.
Answer
It was probably exposed through a NEXT_PUBLIC_ variable or bundled into a Client Component import path.
14. Interview Questions
13. Explain Server Components in one minute.Answer
Server Components render on the server, can fetch data and access secrets, reduce client JavaScript, and can pass serializable props to Client Components for interactivity.
Answer
Server Actions are server functions for app-owned mutations, often forms. Route Handlers are HTTP endpoints for APIs, webhooks, uploads, or external clients.
Answer
Measure first. Reduce client JavaScript, move static work server-side, optimize images/fonts, use caching or revalidation appropriately, stream slow sections, and inspect build/analyzer output.
15. Debugging Exercise
Bug report: "A preview deployment works, but production uses the wrong public analytics ID."
Solution
Public variables prefixed with NEXT_PUBLIC_ are inlined during build. Confirm the production value existed at build time, or move runtime-specific client config behind a server endpoint.
16. Practice Exercises
17. Scenario-Based Challenge
You are asked to build a docs site with search, metadata, MDX, nested routes, and static generation in 45 minutes. What is your plan?
Walkthrough
Create a content registry, generate static params for docs pages, render content through a catch-all route, build sidebar navigation from metadata, add generateMetadata, and create a lightweight client search enhancement.
18. Quick Quiz
1. What file creates shared UI that persists? Answer: layout.tsx.
2. What directive marks a mutation function? Answer: "use server".
3. What prefix exposes env vars to the browser? Answer: NEXT_PUBLIC_.
4. What component optimizes images? Answer: next/image.
5. What platform auto-detects Next.js projects? Answer: Vercel.
19. Summary & Key Takeaways
20. Cheat Sheet
| Score Pattern | Review |
|---|---|
| Routing misses | Fundamentals and App Router chapters. |
| Rendering misses | Rendering chapter and performance chapter. |
| Component misses | Server and Client Components. |
| Mutation misses | Data Fetching chapter. |
| Production misses | SEO, deployment, and projects. |
21. Further Reading
22. Next Lesson Preview
Next, you will finish with a compact cheatsheet for revision and interview prep.