What Next.js Provides Out of the Box
Which statement best describes Next.js for a beginner who wants routing and pre-rendering without manual setup?
- A web framework that adds file-based routing, server-side rendering, and static generation out of the box
- A database engine for storing documents
- A CSS-only toolkit for styling pages
- A browser extension for blocking ads
- A desktop app for image editing
Home Route Mapping with the Pages Directory
In the pages router, which file path renders the home page at the / URL?
- pages/index.js
- pages/home.jsx
- src/home/index.ts
- routes/root.js
- app/main/page.js
Dynamic Routes Syntax (Pages Router)
If you want a page to handle any post ID like /posts/123 using the pages router, which file should you create?
- pages/posts/[id].js
- pages/posts/{id}.js
- pages/posts/(id).js
- pages/posts/[id]/index.css
- pages/[posts]/id.js
Server-Side Rendering at Request Time
Which function runs on the server at request time to fetch data for a page in the pages router?
- getServerSideProps
- getStaticProps
- getInitialStaticProps
- fetchServerProps
- getServerSideProp
Static Generation at Build Time
Which function lets a page fetch data at build time for static generation in the pages router?
- getStaticProps
- getBuildProps
- generateStaticProps
- getStaticProp
- useStaticProps
Creating an API Route
Where should you place a file to create an API endpoint that responds at /api/hello in the pages router?
- pages/api/hello.js
- api/pages/hello.js
- pages/endpoints/hello.js
- server/api/hello.ts
- app/api/hello/page.js
Optimized Images Component
Which built-in component should you use to get automatic image optimization, such as resizing and lazy loading, for a picture located at /public/photo.jpg?
- Image
- Img
- nextImage
- Picture
- OptimizedImg
Client-Side Navigation Component
When building a navigation menu, which component enables client-side navigation between pages without a full reload?
- Link
- Anchor
- Navigate
- RouterLink
- HyperLink
Environment Variables Exposed to the Browser
You need to expose an environment variable to browser code; which prefix must the variable name start with?
- NEXT_PUBLIC_
- PUBLIC_NEXT_
- BROWSER_
- CLIENT_
- PUBLIC_
Link Prefetching Behavior
In production builds, what typically happens when a visible Link points to /about and prefetching is enabled?
- The code for the /about page is prefetched in the background to speed up navigation
- A full page reload immediately navigates to /about
- The entire site is downloaded and cached offline
- The link is disabled until the user double-clicks it
- The server is restarted to compile the /about page