Loading

Quipoin Menu

Learn • Practice • Grow

express-js / Express.js Advanced Routing
mcq
Direction: Choose the correct option

Q1.

What does app.all() do in Express?
A. It matches all paths
B. It is deprecated
C. It matches all HTTP methods for a specific path
D. It matches only GET requests
Direction: Choose the correct option

Q2.

What is the purpose of express.Router()?
A. To create modular route handlers
B. To parse JSON
C. To serve static files
D. To handle errors
Direction: Choose the correct option

Q3.

How do you mount a router on a specific path?
A. app.get('/path', router)
B. app.router('/path')
C. app.use('/path', router)
D. router.mount('/path', app)
Direction: Choose the correct option

Q4.

Given a router defined as const router = express.Router(); and routes like router.get('/profile'), what will be the full path if mounted with app.use('/users', router)?
A. /users
B. /users/profile
C. /profile
D. /users/profile
Direction: Choose the correct option

Q5.

What is a benefit of using express.Router()?
A. Faster routing
B. Better security
C. Automatic error handling
D. Code organization and modularity