WorksheetsFSD based
Total questions: 25
Worksheet time: 19mins
What is Node.js?
A front-end framework
A JavaScript runtime built on Chrome’s V8 engine
A relational database
A programming language
Which of the following is true about Node.js?
It is single-threaded and non-blocking
It is multi-threaded and blocking
It only supports synchronous programming
It is not suitable for building APIs
Which command is used to check the installed version of Node.js?
node -v
node --check
npm -v
node version
What is npm in Node.js?
Node Programming Module
Node Package Manager
Node Processing Method
New Package Manager
Which file is used to define project dependencies in a Node.js project?
index.js
config.json
package.json
dependencies.json
How do you import a module in Node.js using CommonJS?
import module from 'module-name'
require('module-name')
include 'module-name'
fetch('module-name')
What does the fs module in Node.js do?
Handles file system operations
Manages frontend styling
Manages database connections
Creates web servers
Which of the following frameworks is built on top of Node.js?
React
Angular
Express
Django
How do you create an HTTP server in Node.js?
Using the http module
Using the fs module
Using the net module
Using the dns module
What is the main difference between fs.readFileSync() and fs.readFile() in Node.js?
fs.readFileSync() is asynchronous, while fs.readFile() is synchronous
fs.readFileSync() blocks execution until the file is read, while fs.readFile() does not.
fs.readFile() is faster than fs.readFileSync().
fs.readFileSync() does not require the fs module.
Which method is used to add content to an existing file without overwriting it?
fs.writeFileSync()
fs.appendFileSync()
fs.readFileSync()
fs.renameSync()
Which statement about file streams and directories in Node.js is correct?
fs.readdirSync() is used to delete directories.
File streams (fs.createReadStream()) allow reading large files efficiently without loading the entire file into memory.
fs.mkdirSync() is used to list all files in a directory.
fs.writeStream() is used only for deleting files.
What is Express.js?
A JavaScript library for front-end
A Node.js framework for building web applications
A web server for hosting static websites
A package manager for Node.js
Which command is used to install Express in a Node.js project?
npm install express
npm add express
npm express install
node install express
What is the correct way to create an Express app?
const app = express.create()
const app = express()
const app = new Express()
const app = createExpressApp()
How do you define a GET route in Express?
app.get('/route', function(req, res) {})
app.post('/route', function(req, res) {})
app.put('/route', function(req, res) {})
app.get('/route') {}
What is middleware in Express?
A function to handle HTTP requests
A function that runs before a route handler
A tool to manage databases
A method for handling routes in Express
How can you add middleware to your Express app?
app.use(middlewareFunction)
app.add(middlewareFunction)
app.include(middlewareFunction)
app.middleware(middlewareFunction)
How do you send a JSON response in Express?
res.sendJson({ key: "value" })
res.json({ key: "value" })
res.send({ key: "value" })
res.writeJson({ key: "value" })
What does req represent in Express?
The request object, containing HTTP request information
The response object
The server instance
The middleware function
How do you handle a route with a dynamic parameter in Express?
app.get('/users/:id', function(req, res) {})
app.get('/users/id', function(req, res) {})
app.get('/users?param', function(req, res) {})
app.get('/users(id)', function(req, res) {})
What is the purpose of next() in Express middleware?
To end the request-response cycle
To pass control to the next middleware function
To send a response to the client
To process the route
What is Postman primarily used for?
Writing SQL queries
Sending HTTP requests and testing APIs
Designing front-end web pages
Managing cloud storage
Which of the following request methods can be used in Postman?
GET
POST
PUT
All of the above
What is the purpose of Collections in Postman?
To store API response data
To group related API requests for better organization
To write server-side scripts
To generate SQL queries automatically
