Express.js Multiple-Choice Questions (MCQs)

Express.js, or simply Express, is a back end web application framework for building RESTful APIs with Node.js, released as free and open-source software under the MIT License.

Express.js MCQs: This section contains multiple-choice questions and answers on the various topics of Express.js. Practice these MCQs to test and enhance your skills on Express.js.

List of Express.js MCQs

1. Express.js is a ____ framework?

  1. Node.js
  2. JavaScript
  3. React.js
  4. Angular.js

Answer: A) Node.js

Explanation:

Express.js is a Node.js framework.

Discuss this Question


2. Express.js is written in which of the following language?

  1. Python
  2. Node.js
  3. JavaScript
  4. C++

Answer: C) JavaScript

Explanation:

Express.js is written in JavaScript.

Discuss this Question


3. Among Express.js and Django which is faster?

  1. Django
  2. Express.js

Answer: B) Express.js

Explanation:

Express is significantly quicker than Django.

Discuss this Question


4. Which of the following command is used to install Express in the myapp directory?

  1. $ npm install express
  2. $ npm install --express
  3. $ npm install --express.js

Answer: A) $ npm install express

Explanation:

$ npm install express command is used to install Express in the myapp directory.

Discuss this Question


5. What does the following do, res.send()?

  1. This method specifies what to execute when a get request at the specified route is made
  2. This function binds and waits for connections on the provided host and port
  3. This method accepts an object as input and returns it to the requesting client

Answer: C) This method accepts an object as input and returns it to the requesting client.

Explanation:

res.send(), this method accepts an object as an input and returns it to the requesting client.

Discuss this Question


6. What does the following do, app.listen(port, [host], [backlog], [callback]])?

  1. This method specifies what to execute when a get request at the specified route is made
  2. This function binds and waits for connections on the provided host and port
  3. This method accepts an object as input and returns it to the requesting client

Answer: B) This function binds and waits for connections on the provided host and port.

Explanation:

app.listen(port, [host], [backlog], [callback]]), this function binds and waits for connections on the provided host and port.

Discuss this Question


7. Which of the following method can be used with any of the HTTP verbs: get, set, put, or delete?

  1. app.get(route, callback)
  2. res.send()
  3. app.listen(port, [host], [backlog], [callback]])
  4. app.method(path, handler)

Answer: D) app.method(path, handler)

Explanation:

app.method(path, handler) method can be used with any of the HTTP verbs: get, set, put, or delete.

Discuss this Question


8. In app.method(path, handler) method, which parameter is a call back function that is executed when a matching request type is detected on the appropriate route?

  1. Path
  2. Handler

Answer: B) Handler

Explanation:

Handler is a callback function that is executed when a matching request type is detected on the appropriate route.

Discuss this Question


9. In app.method(path, handler) method, which parameter, is the route at which the request will run?

  1. Path
  2. Handler

Answer: A) Path

Explanation:

Path is the route at which the request will run.

Discuss this Question


10. Express provides a unique method ____ that handles all forms of HTTP methods at a specific route using the same function?

  1. Whole
  2. App
  3. All

Answer: C) All

Explanation:

Express provides a unique method, "all" that handles all forms of HTTP methods at a specific route using the same function.

Discuss this Question


11. Which of the following HTTP method, are used to transmit a limited amount of data, as the data is included in the header?

  1. GET
  2. POST
  3. PUT
  4. DELETE

Answer: A) GET

Explanation:

GET requests are used to transmit a limited amount of data, as the data is included in the header.

Discuss this Question


12. ____ requests are used to transmit a large amount of data, as the data is included in the body of the request?

  1. GET
  2. POST
  3. PUT
  4. DELETE

Answer: B) POST

Explanation:

POST requests are used to transmit a large amount of data, as the data is included in the body of the request.

Discuss this Question


13. ____ is a templating engine for Express?

  1. Oil
  2. Master
  3. Body parser
  4. Pug

Answer: D) Pug

Explanation:

Pug is a templating engine for Express.

Discuss this Question


14. To use Pug with Express do we need to install it first?

  1. Yes
  2. No

Answer: A) Yes

Explanation:

Yes, to use Pug first you need to install it.

Discuss this Question


15. How do you write comments in Pug?

  1. //Hello
  2. **hello
  3. /*hello

Answer: A) //Hello

Explanation:

Pug uses the same syntax as JavaScript(//) for creating comments.

Discuss this Question


16. ____ files are those that clients download directly from the server?

  1. Dynamic
  2. Component
  3. Static

Answer: C) Static

Explanation:

Static files are those that clients download directly from the server.

Discuss this Question


17. ____ are little pieces of information transmitted from a website and kept in the user's web browser when the user visits that page.?

  1. Session
  2. Cookies
  3. Forms

Answer: B) Cookies

Explanation:

Cookies are little pieces of information transmitted from a website and kept in the user's web browser when the user visits that page.

Discuss this Question


18. Which of the following do you need to install to acquire cookie abilities in Express.js?

  1. cookie-parser
  2. Cookie—
  3. Parser_cookie
  4. Use_cookies

Answer: A) cookie-parser

Explanation:

cookie-parser is installed to acquire cookie abilities in Express.js.

Discuss this Question


19. ____ functions are those that interact with the request and response objects (req, res) during the request-response cycle?

  1. Data binding
  2. Routing
  3. Middleware

Answer: C) Middleware

Explanation:

Middleware functions are those that interact with the request and response objects (req, res) during the request-response cycle.

Discuss this Question


20. ____ is the process of constructing the application's skeletal structure?

  1. Binding
  2. Scaffolding
  3. Application
  4. Dynamic Routing

Answer: B) Scaffolding

Explanation:

Scaffolding is the process of constructing the application's skeletal structure.

Discuss this Question


21. Which of the following command will install the Scaffold in express.js?

  1. npm install express-scaffold
  2. npm install expressscaffolding
  3. npm install express__scaffold
  4. npm install expressjs-scaffold

Answer: A) npm install express-scaffold

Explanation:

npm install express-scaffold is the correct command which will install the Scaffold in express.js.

Discuss this Question


22. ____ is the process of comparing the credentials presented to those stored in a database?

  1. Authentication
  2. Authorization

Answer: B) Authorization

Explanation:

Authentication is the process of comparing the credentials presented to those stored in a database.

Discuss this Question


23. What is REST?

  1. Redirect state transfer
  2. Represent state transfer
  3. Representational Transfer State

Answer: C) Representational Transfer State

Explanation:

Representational Transfer State is the full form of REST.

Discuss this Question


24. The ____ allows you to use static template files in your application?

  1. View
  2. View engine
  3. Modals
  4. Template engine

Answer: D) Template engine

Explanation:

The template engine allows you to use static template files in your application.

Discuss this Question


25. ____ is used to handle errors in Express?

  1. Routes
  2. Middleware
  3. Router
  4. Controller

Answer: B) Middleware

Explanation:

Middleware is used to handle errors in Express.

Discuss this Question


26. Debug is ____ by default in express.js?

  1. On
  2. Off

Answer: B) Off

Explanation:

Debug is off by default.

Discuss this Question


27. Which of the following middleware is used for binding the app object with the help of the app.use() method?

  1. Application-level-middleware
  2. Router-level-middleware
  3. User level middleware
  4. Built-in-level middleware

Answer: A) Application-level-middleware

Explanation:

Application-level middleware is used for binding the app object with the help of the app.use() method.

Discuss this Question


28. Which of the following router for binding with a specific Express.Router instance()?

  1. Application-level-middleware
  2. Router-level-middleware
  3. User-level middleware
  4. Built-in-level middleware

Answer: B) Router-level-middleware

Explanation:

Router-level-middleware for binding with a specific Express.Router instance().

Discuss this Question


29. What is CORS in express.js?

  1. Conception origination reserve sharing
  2. Cross-origin reserve sharing
  3. Cross-origin resource sharing

Answer: C) Cross-origin resource sharing

Explanation:

CORS stands for Cross-origin resource sharing.

Discuss this Question


30. Which of the following arguments are available in an Express JS route handler function?

  1. req - the request object
  2. res - the response object
  3. next
  4. All of the above

Answer: D) All of the above

Explanation:

Following arguments are available in an Express JS route handler function:

  • req - the request object
  • res - the response object
  • next

Discuss this Question


31. Routing is provided by default in ____ but not provided in ____?

  1. Node.js and express.js
  2. Express.js and node.js
  3. Node.js and react.js

Answer: B) Express.js and node.js

Explanation:

Routing is provided by default in Express.js but not provided in Node.js.

Discuss this Question


32. ____ is Super-fast, all-natural JSON logger express.js?

  1. Pino logger
  2. Morgan
  3. Minor
  4. Debug logger

Answer: A) Pino logger

Explanation:

Pino is Super-fast, all-natural JSON logger express.js.

Discuss this Question


33. The ____ object is used to handle data sent to the server through string or JSON object?

  1. Response
  2. Request

Answer: B) Request

Explanation:

The request object is used to handle data sent to the server through a string or JSON object.

Discuss this Question


34. The data is returned to the client via the ____ object?

  1. Response
  2. Request

Answer: A) Response

Explanation:

The data is returned to the client via the response object.

Discuss this Question


35. Sessions are saved on the ____ side?

  1. Server
  2. Client

Answer: A) Server

Explanation:

Sessions are saved on the server side.

Discuss this Question


36. Cookies are saved on the ____ side?

  1. Server
  2. Client

Answer: B) Client

Explanation:

Cookies are saved on the client side.

Discuss this Question


37. Which of the following are third-party middleware?

  1. Body-parser
  2. Cookie-parser
  3. Mongoose
  4. Sequelize
  5. All of the above

Answer: E) All of the above

Explanation:

Following are the third-party middleware:

  • Body-parser
  • Cookie-parser
  • Mongoose
  • Sequelize

Discuss this Question


38. HTTP is stateless or stateful?

  1. Stateless
  2. Stateful

Answer: A) Stateless

Explanation:

HTTP is stateless.

Discuss this Question


39. Does Express.js supports both RDBMS and NoSQL DB?

  1. Yes
  2. No

Answer: A) Yes

Explanation:

Yes, Express.js supports both RDBMS and NoSQL DB.

Discuss this Question


40. Which of the following companies are using Express.js?

  1. Twitter
  2. Accenture
  3. Stack
  4. Kevin
  5. All of the above

Answer: E) All of the above

Explanation:

Following companies are using express.js:

  • Twitter
  • Accenture
  • Stack
  • Kevin

Discuss this Question


41. Which of the following are the alternatives of Express.js?

  1. Ember JS
  2. BackboneJS
  3. Vue JS
  4. Knockout JS
  5. All of the above

Answer: E) All of the above

Explanation:

Following are the alternatives of express.js:

  • Ember JS
  • BackboneJS
  • Vue JS
  • Knockout JS

Discuss this Question




Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.