Question 1
What is the purpose of a custom 404 page in Next.js?
To handle API errors globally
To provide a user-friendly message when a URL is not found
To log server errors for debugging
To define React error boundaries
Question 2
Where should you place a custom 404 page file in a Next.js project?
/pages/404.js
/components/404.js
/utils/404.js
/api/404.js
Question 3
In Next.js API routes, why do we use try/catch blocks?
To create a 404 page
To render the homepage
To optimize performance
To prevent server crashes and handle errors gracefully
Question 4
What status code should be returned when a method is not allowed in a Next.js API route?
404
500
405
200
Question 5
What is the role of a React Error Boundary?
To catch errors in asynchronous code like setTimeout
To prevent the entire app from crashing due to errors in child components
To validate API requests
To log server-side errors
Question 6
Which errors cannot be caught by React Error Boundaries?
Errors in child components during render
Errors in lifecycle methods
Errors in event handlers or async code
Errors in constructors
Question 7
In Next.js App Router, which file handles route-specific errors with a fallback UI?
not-found.js
error.js
global-error.js
404.js
Question 8
What does the reset() function do in a Next.js error.js or global-error.js file?
Resets the component tree to attempt recovery
Reloads the API route
Navigates to the homepage
Logs the error in the console
Question 9
What will happen if both counters are wrapped in the same Error Boundary in React?
Only the counter that throws an error will stop rendering
Both counters will crash and fallback UI will display
The app will continue without any fallback
React will automatically retry the counter
Question 10
In Next.js, which file is used specifically to display a custom "Page Not Found" message for missing routes?
error.js
global-error.js
not-found.js
pages/_app.js
There are 10 questions to complete.