Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.
Next.js is a React framework for building full-stack web applications.
Question 2 of 60 · Introduction to Next.js · Easy
Which programming library is the foundation of Next.js?
Not quite. Try another option.
Answer: React
Next.js extends React with features such as routing, rendering, and server-side capabilities.
Question 3 of 60 · Features of Next.js · Easy
Which feature can Next.js use to generate HTML on the server for each request?
Not quite. Try another option.
Answer: Server-side rendering
Server-side rendering generates a page's HTML on the server before sending it to the browser.
Question 4 of 60 · Features of Next.js · Easy
Which Next.js component provides automatic image optimization?
Not quite. Try another option.
Answer: <Image>
The Next.js <Image> component provides features such as image resizing and optimization.
Question 5 of 60 · Project Structure · Easy
Which directory commonly contains routes when using the Next.js App Router?
Not quite. Try another option.
Answer: app
The App Router uses folders and files inside the app directory to define routes.
Question 6 of 60 · Project Structure · Easy
What is the main purpose of the public directory in a Next.js project?
Not quite. Try another option.
Answer: To store static assets
The public directory stores static files such as images, icons, and fonts.
Question 7 of 60 · App Router · Easy
Which file normally defines the UI for a route in the App Router?
Not quite. Try another option.
Answer: page.js
A page.js file exports the UI displayed for its route segment.
Question 8 of 60 · App Router · Easy
In the App Router, what does each folder inside the app directory usually represent?
Not quite. Try another option.
Answer: A route segment
Folders inside app define route segments that form URL paths.
Question 9 of 60 · Development Workflow · Easy
Which command commonly starts a Next.js development server?
Not quite. Try another option.
Answer: npm run dev
npm run dev starts the development server with features such as automatic page refresh.
Question 10 of 60 · Development Workflow · Easy
What usually happens when a developer saves a file while the Next.js development server is running?
Not quite. Try another option.
Answer: The browser reflects the update
Next.js development tools usually refresh the application so saved changes appear quickly.
Question 11 of 60 · File-based Routing · Easy
What determines a URL path in Next.js file-based routing?
Not quite. Try another option.
Answer: The folder and file structure
Next.js creates routes from the organization of route folders and special files.
Question 12 of 60 · File-based Routing · Easy
Which file path creates the /about route with the App Router?
Not quite. Try another option.
Answer: app/about/page.js
The about folder defines the /about segment, and its page.js file provides the page.
Question 13 of 60 · Dynamic Routes · Easy
Which folder name defines a dynamic id route segment?
Not quite. Try another option.
Answer: [id]
Square brackets mark dynamic segments, so [id] can match values such as 12 or abc.
Question 14 of 60 · Dynamic Routes · Easy
What can the route app/products/[id]/page.js match?
Not quite. Try another option.
Answer: /products/42
The [id] segment accepts a value such as 42 after /products/.
Question 15 of 60 · Nested Routes · Easy
Which folder structure creates the nested route /dashboard/settings?
Not quite. Try another option.
Answer: app/dashboard/settings/page.js
Nested folders produce nested URL segments in the same order.
Question 16 of 60 · Layouts · Easy
What is a layout mainly used for in the Next.js App Router?
Not quite. Try another option.
Answer: Sharing UI across pages
Layouts provide shared UI, such as headers or sidebars, for pages within a route segment.
Question 17 of 60 · Layouts · Easy
Which file defines a layout in the App Router?
Not quite. Try another option.
Answer: layout.js
A layout.js file defines shared UI that wraps pages and nested route content.
Question 18 of 60 · Navigation · Easy
Which Next.js component is commonly used for client-side navigation between pages?
Not quite. Try another option.
Answer: Link
The Link component enables navigation between routes without a full page reload.
Question 19 of 60 · Error and Loading UI · Easy
Which special file displays a loading state for a route segment?
Not quite. Try another option.
Answer: loading.js
The loading.js file provides fallback UI while route content is loading.
Question 20 of 60 · Error and Loading UI · Easy
Which special file provides an error boundary UI for a route segment?
Not quite. Try another option.
Answer: error.js
The error.js file displays fallback UI when an error occurs within its route segment.
Question 21 of 60 · Introduction to Next.js · Medium
A team wants to build a React application with server rendering, routing, and production build optimization without configuring each capability separately. Why is Next.js suitable for this project?
Not quite. Try another option.
Answer: It provides an integrated framework for common React application requirements
Next.js extends React with integrated capabilities such as routing, server rendering, data fetching, and build optimization.
Question 22 of 60 · Features of Next.js · Medium
A product page must display current inventory when requested while keeping most rendering work on the server. Which Next.js capability best supports this requirement?
Not quite. Try another option.
Answer: Server-side rendering with Server Components
Server Components can fetch current data and render it on the server, reducing the amount of client-side JavaScript required.
Question 23 of 60 · Project Structure · Medium
In an App Router project, which structure creates a home page and a shared root layout?
Not quite. Try another option.
Answer: app/page.js and app/layout.js
Within the app directory, page.js defines the route UI and layout.js defines shared layout UI. The root layout wraps the application.
Question 24 of 60 · App Router · Medium
A component under the app directory uses useState and handles a button click. What must be added to the component file?
Not quite. Try another option.
Answer: The "use client" directive
State, event handlers, and browser APIs require a Client Component, which is declared by placing "use client" at the top of the file.
Question 25 of 60 · Development Workflow · Medium
After creating a Next.js project, a developer runs npm run dev and edits app/page.js. What behavior should normally occur?
Not quite. Try another option.
Answer: The development page updates without a production rebuild
The development server supports fast refresh, so saved component changes are usually reflected while preserving rapid feedback.
Question 26 of 60 · File-based Routing · Medium
A developer creates app/contact/page.js. Which URL renders that page?
Not quite. Try another option.
Answer: /contact
Folder names inside app define URL segments, while page.js makes the corresponding segment publicly accessible.
Question 27 of 60 · Dynamic Routes · Medium
A store needs product URLs such as /products/42 and /products/105. Which file path should define the product page?
Not quite. Try another option.
Answer: app/products/[id]/page.js
Square brackets define a dynamic route segment. The selected value is available through the id route parameter.
Question 28 of 60 · Dynamic Routes · Medium
Given app/blog/[slug]/page.js, which value should params.slug contain when a user visits /blog/next-routing?
Not quite. Try another option.
Answer: next-routing
The [slug] segment captures only the matching portion of the URL, so the slug value is next-routing.
Question 29 of 60 · Dynamic Routes · Medium
A documentation site must match /docs/setup as well as /docs/setup/windows. Which route definition captures one or more segments after /docs?
Not quite. Try another option.
Answer: app/docs/[...parts]/page.js
A catch-all segment written as [...parts] captures one or more URL segments and provides them as an array.
Question 30 of 60 · Nested Routes · Medium
A dashboard needs a settings page at /dashboard/settings. Which directory structure maps directly to that URL?
Not quite. Try another option.
Answer: app/dashboard/settings/page.js
Each folder contributes a URL segment, so nesting settings inside dashboard creates /dashboard/settings.
Question 31 of 60 · Nested Routes · Medium
A team places an admin page at app/(internal)/admin/page.js. What URL should expose the page?
Not quite. Try another option.
Answer: /admin
Parentheses define a route group. Route groups organize files and layouts without adding their names to the URL.
Question 32 of 60 · Layouts · Medium
A navigation sidebar should persist while users move between /dashboard/reports and /dashboard/settings. Where should the sidebar usually be defined?
Not quite. Try another option.
Answer: app/dashboard/layout.js
A layout in the dashboard segment wraps its descendant routes and can preserve shared UI such as a sidebar during navigation.
Question 33 of 60 · Layouts · Medium
What must a root layout component include so that route content can appear inside its shared HTML structure?
Not quite. Try another option.
Answer: A children prop rendered in the body
Layouts receive route content through children. The root layout also defines the required html and body elements.
Question 34 of 60 · Navigation · Medium
A header links to /dashboard and should use client-side navigation with Next.js prefetching support. Which implementation is most appropriate?
Not quite. Try another option.
Answer: <Link href="/dashboard">Dashboard</Link>
The Next.js Link component supports client-side transitions and can prefetch linked routes when appropriate.
Question 35 of 60 · Navigation · Medium
A Client Component must redirect to /checkout only after a form is successfully submitted. Which App Router API is appropriate?
Not quite. Try another option.
Answer: useRouter().push("/checkout")
useRouter from next/navigation provides programmatic navigation methods such as push for Client Components.
Question 36 of 60 · Navigation · Medium
A Client Component highlights a menu item when its URL matches the current route. Which hook should it use to read the current pathname?
Not quite. Try another option.
Answer: usePathname
usePathname returns the current URL pathname, making it suitable for active navigation styling.
Question 37 of 60 · Error and Loading UI · Medium
A route segment performs slow data fetching. Which file provides an immediate fallback while that segment's content is loading?
Not quite. Try another option.
Answer: loading.js
A segment-level loading.js supplies loading UI and is automatically integrated with React Suspense for that route segment.
Question 38 of 60 · Error and Loading UI · Medium
A dashboard route needs to catch rendering errors in its segment and offer a retry button. Which setup is appropriate?
Not quite. Try another option.
Answer: Create app/dashboard/error.js as a Client Component and call reset()
error.js defines a route-segment error boundary. It must be a Client Component and receives reset, which can attempt to render the segment again.
Question 39 of 60 · Project Structure · Medium
A component is reused by several routes but should not create a URL of its own. Where can it be placed within an App Router project?
Not quite. Try another option.
Answer: In a private folder such as app/_components
A folder prefixed with an underscore is treated as private routing implementation detail, making it useful for colocated components that should not become routes.
Question 40 of 60 · Features of Next.js · Medium
A page displays an image whose dimensions vary across devices, and the team wants built-in resizing and lazy loading. Which Next.js feature should be used?
Not quite. Try another option.
Answer: The Image component from next/image
The Next.js Image component provides image optimization features such as responsive sizing, lazy loading, and reduced layout shift.
Question 41 of 60 · Introduction to Next.js · Hard
A team is migrating a React single-page application to Next.js. One page must read directly from a database, keep credentials off the browser bundle, and send rendered HTML without creating a separate REST endpoint. Which Next.js design best satisfies these requirements?
Not quite. Try another option.
Answer: Query the database directly from an async Server Component
Server Components execute on the server, can access server-only resources, and can render fetched data without exposing credentials or requiring a separate client-facing API endpoint.
Question 42 of 60 · Features of Next.js · Hard
An App Router page contains a large data-access library and a small interactive counter. Which component boundary most effectively minimizes client-side JavaScript while preserving interactivity?
Not quite. Try another option.
Answer: Keep the page server-rendered and isolate the counter in a Client Component
Keeping data access in a Server Component prevents its dependencies from entering the client bundle. Only the interactive counter needs the "use client" boundary.
Question 43 of 60 · Project Structure · Hard
A project uses src/app/page.tsx, src/components/Nav.tsx, and public/logo.svg. Which reference correctly renders the logo regardless of the source file's depth?
Not quite. Try another option.
Answer: <img src="/logo.svg" alt="Logo" />
Files in public are served from the site's root. The directory name public is therefore omitted from the URL.
Question 44 of 60 · Project Structure · Hard
A repository accidentally contains both app/page.tsx and src/app/page.tsx, while configuration files remain at the repository root. What is the correct architectural conclusion?
Not quite. Try another option.
Answer: Only one application directory location should be used for the route tree
The route tree should live in either the root app directory or src/app, not be split across both. Root-level configuration and public remain outside src.
Question 45 of 60 · App Router · Hard
A Server Component needs to render an interactive search box that uses state and browser event handlers. Which composition is valid under the App Router?
Not quite. Try another option.
Answer: Move the search box into a file beginning with "use client"
State and browser event handlers require a Client Component. A server-rendered parent can import and render that client boundary.
Question 46 of 60 · App Router · Hard
A developer adds "use client" to app/dashboard/layout.tsx and imports several utility modules from it. What is the most important consequence?
Not quite. Try another option.
Answer: Its imported component graph enters the client module boundary
The "use client" directive establishes a client boundary for that module and its imports. This can increase client JavaScript, although Server Components may still be passed as rendered children.
Question 47 of 60 · Development Workflow · Hard
During next dev, editing a component sometimes preserves its local state and sometimes remounts it. Which statement best describes the expected behavior?
Not quite. Try another option.
Answer: Fast Refresh attempts preservation but remounts when it cannot do so safely
Fast Refresh preserves local state when the component's identity and edit shape permit it. Certain edits, errors, or dependency changes require a remount.
Question 48 of 60 · Development Workflow · Hard
A route works under next dev but fails only when preparing a production deployment. Which command sequence most directly tests the production compilation and runtime behavior locally?
Not quite. Try another option.
Answer: next build followed by next start
next build performs production compilation and validation, while next start serves the resulting production build.
Question 49 of 60 · File-based Routing · Hard
Given app/page.tsx, app/about/page.tsx, app/about/team.tsx, and app/contact/layout.tsx, which URL set is directly routable from these files?
Not quite. Try another option.
Answer: Only / and /about
A route becomes publicly accessible when its segment has a page file. team.tsx is not a special route file, and a segment containing only layout.tsx does not create a page.
Question 50 of 60 · File-based Routing · Hard
A project contains app/(marketing)/about/page.tsx. What public URL is produced, assuming no conflicting route exists?
Not quite. Try another option.
Answer: /about
Parenthesized route groups organize routes and layouts without contributing a segment to the public URL.
Question 51 of 60 · Dynamic Routes · Hard
A segment contains both app/blog/[slug]/page.tsx and app/blog/archive/page.tsx. Which component handles a request for /blog/archive?
Not quite. Try another option.
Answer: The archive page because static segments have precedence
A matching static route is more specific than a dynamic segment, so /blog/archive resolves to the static archive page.
Question 52 of 60 · Dynamic Routes · Hard
For a route defined as app/docs/[[...parts]]/page.tsx, which request can match with parts absent rather than containing one or more strings?
Not quite. Try another option.
Answer: /docs
An optional catch-all segment matches its parent path with no captured parts. Longer paths produce an array such as ["api", "auth"].
Question 53 of 60 · Dynamic Routes · Hard
A developer wants /shop to show the shop index while /shop/a/b captures a and b in one route parameter. Which route structure supports both without a separate /shop page?
Not quite. Try another option.
Answer: app/shop/[[...slug]]/page.tsx
An optional catch-all route matches both the parent path /shop and deeper paths, while a non-optional catch-all requires at least one captured segment.
Question 54 of 60 · Nested Routes · Hard
Given app/dashboard/settings/profile/page.tsx, which directories may define layouts that naturally wrap the profile page without changing its URL?
Not quite. Try another option.
Answer: app, dashboard, settings, and profile segments
Layouts can be defined at each segment from the root through the leaf segment, and applicable layouts nest around the page according to the route hierarchy.
Question 55 of 60 · Nested Routes · Hard
Two teams create app/(store)/products/page.tsx and app/(catalog)/products/page.tsx. Why is this structure invalid?
Not quite. Try another option.
Answer: Both files resolve to the same public route /products
Route-group names are omitted from URLs. Both page files therefore claim /products, creating a conflicting route.
Question 56 of 60 · Layouts · Hard
A shared dashboard layout fetches user data and renders a sidebar. When navigating between /dashboard/analytics and /dashboard/settings with Next.js navigation, which behavior should the developer design for?
Not quite. Try another option.
Answer: The shared layout is preserved while the changing child segment updates
Layouts are shared across their descendant routes and preserve their mounted UI during client-side navigation between those descendants.
Question 57 of 60 · Layouts · Hard
An App Router application defines its required root layout in app/layout.tsx. Which output is the root layout responsible for providing?
Not quite. Try another option.
Answer: The <html> and <body> elements around its children
The root layout replaces the document wrapper conventions used elsewhere and must define the document's <html> and <body> elements.
Question 58 of 60 · Navigation · Hard
A Client Component handles a successful form interaction and must navigate programmatically to /account without a full document reload. Which API is appropriate?
Not quite. Try another option.
Answer: useRouter from next/navigation, followed by router.push("/account")
App Router Client Components use useRouter from next/navigation. Its push method performs client-side programmatic navigation.
Question 59 of 60 · Navigation · Hard
A page renders <Link href="/reports">Reports</Link>, but /reports has a slow server-rendered subtree. Which statement best captures why navigation may still feel faster than using a plain <a> element?
Not quite. Try another option.
Answer: Link may prefetch route data and performs client-side transitions
Link integrates with the Next.js router, enabling prefetching when applicable and avoiding a full-page browser navigation.
Question 60 of 60 · Error and Loading UI · Hard
A route segment contains page.tsx, loading.tsx, and error.tsx. The page suspends while fetching and later throws during rendering. Which behavior matches the App Router's segment boundaries?
Not quite. Try another option.
Answer: loading.tsx can provide fallback UI, then error.tsx can handle the failure
loading.tsx supplies Suspense-based pending UI, while error.tsx defines an error boundary for failures in the applicable route subtree.
That's unit 1
Answer a few questions and your score shows up here.
Nearly through. Did unit 1 of INT257 save you a night before the exam?
LPU Notes is free. A student pays for the servers.
Did unit 1 of INT257 save you a night before the exam?
Then you can help keep it free for the next batch. Ads cover part of the server bill;
the rest comes out of a student's own pocket: the domain, the storage, and keeping
the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason.
to try again.