Unlimited Online Free Software Download! Get 100% Free
Hurry up!
Location: Bapunagar
Call: 800 053 0134
Email: info@hitechskillindia.in
Courses
CCC
Accounting
Software Development
Designing
Mobile Development
Digital Marketing
Specialized Courses
Live Project Training
Home
About
Placement Student's
Quiz
CCC Quiz
TallyPrime + GST Quiz
C, C++ Quiz
PHP Quiz
Laravel Quiz
React Quiz
NodeJS Quiz
Python Quiz
Java Quiz
WordPress Quiz
Digital Marketing Quiz
Front-End Quiz
Fullstack PHP Quiz
Fullstack Python Quiz
Fullstack Java Quiz
Fullstack WordPress Quiz
Fullstack NodeJS Quiz
Blog
Contact
E-Brochure
hot
Gallery
Career
We Are Hiring
Test Exam
Increase your skills
Inquiry Now
Home
About Us
Courses
CCC
Accounting
Software Development
hot
Designing
Mobile Development
new
Digital Marketing
Specialized Courses
new
Live Project Training
hot
Placement Student's
Quiz
CCC Quiz
TallyPrime + GST Quiz
C, C++ Quiz
PHP Quiz
Laravel Quiz
React Quiz
NodeJS Quiz
Python Quiz
Java Quiz
WordPress Quiz
Digital Marketing Quiz
Front-End Quiz
Fullstack PHP Quiz
Fullstack Python Quiz
Fullstack Java Quiz
Fullstack WordPress Quiz
Fullstack NodeJS Quiz
Blog
Contact Us
More
New
E-Brochure
hot
Gallery
Career
We Are Hiring
Test Exam
Increase your skills
NODEJS Quiz
Home
Quiz
NODEJS Quiz
Change Course
CCC Quiz
TallyPrime + GST Quiz
C, C++ Quiz
PHP Quiz
Laravel Quiz
React Quiz
NodeJS Quiz
Python Quiz
Java Quiz
WordPress Quiz
Digital Marketing Quiz
Front-End Quiz
Fullstack PHP Quiz
Fullstack Python Quiz
Fullstack Java Quiz
Fullstack WordPress Quiz
Fullstack NodeJS Quiz
Q.
1
Which database is commonly used with Node.js applications?
A.
MongoDB
B.
MySQL
C.
PostgreSQL
D.
All of the above
Correct Answer:
D. All of the above
Q.
2
How do you create a new Express application?
A.
express()
B.
express.create()
C.
express.app()
D.
express.new()
Correct Answer:
A. express()
Q.
3
What is the role of RESTful APIs in backend development?
A.
To create dynamic user interfaces
B.
To handle client-server communication
C.
To manage server hosting
D.
To write database queries
Correct Answer:
B. To handle client-server communication
Q.
4
Which of the following is used to declare a block-scoped variable in ES6?
A.
var
B.
let
C.
const
D.
All of the above
Correct Answer:
B. let
Q.
5
What is a primary responsibility of a backend Node.js developer?
A.
Designing the user interface
B.
Managing server-side logic
C.
Writing CSS
D.
Creating animations
Correct Answer:
B. Managing server-side logic
Q.
6
Which of the following commands is used to install Express.js?
A.
npm install express
B.
npm install -g express
C.
npm get express
D.
npm fetch express
Correct Answer:
A. npm install express
Q.
7
Which of the following is important for a backend Node.js developer to understand?
A.
Database management
B.
Frontend frameworks
C.
CSS preprocessors
D.
Design patterns
Correct Answer:
A. Database management
Q.
8
Which of the following is true about arrow functions in ES6?
A.
They do not have their own this context.
B.
They can be used as constructors.
C.
They are not suitable for methods in objects.
D.
Both a and c
Correct Answer:
D. Both a and c
Q.
9
Which of the following is used to define a route in Express?
A.
app.get()
B.
app.post()
C.
app.put()
D.
All of the above
Correct Answer:
D. All of the above
Q.
10
Which tool is used for version control in Node.js development?
A.
Git
B.
Docker
C.
Jenkins
D.
Kubernetes
Correct Answer:
A. Git
Q.
11
What is the importance of middleware in Express.js applications?
A.
To handle asynchronous tasks
B.
To execute code during the request-response cycle
C.
To manage frontend routing
D.
To compile JavaScript code
Correct Answer:
B. To execute code during the request-response cycle
Q.
12
How do you create a template literal in ES6?
A.
Using single quotes
B.
Using double quotes
C.
Using backticks
D.
Using curly braces
Correct Answer:
C. Using backticks
Q.
13
Which method is used to start an Express server?
A.
app.start()
B.
app.listen()
C.
app.run()
D.
app.open()
Correct Answer:
B. app.listen()
Q.
14
Which of the following is a key skill for a backend Node.js developer?
A.
Proficiency in JavaScript
B.
Knowledge of HTML and CSS
C.
Understanding of graphic design principles
D.
Experience with mobile app development
Correct Answer:
A. Proficiency in JavaScript
Q.
15
What is the purpose of using environment variables in Node.js applications?
A.
To manage configuration settings
B.
To handle HTTP requests
C.
To write database queries
D.
To style the user interface
Correct Answer:
A. To manage configuration settings
Q.
16
What is the default port used by an Express application if no port is specified?
A.
port 3000
B.
port 8080
C.
port 80
D.
port 5000
Correct Answer:
A. port 3000
Q.
17
Which of the following is a testing framework for Node.js?
A.
Mocha
B.
Jasmine
C.
Jest
D.
All of the above
Correct Answer:
D. All of the above
Q.
18
How do you serve static files in Express?
A.
app.use(express.static(’public’))
B.
app.use(’/public’, express.static(’public’))
C.
app.get(express.static(’public’))
D.
Both a and b
Correct Answer:
D. Both a and b
Q.
19
Which feature of ES6 allows you to copy properties from one or more source objects to a target object?
A.
Spread operator
B.
Object.assign
C.
Rest parameter
D.
Both a and b
Correct Answer:
D. Both a and b
Q.
20
Which middleware is used to parse JSON bodies in Express?
A.
bodyParser.json()
B.
express.json()
C.
bodyParser.urlencoded()
D.
express.urlencoded()
Correct Answer:
B. express.json()
Q.
21
What is the use of the dotenv package in Node.js?
A.
To manage environment variables
B.
To connect to databases
C.
To create HTTP servers
D.
To handle authentication
Correct Answer:
A. To manage environment variables
Q.
22
Which of the following is true about default parameters in ES6?
A.
They are assigned when a function is declared.
B.
They are assigned if no argument is passed or if undefined is passed.
C.
They can be changed during the function execution.
D.
They must be the first parameter in the function.
Correct Answer:
B. They are assigned if no argument is passed or if undefined is passed.
Q.
23
Which of the following is a task runner commonly used in Node.js development?
A.
Gulp
B.
Grunt
C.
npm scripts
D.
All of the above
Correct Answer:
D. All of the above
Q.
24
Which method is used to handle 404 errors in Express?
A.
app.use((req, res, next) => { res.status(404).send(’Not Found’); });
B.
app.use((req, res) => { res.status(404).send(’Not Found’); });
C.
app.error((req, res) => { res.status(404).send(’Not Found’); });
D.
app.get((req, res) => { res.status(404).send(’Not Found’); });
Correct Answer:
A. app.use((req, res, next) => { res.status(404).send(’Not Found’); });
Q.
25
How do you secure a Node.js application?
A.
Using HTTPS
B.
Implementing input validation
C.
Using environment variables for sensitive information
D.
All of the above
Correct Answer:
D. All of the above
Q.
26
What is the output of const x = () => ({ y: 1 }); console.log(x());?
A.
Syntax Error
B.
undefined
C.
{ y: 1 }
D.
() => { y: 1 }
Correct Answer:
C. { y: 1 }
Q.
27
How do you define a route parameter in Express?
A.
app.get(’/:id’, (req, res) => { res.send(req.params.id); });
B.
app.get(’/id’, (req, res) => { res.send(req.params.id); });
C.
app.get(’/id/:id’, (req, res) => { res.send(req.params.id); });
D.
app.param(’/:id’, (req, res) => { res.send(req.params.id); });
Correct Answer:
A. app.get(’/:id’, (req, res) => { res.send(req.params.id); });
Q.
28
What is the purpose of the helmet middleware in Express.js?
A.
To secure HTTP headers
B.
To log HTTP requests
C.
To parse JSON bodies
D.
To manage cookies
Correct Answer:
A. To secure HTTP headers
Q.
29
Which of the following allows iteration over the properties of an object?
A.
for...of
B.
for...in
C.
Array.prototype.forEach
D.
Object.entries
Correct Answer:
B. for...in
Q.
30
Which of the following can be used for API documentation in Node.js?
A.
Swagger
B.
Postman
C.
API Blueprint
D.
All of the above
Correct Answer:
D. All of the above
Q.
31
Which method is used to handle POST requests in Express?
A.
app.get()
B.
app.post()
C.
app.put()
D.
app.delete()
Correct Answer:
B. app.post()
Q.
32
What is the importance of unit testing in Node.js development?
A.
To ensure code quality and functionality
B.
To design the user interface
C.
To handle HTTP requests
D.
To write CSS
Correct Answer:
A. To ensure code quality and functionality
Q.
33
What does the following code output? const foo = ’bar’; console.log(${foo} === ’bar’);
A.
true
B.
false
C.
undefined
D.
Syntax Error
Correct Answer:
A. true
Q.
34
How do you redirect a request in Express?
A.
res.redirect()
B.
res.forward()
C.
res.route()
D.
es.sendRedirect()
Correct Answer:
A. res.redirect()
Q.
35
Which of the following is used to handle authentication in Node.js?
A.
Passport
B.
JWT
C.
OAuth
D.
All of the above
Correct Answer:
D. All of the above
Q.
36
Which of the following correctly destructures an object in ES6?
A.
const { a, b } = { a: 1, b: 2 };
B.
const [ a, b ] = { a: 1, b: 2 };
C.
const { a, b } = [ 1, 2 ];
D.
const ( a, b ) = { a: 1, b: 2 };
Correct Answer:
A. const { a, b } = { a: 1, b: 2 };
Q.
37
Which of the following middleware can be used to parse cookies in Express?
A.
cookie-parser
B.
body-parser
C.
express-cookies
D.
cookie-handler
Correct Answer:
A. cookie-parser
Q.
38
What is the purpose of the pm2 package in Node.js?
A.
To manage and monitor Node.js applications
B.
To handle HTTP requests
C.
To compile JavaScript code
D.
To manage database connections
Correct Answer:
A. To manage and monitor Node.js applications
Q.
39
How do you set a response header in Express?
A.
res.setHeader()
B.
res.header()
C.
res.headers()
D.
res.set()
Correct Answer:
D. res.set()
Q.
40
How do you connect to a MongoDB database in a Node.js application?
A.
Using the mongodb package
B.
Using the mongoose package
C.
Using the mongo-client package
D.
Both a and b
Correct Answer:
D. Both a and b
Q.
41
Which ES6 feature allows you to include expressions in strings?
A.
Template literals
B.
Spread operator
C.
Arrow functions
D.
Default parameters
Correct Answer:
A. Template literals
Q.
42
Which of the following is a logging library for Node.js?
A.
Winston
B.
Bunyan
C.
Morgan
D.
All of the above
Correct Answer:
D. All of the above
Q.
43
What is middleware in Express?
A.
Functions that handle requests and responses.
B.
Functions that are executed after the response is sent.
C.
Functions that handle only error requests.
D.
Functions that are executed during application initialization.
Correct Answer:
A. Functions that handle requests and responses.
Q.
44
What will be the output of console.log([..."hello"]); in ES6?
A.
["h", "e", "l", "l", "o"]
B.
["hello"]
C.
"hello"
D.
Syntax Error
Correct Answer:
A. ["h", "e", "l", "l", "o"]
Q.
45
What is the purpose of the cors middleware in Express.js?
A.
To enable Cross-Origin Resource Sharing
B.
To parse URL-encoded bodies
C.
To handle file uploads
D.
To secure HTTP headers
Correct Answer:
A. To enable Cross-Origin Resource Sharing
Q.
46
How do you handle errors in Express?
A.
app.use((err, req, res, next) => { res.status(500).send(’Server Error’); });
B.
app.get((err, req, res, next) => { res.status(500).send(’Server Error’); });
C.
app.error((err, req, res, next) => { res.status(500).send(’Server Error’); });
D.
app.catch((err, req, res, next) => { res.status(500).send(’Server Error’); });
Correct Answer:
A. app.use((err, req, res, next) => { res.status(500).send(’Server Error’); });
Q.
47
How can you export a variable in ES6?
A.
export var myVar;
B.
module.exports = myVar;
C.
export default myVar;
D.
exports.myVar = myVar;
Correct Answer:
C. export default myVar;
Q.
48
Which of the following is true about the next function in Express middleware?
A.
It passes control to the next middleware function.
B.
It is used to handle errors.
C.
It terminates the request-response cycle.
D.
Both a and b
Correct Answer:
D. Both a and b
Q.
49
What is the use of the find method in ES6?
A.
To find the first element in an array that satisfies a given condition.
B.
To find the index of an element in an array.
C.
To find all elements in an array that satisfy a given condition.
D.
To find the last element in an array.
Correct Answer:
A. To find the first element in an array that satisfies a given condition.
Q.
50
How do you handle JSON Web Tokens (JWT) in Express?
A.
Using the express-jwt middleware.
B.
Using the jsonwebtoken library.
C.
Using the jwt-simple library.
D.
All of the above
Correct Answer:
D. All of the above
Q.
51
Which of the following correctly uses the rest parameter?
A.
function sum(...args) { return args.reduce((acc, val) => acc + val, 0); }
B.
function sum(args...) { return args.reduce((acc, val) => acc + val, 0); }
C.
function sum([args...]) { return args.reduce((acc, val) => acc + val, 0); }
D.
function sum(...args[]) { return args.reduce((acc, val) => acc + val, 0); }
Correct Answer:
A. function sum(...args) { return args.reduce((acc, val) => acc + val, 0); }
Q.
52
How do you set up a session in Express?
A.
Using the express-session middleware.
B.
Using the session-handler middleware.
C.
Using the express-cookie middleware.
D.
Using the session-storage middleware.
Correct Answer:
A. Using the express-session middleware.
Q.
53
Which of the following methods is used to merge arrays in ES6?
A.
Array.prototype.concat
B.
Spread operator
C.
Array.prototype.merge
D.
Both a and b
Correct Answer:
D. Both a and b
Q.
54
Which of the following can be used to handle file uploads in Express?
A.
multer
B.
body-parser
C.
formidable
D.
Both a and c
Correct Answer:
D. Both a and c
Q.
55
Which of the following keywords is used to define a constant variable in ES6?
A.
let
B.
const
C.
var
D.
static
Correct Answer:
B. const
Q.
56
What is the use of the res.json method in Express?
A.
To send a JSON response.
B.
To send a text response.
C.
To send an HTML response.
D.
To send an XML response.
Correct Answer:
A. To send a JSON response.
Q.
57
Which command is used to start the MongoDB server?
A.
mongod
B.
mongo
C.
mongodb
D.
mongoserver
Correct Answer:
A. mongod
Q.
58
Which method is used to remove whitespace from both ends of a string in ES6?
A.
String.prototype.trim
B.
String.prototype.strip
C.
String.prototype.slice
D.
String.prototype.clean
Correct Answer:
A. String.prototype.trim
Q.
59
What is the default port number for MongoDB?
A.
27017 number
B.
28017 number
C.
27018 number
D.
28018 number
Correct Answer:
A. 27017 number
Q.
60
Which ES6 feature allows you to copy an array without referencing the original array?
A.
Array.prototype.slice
B.
Spread operator
C.
Array.prototype.map
D.
Array.prototype.forEach
Correct Answer:
B. Spread operator
Q.
61
Which ES6 feature allows defining a property with the same name as the variable?
A.
Property Shorthand
B.
Destructuring
C.
Template literals
D.
Arrow functions
Correct Answer:
A. Property Shorthand
Q.
62
Which of the following is true about Node.js?
A.
It is a server-side framework.
B.
It is built on the V8 JavaScript engine.
C.
It is primarily used for CPU-intensive applications.
D.
It cannot handle asynchronous operations.
Correct Answer:
B. It is built on the V8 JavaScript engine.
Q.
63
Which data format is used to store data in MongoDB?
A.
XML
B.
BSON
C.
JSON
D.
CSV
Correct Answer:
B. BSON
Q.
64
How do you create a new database in MongoDB?
A.
use databaseName
B.
create database databaseName
C.
new database databaseName
D.
db.create(databaseName)
Correct Answer:
A. use databaseName
Q.
65
Which module in Node.js is used for handling file system operations?
A.
fs
B.
http
C.
path
D.
url
Correct Answer:
A. fs
Q.
66
Which of the following is a core module in Node.js?
A.
express
B.
mongodb
C.
http
D.
lodash
Correct Answer:
C. http
Q.
67
How do you insert a document into a collection in MongoDB?
A.
db.collection.insertOne(document)
B.
db.collection.add(document)
C.
db.collection.save(document)
D.
db.collection.create(document)
Correct Answer:
A. db.collection.insertOne(document)
Q.
68
How do you create a server in Node.js using the http module?
A.
http.createServer()
B.
http.createClient()
C.
http.listen()
D.
http.createConnection()
Correct Answer:
A. http.createServer()
Q.
69
Which of the following methods is used to find documents in a MongoDB collection?
A.
db.collection.find()
B.
db.collection.search()
C.
db.collection.query()
D.
db.collection.get()
Correct Answer:
A. db.collection.find()
Q.
70
What does the fs.readFile method do in Node.js?
A.
Reads the content of a file asynchronously.
B.
Reads the content of a file synchronously.
C.
Writes data to a file.
D.
Appends data to a file.
Correct Answer:
A. Reads the content of a file asynchronously.
Q.
71
How do you update a document in MongoDB?
A.
db.collection.updateOne(query, update)
B.
db.collection.modify(query, update)
C.
db.collection.change(query, update)
D.
db.collection.set(query, update)
Correct Answer:
A. db.collection.updateOne(query, update)
Q.
72
How do you install a package using npm?
A.
npm get
B.
npm install
C.
npm add
D.
npm fetch
Correct Answer:
B. npm install
Q.
73
Which of the following is used to delete a document in MongoDB?
A.
db.collection.deleteOne(query)
B.
db.collection.remove(query)
C.
db.collection.drop(query)
D.
db.collection.clear(query)
Correct Answer:
A. db.collection.deleteOne(query)
Q.
74
What is the command to initialize a new Node.js project?
A.
npm init
B.
npm start
C.
npm new
D.
node init
Correct Answer:
A. npm init
Q.
75
What is the use of the ObjectId in MongoDB?
A.
To uniquely identify documents.
B.
To store binary data.
C.
To represent a date and time.
D.
To create indexes.
Correct Answer:
A. To uniquely identify documents.
Q.
76
Which statement is used to import a module in Node.js?
A.
require
B.
import
C.
include
D.
use
Correct Answer:
A. require
Q.
77
Which method is used to count the number of documents in a MongoDB collection?
A.
db.collection.countDocuments()
B.
db.collection.count()
C.
db.collection.size()
D.
db.collection.length()
Correct Answer:
A. db.collection.countDocuments()
Q.
78
What is the default file name for the main module in a Node.js project?
A.
app.js
B.
index.js
C.
main.js
D.
server.js
Correct Answer:
B. index.js
Q.
79
How do you create an index in MongoDB?
A.
db.collection.createIndex(keys, options)
B.
db.collection.addIndex(keys, options)
C.
db.collection.makeIndex(keys, options)
D.
db.collection.setIndex(keys, options)
Correct Answer:
A. db.collection.createIndex(keys, options)
Q.
80
How can you handle exceptions in Node.js?
A.
Using try...catch blocks.
B.
Using error events.
C.
Using process.on(’uncaughtException’, callback).
D.
All of the above
Correct Answer:
D. All of the above
Q.
81
Which of the following is used to create a child process in Node.js?
A.
child_process.spawn
B.
child_process.exec
C.
child_process.fork
D.
All of the above
Correct Answer:
D. All of the above
Q.
82
Which of the following methods is used to aggregate data in MongoDB?
A.
db.collection.aggregate(pipeline)
B.
db.collection.group(pipeline)
C.
db.collection.sum(pipeline)
D.
db.collection.collect(pipeline)
Correct Answer:
A. db.collection.aggregate(pipeline)
Q.
83
What is the purpose of the package.json file in a Node.js project?
A.
To list project dependencies.
B.
To define scripts for automation.
C.
To set project metadata.
D.
All of the above
Correct Answer:
D. All of the above
Q.
84
What is the default storage engine for MongoDB?
A.
WiredTiger
B.
MMAPv1
C.
InnoDB
D.
RocksDB
Correct Answer:
A. WiredTiger
Q.
85
What is the role of the EventEmitter class in Node.js?
A.
To handle HTTP requests.
B.
To manage file system operations.
C.
To facilitate asynchronous event-driven programming.
D.
To manage database connections.
Correct Answer:
C. To facilitate asynchronous event-driven programming.
Q.
86
Which of the following is true about MongoDB?
A.
It is a NoSQL database.
B.
It uses a flexible schema.
C.
It stores data in collections.
D.
All of the above
Correct Answer:
D. All of the above
Q.
87
How do you create a replica set in MongoDB?
A.
rs.initiate()
B.
db.createReplicaSet()
C.
mongo --replicaSet
D.
db.replicaSet.create()
Correct Answer:
A. rs.initiate()
Q.
88
How can you serve static files in Node.js?
A.
Using the express.static middleware.
B.
Using the http.static method.
C.
Using the fs.serveStatic method.
D.
Using the path.serve method.
Correct Answer:
A. Using the express.static middleware.
Q.
89
Which command is used to backup a MongoDB database?
A.
mongodump
B.
mongoexport
C.
mongobackup
D.
mongorestore
Correct Answer:
A. mongodump
Q.
90
Which of the following methods can be used to read a directory in Node.js?
A.
fs.readDirectory
B.
fs.readDir
C.
fs.readdir
D.
fs.listDir
Correct Answer:
C. fs.readdir
Q.
91
How do you restore a MongoDB database from a backup?
A.
mongorestore
B.
mongorecover
C.
mongoload
D.
mongobackup
Correct Answer:
A. mongorestore
Q.
92
How do you set an environment variable in Node.js?
A.
process.setEnv
B.
process.env.VAR_NAME = ’value’
C.
process.setVariable
D.
process.variable.VAR_NAME = ’value’
Correct Answer:
B. process.env.VAR_NAME = ’value’
Q.
93
Which of the following is used to monitor MongoDB performance?
A.
mongotop
B.
mongostat
C.
db.serverStatus()
D.
All of the above
Correct Answer:
D. All of the above
Q.
94
Which of the following methods is used to send a response to the client in a Node.js HTTP server?
A.
res.write
B.
res.send
C.
res.end
D.
Both a and c
Correct Answer:
D. Both a and c
Q.
95
What is sharding in MongoDB?
A.
A method to distribute data across multiple machines.
B.
A method to backup data.
C.
A method to create indexes.
D.
A method to create views.
Correct Answer:
A. A method to distribute data across multiple machines.
Q.
96
Which of the following is true about streams in Node.js?
A.
Streams are used to handle large amounts of data.
B.
Streams are always synchronous.
C.
Streams can be readable, writable, or both.
D.
Both a and c
Correct Answer:
D. Both a and c
Q.
97
How do you check the version of MongoDB?
A.
mongo --version
B.
mongod --version
C.
db.version()
D.
All of the above
Correct Answer:
D. All of the above
Q.
98
Which module in Node.js can be used to create a WebSocket server?
A.
ws
B.
websocket
C.
net
D.
socket
Correct Answer:
A. ws
Q.
99
What is the role of the buffer module in Node.js?
A.
To handle binary data.
B.
To manage HTTP requests.
C.
To handle JSON data.
D.
To manage child processes.
Correct Answer:
A. To handle binary data.