Loading

Quipoin Menu

Learn • Practice • Grow

express-js / Express.js Middleware Explained
mcq
Direction: Choose the correct option

Q1.

What is middleware in Express.js?
A. A database connection library
B. A function that has access to the request and response objects
C. A routing method
D. A template engine
Direction: Choose the correct option

Q2.

Which arguments are passed to a standard middleware function?
A. req, next, next
B. req, res
C. err, req, res, next
D. req, res, next
Direction: Choose the correct option

Q3.

What does the next() function do in middleware?
A. It throws an error
B. It sends a response
C. It passes control to the next middleware or route handler
D. It ends the request-response cycle
Direction: Choose the correct option

Q4.

If a middleware does not call next() or send a response, what happens?
A. The server crashes
B. The request hangs and times out
C. An error is thrown
D. The next middleware is called automatically
Direction: Choose the correct option

Q5.

Which of the following is an example of built-in middleware in Express 4.x?
A. express.logger()
B. express.bodyParser()
C. express.session()
D. express.json()