Loading

Quipoin Menu

Learn • Practice • Grow

express-js / Express.js Route Parameters
mcq
Direction: Choose the correct option

Q1.

How do you define a route parameter in Express?
A. /users/<id>
B. /users/{id}
C. /users/:id
D. /users/[id]
Direction: Choose the correct option

Q2.

How can you access a route parameter named 'userId' in a request handler?
A. req.param.userId
B. req.body.userId
C. req.query.userId
D. req.params.userId
Direction: Choose the correct option

Q3.

What will req.query contain?
A. Request body
B. Route parameters
C. Headers
D. Query string parameters (after ? in URL)
Direction: Choose the correct option

Q4.

Given the URL /products/5/reviews?sort=desc, how do you access the product ID and sort option?
A. req.params.productId and req.query.sort
B. req.body.id and req.params.sort
C. req.query.id and req.params.sort
D. req.params.id and req.query.sort
Direction: Choose the correct option

Q5.

What is the data type of route parameters?
A. Array
B. Number
C. String
D. Object