Online Exam Quiz

questionQuestion  1 to 30

What does res.redirect() do in Express.js?

  • Sends a response with the specified status code
  • Sends a response with the specified content
  • Redirects the request to another URL
  • Terminates the request without sending any response
Mark for review

How do you set a custom header in Express.js?

  • res.set('name', 'value')
  • res.custom('name', 'value')
  • res.header.custom('name', 'value')
  • res.header('name', 'value')
Mark for review

How do you define a middleware function in Express.js?

  • By using the app.use() method
  • By using the app.get() method
  • By specifying middleware in the route handler function
  • By using the app.middleware() method
Mark for review

What is the default port for an Express.js application?

  • 5000
  • 3000
  • 80
  • 8080
Mark for review

How do you install Express.js?

  • fetch express
  • install express
  • npm install express
  • get express
Mark for review

Which method is used to define a route handler in Express.js?

  • app.handle()
  • app.route()
  • app.get()
  • app.use()
Mark for review

How do you define environment variables in Express.js?

  • Using environment module
  • Using config module
  • Using dotenv module
  • Using env module
Mark for review

How can you pass parameters in an Express.js route?

  • Using the query string
  • Using the request body
  • Using route parameters
  • All of the above
Mark for review

How do you handle cluster management in an Express.js application?

  • Using node-cluster middleware
  • Using the cluster module in Node.js
  • Using express-cluster middleware
  • Using app-cluster middleware
Mark for review

How do you send a status code in Express.js?

  • res.status()
  • res.sendCode()
  • res.code()
  • res.httpStatus()
Mark for review

How do you make an Express.js application secure?

  • Using helmet middleware
  • Using secure-middleware
  • Using protect-middleware
  • Using securejs middleware
Mark for review

Which method is used to render a view in Express.js?

  • res.render()
  • res.send()
  • res.json()
  • res.sendFile()
Mark for review

What does res.send() do in Express.js?

  • Sends a response with the specified status code
  • Sends a response with the specified content
  • Redirects the request to another URL
  • Terminates the request without sending any response
Mark for review

Which method is used to handle HTTP DELETE requests in Express.js?

  • app.delete()
  • app.del()
  • app.remove()
  • app.use()
Mark for review

What does res represent in Express.js?

  • Request
  • Render
  • Route
  • Response
Mark for review

How can you access query parameters in Express.js?

  • Using the req.query object
  • Using the req.query object
  • Using the req.body object
  • Using the req.headers object
Mark for review

Which HTTP method is NOT supported by Express.js?

  • GET
  • TRACE
  • DELETE
  • POST
Mark for review

Which module is used to create a server in Express.js?

  • http
  • express
  • fs
  • path
Mark for review

How do you access route parameters in Express.js?

  • req.route
  • req.body
  • req.query
  • req.params
Mark for review

Which template engine is commonly used with Express.js?

  • Pug
  • Handlebars
  • EJS
  • All of the above
Mark for review

What is the purpose of the express.Router() method in Express.js?

  • To define middleware functions
  • To create modular route handlers
  • To handle static files
  • To render views
Mark for review

How do you handle multipart/form-data in Express.js?

  • Using form-data middleware
  • Using multer middleware
  • Using body-parser middleware
  • Using express-body middleware
Mark for review

How do you render a template in Express.js?

  • res.template()
  • res.view()
  • res.render()
  • res.page()
Mark for review

How do you set a view engine in Express.js?

  • app.set('view engine', 'pug')
  • app.render('view engine', 'pug')
  • app.engine('view', 'pug')
  • app.use('view engine', 'pug')
Mark for review

What is the use of res.json() in Express.js?

  • To render a view
  • To send a file
  • To redirect to another URL
  • To send a JSON response
Mark for review

How do you install Express.js in a Node.js project?

  • Using npm install express
  • Using npm install express-generator
  • Using npm install -g express
  • Using npm install express --save
Mark for review

Which method is used to parse JSON bodies in Express.js?

  • express.urlencoded()
  • express.body()
  • express.parse()
  • express.json()
Mark for review

What is Express.js?

  • A front-end framework
  • A database management system
  • A CSS library
  • A web framework for Node.js
Mark for review

What is the purpose of the express.urlencoded() middleware?

  • To parse JSON data in request bodies
  • To parse URL-encoded data in request bodies
  • To serve static files
  • To render views
Mark for review

Which of the following is true about route parameters in Express.js?

  • They are optional in route definitions.
  • They are accessed using the query object.
  • They are enclosed in curly braces {} in route
  • They are used only for POST requests
Mark for review

blinkerOnline

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • Answered
  • Not Answered
  • Marked for Review