Question Bank

1899 approved questions from the community

In Express.js, calling `res.json()` automatically sets the Content-Type header to 'application/json'.

MEDIUM
TRUE FALSE
25s
Express
by Mohamed

The `res.sendFile()` method requires an absolute path to the file.

MEDIUM
TRUE FALSE
25s
Express
by Mohamed

What is the benefit of using `express.Router` for organizing routes?

MEDIUM
SINGLE CHOICE
35s
Express
by Mohamed

How do you chain multiple middleware functions for a specific route?

MEDIUM
SINGLE CHOICE
35s
Express
by Mohamed

Middleware functions can modify both the request and response objects before passing them to the next middleware.

MEDIUM
TRUE FALSE
25s
Express
by Mohamed

URL parameters defined with a colon (like ':id') must exactly match the parameter name used in `req.params`.

MEDIUM
TRUE FALSE
25s
Express
by Mohamed

The `express.static()` middleware is suitable for serving dynamic content generated by your application.

MEDIUM
TRUE FALSE
25s
Express
by Mohamed

Express.js automatically handles CORS without any additional configuration.

MEDIUM
TRUE FALSE
25s
Express
by Mohamed

Router-level middleware can have its own middleware functions separate from the main application.

MEDIUM
TRUE FALSE
25s
Express
by Mohamed

The `express.json()` middleware automatically validates JSON syntax and will reject invalid JSON.

MEDIUM
TRUE FALSE
30s
Express
by Mohamed

GET requests in Express.js can access data through `req.body`.

MEDIUM
TRUE FALSE
25s
Express
by Mohamed

You can use multiple `express.Router` instances in a single Express application.

MEDIUM
TRUE FALSE
25s
Express
by Mohamed

The order in which middleware is defined in Express.js matters for execution.

MEDIUM
TRUE FALSE
25s
Express
by Mohamed

Error-handling middleware must be defined before all other middleware and routes in Express.js.

MEDIUM
TRUE FALSE
25s
Express
by Mohamed

How would you typically handle 404 errors in Express.js?

MEDIUM
SINGLE CHOICE
35s
Express
by Mohamed

What happens if a middleware function doesn't call `next()` and doesn't send a response?

MEDIUM
SINGLE CHOICE
35s
Express
by Mohamed

What is the difference between `req.query` and `req.params` in Express.js?

MEDIUM
SINGLE CHOICE
35s
Express
by Mohamed

Which of the following are recommended practices for Express.js security? (Select all that apply)

MEDIUM
MULTIPLE CHOICE
45s
Express
by Mohamed

Which HTTP status codes indicate client errors? (Select all that apply)

MEDIUM
MULTIPLE CHOICE
40s
Express
by Mohamed

Which of the following are benefits of using Express.js? (Select all that apply)

MEDIUM
MULTIPLE CHOICE
45s
Express
by Mohamed
PreviousPage 30 of 95Next