Loading

Quipoin Menu

Learn • Practice • Grow

express-js / Express.js Error Handling
mcq
Direction: Choose the correct option

Q1.

What is the best practice for handling errors in asynchronous route handlers?
A. Log errors and continue
B. Use try/catch and pass errors to next()
C. Ignore errors
D. Use synchronous code only
Direction: Choose the correct option

Q2.

What does the debug module help with in Express?
A. Minifying code
B. Testing routes
C. Logging messages for debugging purposes with namespaces
D. Compiling templates
Direction: Choose the correct option

Q3.

How can you enable debug logs for Express itself?
A. Set NODE_ENV=development
B. Set the DEBUG environment variable to express:*
C. Use express.debug()
D. Use app.enable('debug')
Direction: Choose the correct option

Q4.

What should an error-handling middleware do?
A. Redirect to home
B. Log the error and send a proper response to the client
C. Ignore the error
D. Crash the server
Direction: Choose the correct option

Q5.

Which of the following is a good practice for production error responses?
A. Log errors only
B. Don't leak stack traces to the client
C. Send full error details to the client
D. Always show 500 page