Express.js Multiple Choice Questions


Express.js Multiple Choice Questions

1) Who is credited as the developer of Express.js?
Larry wall
Rich Hickey
TJ Holowaychuk
Rob Pike 



Answer: C is the correct option. TJ Holowaychuk is credited as the developer of Express.js.

2) Which of the following are the core features of the Express framework?
It allows us to set up middleware to respond to HTTP Requests.
It defines a routing table that can work as per HTTP Method and URL.
It is used to render the HTML pages dynamically.
All of the above. 



Answer: D is the correct option. All of the above are the core features of the Express framework.

3) In which of the following year was Express.js initially released?
November 2010
November 2011
December 2010
December 2011 



Answer: A is the correct option. Express.js was initially released in November, 2010.

4) What will be the output of the following code in the console?

File: my_module.js
exports.name = 'Zeus';
Code:
var my_module = require('./mymodule');
console.log((function(settings){
return settings.split('').reverse().join('')
})(my_module.name)); File: my_module.js exports.name = 'Zeus'; Code: var my_module = require('./mymodule'); console.log((function(settings){ return settings.split('').reverse().join('') })(my_module.name));
Error
Zeus
undefined
sueZ 



Answer: A is the correct option. The output of the above code will show an error.

5) What is the way to store local variables that can be accessed within the application?
Using Config file
Using database
Using app.locals
Using app.storage 



Answer: C is the correct option. We can store local variables that can be accessed within the application by using app.locals.

6) In combination with a request method, root paths define the endpoints at which requests can be made. Which of the following are valid forms of route path?
strings
string patterns
regular expressions
All of the above 



Answer: D is the correct option. All of the above are valid forms of the route path.

7) Where are the captured values populated regarding the route parameters?
req.data
app.locals
req.params
All of the above 



Answer: C is the correct option. The captured values are populated at req.params.

8) How is it possible to create chainable route handlers for a route path in Express.js?
Using app.route()
Using app.routes()
Using app.router()
Using app.routing() 



Answer: A is the correct option. By using app.route() method, we can create chainable route handlers for a route path in Express.js.

9) Which of the following function arguments are available to Express.js Route handlers?
req - the request object
res - the response object
next
All of the above 



Answer: D is the correct option. All of the above function arguments are available to Express.js Route handlers.

10) Which of the following is the Scaffolding in Express.js?
Yeoman
Express application generator
Handler functions
Both A & B 



Answer: D is the correct option because both A and B as Yeoman and Express application generator are the Scaffolding in Express.js.

11) In Express.js, the method app.all(path, callback [, callback ...]) can accept all HTTP methods:
True
False
Insufficient data
None of the above 



Answer: A is the correct option because the statement that In Express.js, the method app.all(path, callback [, callback ...]) can accept all HTTP methods is true.

12) Which of the following is a middleware in Express.js?
function(req){ }
method(req){ }
function(req,res,next){ }
method(req,res,next){ } 



Answer: C is the correct option. The function(req,res,next){ } is a middleware in Express.js.

13) Which of the following is the correct statement in the context of Express.js?
Express is a minimal and flexible Node.js web application framework.
Express is a minimal and flexible React.js web application framework.
Express is a minimal and flexible Redux.js web application framework.
Express is a minimal and flexible Angular.js web application framework. 



Answer: A is the correct option. Express is a minimal and flexible Node.js web application framework. It is an open-source framework developed and maintained by the Node.js Foundation and used to provide a robust set of features for web and mobile applications.

14) Which of the following is the correct syntax to use Express.js in Node?
var = require('express')();
var_require('express')();
var app = require('express')();
None of the above. 



Answer: C is the correct answer. The syntax var app = require('express')(); is used to assemble Express.js with Node.

15) What is the meaning of templating in Express.js?
Pug
EJS
Mustache
All of the above. 



Answer: D is the correct answer.

16) To use Mongo with Express.js, we need a client API for node.
TRUE
FALSE
Can be true or false
Cannot say 



Answer: A is the correct answer. To use Mongo with Express, we need a client API for the node.

17) Which of the following facilitates us to create a skeleton for a web application easily?
Authentication
APIs
Debugging
Scaffolding 



Answer: D is the correct option. Scaffolding facilitates us to create a skeleton for a web application easily.

18) Which of the following is a middleware that parses cookies attached to the client request object?
cookie
cookies
cookie-parser
None of the above 



Answer: C is the correct answer. The cookie-parser is a middleware that parses cookies attached to the client request object.

19) The method of using values is called?
filters
interpolation
inheritance
includes 



Answer: B is the correct option. The method of using values is called interpolation.

20) Which of the following command is used to check the current version of NPM?
nmp --ver
npm --version
npm help
None of the above. 



Answer: B is the correct option. The npm --version command is used to check the version of the NPM.

21) In Express.js, the method app.all(path, callback [, callback ...]) is:
True
False
Cannot say 



Answer: A is the correct option.

22) Which of the following method requests that the server accept the data enclosed in the request to modify an existing object identified by the URI?
GET
DELETE
PUT
POST 



Answer: C is the correct option. The PUT method requests that the server accept the data enclosed in the request to modify an existing object identified by the URI. If it does not exist, then the PUT method creates one.

23) Which of the following statement is correct in the case of backlog arguments?
A port number on which the server should accept incoming requests.
The backlog argument is the name of the domain.
The maximum number of queued pending connections.
An asynchronous function is called when the server starts listening for requests. 



Answer: C is the correct answer. The backlog is the maximum number of queued pending connections. The default is 511.

24) Which of the following was the earlier name of the Pug?
Terse
DRY
Express
Jade 



Answer: D is the correct option. Pug was earlier known as Jade. It is a terse language for writing HTML templates.

25) Which of the following function is used to specify what to do when a get request at the given route is called?
app.get(route, callback)
get(route, callback)
js.get(route, callback)
fun.get(route, callback) 



Answer: A is the correct option. The app.get(route, callback) function is used to specify what to do when a get request at the given route is called.

26) Where are the captured values populated regarding route parameters?
app.locals object
req.data object
req.params object
None of the above. 



Answer: C is the correct option. At the req.params object, the captured values are populated regarding route parameters.

27) Cookies are the complex, large files/data sent to the server with a client request and stored on the server-side.
This statement is true.
This statement is false.
Can be true or false
Cannot say. 



Answer: B is the correct answer. The cookies are simple, small files/data sent to the client with a server request and stored on the client-side. So, the statement in the question is false.

28) HTTP is stateless.
This statement is true.
This statement is false.
It can be true or false.
Cannot say. 



Answer: A is the correct option. It is true that HTTP is stateless. To associate a request to any other request, we need to store user data between HTTP requests.



Comments

Popular posts from this blog

Mini-Max Algorithm in Artificial Intelligence

Alpha-Beta Pruning

SQL Multiple Choice Questions