Font size
WorksheetsNode-JS-Test
Total questions: 131
Worksheet time: 1hrs 5mins
Which programming language is the Google V8 Engine designed for?
Java
JavaScript
Python
R
Which JavaScript library is used to create Desktop apps in Node.js?
React.js
React Native
Electron.js
Express.js
Which JavaScript library is used to create Progressive Web apps in Node.js?
React.js
React Native
Electron.js
Express.js
Node.js is a Closed-source Technology. True or False?
True
False
JavaScript used which of the following I/O model?
Non-Blocking I/O Model
Blocking I/O Model
None.
Node.js is ____________Threaded language
Single
Multi
Dual
Which of the following command is used to run a node.js program?
node run main.js
node start main.js
start main.js
node main.js
Which of the following code will print "Hello" on the output screen?
print("Hello");
console.log(Hello);
console.log("Hello");
printf("%s","Hello");
________ is a back end web application framework for Node.js, it is fast, unopinionated and minimalist framework.
Emotional.js
Express.js
Nodemon
Doraemon
What is the right syntax for importing a module?
require()
function()
import()
module.import()
What JavaScript Engine is used by Google Chrome?
Y8
Adobe Flash Player
Friv
V8
Which of the module used for Buffer
node module
No module required for Buffer
npm i buffer
node main.js
Which of the following core module is used for file system operations in Node.js?
A) http
B) fs
C) path
D) querystring
D) querystring
Which of the following is NOT a core module in Node.js?
A) http
B) fs
C) express
D) os
To listen for connections, what function would you use?
app.listen
app.serve
app.connect
app.start
Which of the following methods is used to create a server in Node.js?
A) createServer()
B) startServer()
C) initServer()
D) runServer()
What is the purpose of the npm command in Node.js?
A) To manage global Node.js installations
B) To create a new Node.js project
C) To install and manage packages/modules for a Node.js project
D) To execute JavaScript code directly from the command line
Which is the most famous backend technology which is based on JavaScript?
Springboot
Flask
Django
________ is a back end web application framework for Node.js, it is fast, unopinionated and minimalist framework.
Emotional.js
Express.js
Nodemon
Doraemon
What module provides utilities for working with file and directory paths?
OS Module
Path Module
FS Module
HTTP Module
________ are the blocks of encapsulated code that communicates with an external application on the basis of their related functionality.
Application
Code
Dependencies
Modules
What module provides information about the computer's operating system?
OS Module
Path Module
FS Module
HTTP Module
What is the right syntax for importing a module?
require()
function()
import()
module.import()
_____is used to raise the event.
myEmitter.emitter()
myEmtter.emit()
myEmitter.event()
myEmitter.emitEvent()
Which of the following is correct syntax?
fs.writeFile("filename", data, callback);
fs.writeFile(data ,"filename", callback);
fs.writeFile(callback, data, "filename");
None
Which of the following is correct?
fs.unlink(path)
fs.unlinkSync(path)
fs.delete(path)
fs.deleteSync(path)
To check if a file exists, use
fs.accessFile()
fs.access()
Both
None
Which of the following asynchronously append data to a file
fs.append(path, data[, options])
fs.appendFile(path, data[, options])
fs.append(path, data[, options], callback)
fs.appendFile(path, data[, options], callback)
What is the advantage of using node.js?
Great concurrency
Generally fast
It provides an easy way to build scalable network programs
All of these
Which of the following areas, Node.js is not advised to be used?
Single Page Applications
JSON APIs based Applications
CPU intensive applications
Data Intensive Realtime Applications (DIRT)
3. Which of the following is an IF statement in JavaScript?
if i = 5
if i = 5 then
if (i == 5)
All of these
What will be the output of following code snippet?
JSON.stringify({ message: "Hello World"});
{message:Hello World}{message:Hello World}
{‘message’:’Hello World’}
{"message":"Hello World"}
None
What is a runtime environment?
.An environment in which a program or application is executed
An environment where files can be saved
A Virtual Machine where other operating systems can run
Can we execute JavaScript code outside a web browser?
Yes sure
No, because it’s a programming language used to develop Front-end and Back-end applications on the browser
Not sure
JavaScript used which of the following I/O model?
Non-Blocking I/O Model
Blocking I/O Model
None.
Who made node.js?
Hampton Catlin
Ryan Dahl
Isaac Z. Schlueter
GitHub
When did Ryan Dahl authored Node.js?
2007
2008
2009
2010
What will be the output
var num = 10
console.log(num + 10)
20
83
None of these
Hello!
JSON was a native construct of which language?
PHP
Java
Ruby On Rails
Javascript
How can you see all the dependencies for a Node.js app?
All the dependencies are listed down in the package.json file
By executing "npm i" and capturing the dependencies list
You can't have dependencies in a Node.js app
All the dependencies are listed down in the package-dependencies.json file
Which is the correct syntax for Arrow Function?
->
<--!
=>
function arrow()
________ are the blocks of encapsulated code that communicates with an external application on the basis of their related functionality.
Application
Code
Dependencies
Modules
In web development, what is a framework?
A tool we use to design GUIs (Graphical user interfaces)
A cloud tool used to host websites
A place for developers to collaborate and work asynchronously
A software designed to support the development of web applications including web services, web resources, and web APIs
What will be the output
var num = 10
console.log(num + 10)
20
83
None of these
Hello!
To connect Mongo dB Database from NodeJS which middleware we require?
Body-parser
Mongoose
Express
None of these
What are core features of Express framework?
Allows to set up middle-ware to respond to HTTP Requests
Defines a routing table which can works as per HTTP Method and URL
Dynamically render HTML Pages
All of the above
Which of the following is a NoSQL Database Type ?
SQL
Document databases
JSON
All of the mentioned
What is Callback
It is a technique in which a function is executed after executing the calling function
Only calls a specific function
Node of these
NodeJS uses an event-driven, non-blocking I/O model
True
False
What HTTP method is typically used for retrieving data from a server?
GET
DELETE
PUT
POST
How can you handle errors in a REST API client in Node.js?
Use try-catch blocks, error handling middleware, and return proper HTTP status codes.
Return random HTTP status codes for errors
Ignore errors and continue with the API calls
Use Python instead of Node.js for error handling
What is the purpose of authentication in REST API clients?
To allow unauthorized access to resources
To decrease API security
To increase server load
To verify the identity of the client making requests and ensure only authorized users can access the API resources.
How can you pass request parameters in a REST API client using axios?
{ method: 'GET', url: 'https://api.example.com/data', params: { key1: 'value1', key2: 'value2' } }
method: 'POST', url: 'https://api.example.com/data'
params: {key1: 'value1', key2: 'value2'}
headers: {Authorization: 'Bearer token'}
What is the role of response handling in a REST API client?
Response handling in a REST API client is not important for error checking
Response handling in a REST API client involves sending data to the server
The role of response handling in a REST API client is to process the data received from the server, including parsing the response, checking for errors, and extracting relevant information for further use.
Response handling in a REST API client is only necessary for POST requests
Which library is commonly used for making HTTP requests in Node.js?
superagent
fetch
axios
requestify
What is the purpose of node-fetch in a REST API client?
To format data in a REST API client
To handle user authentication in a REST API client
To make HTTP requests in a REST API client.
To generate random data in a REST API client
Which HTTP method is used for updating data on a server?
POST
PUT
DELETE
GET
How can you implement error handling in a node-fetch based REST API client?
Use if-else statements to handle errors in fetch requests
Ignore errors and proceed with the API client operations
Implement a custom error handling module separate from the fetch requests
Use try-catch blocks to catch errors during fetch requests and handle them accordingly.
Why is authentication important in REST API clients?
Authentication can slow down the client-server communication
Authentication is not important in REST API clients
Authentication helps in verifying the identity of the client making the request and protects against unauthorized access.
Authentication increases the risk of security breaches
What are query parameters and how are they used in REST API clients?
Query parameters are used to define the HTTP method in REST API clients
Query parameters are added to the URL before the base endpoint in REST API clients
Query parameters are added to the request body in REST API clients
Query parameters are added to the URL after a '?' symbol, with each parameter separated by '&'. For example, in the URL 'https://api.example.com/users?status=active&page=1', 'status' and 'page' are query parameters.
How can you access the response data in an axios request?
response.content
response.data
response.json
response.text
What are the advantages of using axios for making HTTP requests?
Axios does not support JSON data transformation
Axios provides a simple and powerful way to make HTTP requests with additional features like interceptors, automatic JSON data transformation, and support for both browser and Node.js environments.
Axios can only be used in Node.js environment
Axios is slower than other HTTP request libraries
What are the disadvantages of using node-fetch for HTTP requests?
Node-fetch is not compatible with all operating systems
Node-fetch lacks support for streaming responses, handling cookies, and automatic response body parsing.
Node-fetch has built-in security vulnerabilities
Node-fetch does not provide error handling capabilities
When should you use POST method in a REST API client?
When you want to create a new resource on the server.
When you want to perform a read-only operation on the server.
When you want to retrieve data from the server.
When you want to update an existing resource on the server.
How can you handle authentication tokens in a REST API client?
Store the authentication token in a plain text file on the client machine
Embed the authentication token directly in the URL parameters of the HTTP request
Send the authentication token in the request body as a JSON payload
Include the authentication token in the Authorization header of the HTTP request with the 'Bearer' prefix.
What is the role of status codes in HTTP responses?
Status codes in HTTP responses are used for encryption purposes.
Status codes in HTTP responses convey the outcome of the server's handling of the client's request.
Status codes in HTTP responses are related to weather forecasting.
Status codes in HTTP responses determine the color scheme of the website.
How can you set headers in an axios request?
Include headers directly in the URL
Pass headers as a query parameter in the axios request
Pass an object with key-value pairs representing the headers as the third argument in the axios request.
Set headers using a separate fetch request
What are the common status codes in HTTP responses and their meanings?
200 OK, 404 Not Found, 500 Internal Server Error, 401 Unauthorized, 403 Forbidden
500 Bad Request
403 Unauthorized
302 Found
How can you handle timeouts in HTTP requests using axios?
Ignore the timeout and proceed with the request
Set a timeout value in the request configuration object
Increase the number of retries
Manually terminate the request process
Which is the most famous backend technology which is based on JavaScript?
Springboot
Flask
Django
Which of the following is used for creating API's in JS?
What is Node.js primarily used for?
Managing databases
Building scalable network applications and web servers.
Developing desktop software
Creating mobile applications
Which of the following is a feature of Node.js?
Built-in support for multi-threading
Synchronous file system access
Single-threaded blocking model
Non-blocking I/O model
What does Express.js help you build?
Desktop software and utilities
Mobile applications and games
Web applications and APIs
Database management systems
Which method is used to create a new Express application?
createApp()
express()
new Express()
initializeExpress()
What is the default port for an Express server?
4000
5000
8080
3000
Which of the following is a middleware in Express.js?
body-parser
morgan
express-session
cors
What file is typically used to define dependencies in a Node.js project?
config.json
dependencies.json
package.json
node_modules.json
Which command is used to install Express.js?
npm install expressjs
yarn add express
npm add express
npm install express
What does the 'req' parameter represent in Express routes?
The 'req' parameter is a placeholder for route parameters in Express.
The 'req' parameter represents the response object in Express routes.
The 'req' parameter represents the request object in Express routes.
The 'req' parameter is used to define middleware in Express routes.
Which of the following is NOT a core module of Node.js?
http
fs
express
path
________ is a back end web application framework for Node.js, it is fast, unopinionated and minimalist framework.
Emotional.js
Express.js
Nodemon
Doraemon
________ are the blocks of encapsulated code that communicates with an external application on the basis of their related functionality.
Application
Code
Dependencies
Modules
What module provides information about the computer's operating system?
OS Module
Path Module
FS Module
HTTP Module
What is the right syntax for importing a module?
require()
function()
import()
module.import()
Do you need to know NodeJS before learning Express?
Yes
No
What function arguments are available to Express.js Route handlers?
req - the request object
res - the response object
next
All of the above
Where is captured values are populated regarding route parameters?
req.params object
app.locals object
req.data object
None of above
What is a REST API?
A client side scripting library
A server side software application
An application programming interface
What is Express in Node.js?
A POSIX tool used to transfer and buffer streams of data
A database middleware wrapper
A back end web framework
What does CRUD stand for in the context of database operations?
Create, Retrieve, Update, Delete
Connect, Read, Update, Delete
Connect, Retrieve, Update, Delete
Create, Read, Update, Delete
Which method is used to insert a single document into a MongoDB collection?
insertMany()
insertOne()
addDocument()
createDocument()
What is the unique identifier field required in every MongoDB document?
uniqueId
documentId
id
_id
Which MongoDB method is used to retrieve multiple documents from a collection?
findOne()
fetch()
find()
getAll()
What does the upsert option do in the updateOne() method?
Fetches a document
Deletes a document if it exists
Inserts a document if it does not exist
Updates all documents
Which operator is used to update a field in a MongoDB document?
$set
$update
$add
$modify
What is BSON in MongoDB?
Binary JSON
Binary Object
Basic JSON
Basic Object Notation
Which method is used to delete multiple documents from a MongoDB collection?
deleteMany()
deleteAll()
removeMany()
removeAll()
What is the purpose of the findOne() method?
To delete a document
To update a document
To find all documents
To find a single document that matches a query
In which format does MongoDB store data?
CSV
BSON
HTML
XML
What is the default behavior of insertMany() regarding document order?
Ordered
Unordered
Random
Sequential
Which method would you use to update multiple documents at once?
bulkUpdate()
updateMany()
updateMultiple()
updateAll()
What is the purpose of the $gte operator in a query?
Not equal to
Greater than or equal to
Less than or equal to
Equal to
Which of the following is a valid way to connect to a MongoDB database in Node.js?
db.connect()
connectMongo()
MongoDB.connect()
MongoClient.connect()
What is Mongoose in the context of MongoDB?
A GUI tool for managing MongoDB databases.
An ODM library for MongoDB and Node.js
A database clustering solution
A schema-less database engine
Which feature of Mongoose helps in defining the structure of the documents within a collection?
Model Validation
Schema Definition
Query Building
Data Aggregation
Why would you use Mongoose instead of the native MongoDB driver in a Node.js application?
It provides a GUI for database management
It allows for schema enforcement and validation
It is faster than the native driver
It supports SQL queries
What is a virtual in Mongoose, and how is it used?
A special field that exists only in the application's memory, not in the database
A method to create indexes on fields
A feature to define relationships between documents
A way to handle transactions in MongoDB
How do you create a model from a schema in Mongoose?
mongoose.createModel('ModelName', schema)
mongoose.model('ModelName', schema)
mongoose.newModel('ModelName', schema)
mongoose.makeModel('ModelName', schema)
How does Mongoose handle relationships between documents in MongoDB?
By embedding documents within each other
By using virtuals to simulate joins
By referencing documents through ObjectIds
All of the above
Which Mongoose feature allows for the automatic population of referenced documents?
Middleware
Hooks
Virtuals
Populate
Which option sets a field as required in a Mongoose schema?
{ required: true }
{ mandatory: true }
{ necessary: true }
{ compulsory: true }
How do you connect to a MongoDB database using Mongoose?
mongoose.start()
mongoose.db('mongodb://localhost/mydb')
mongoose.connect('mongodb://localhost/mydb')
mongoose.init('mongodb://localhost/mydb')
Why did the MongoDB document go to therapy?
It had too many issues
It was feeling unstructured
It couldn't find a primary key
It had a complex relationship
