NEW
Font size
WorksheetsNode.js Quiz
Total questions: 30
Worksheet time: 15mins
What is Node.js primarily used for?
Creating static websites
Running JavaScript on the server-side
Styling web pages
None of the above
What feature does Node.js utilize to handle multiple requests?
Synchronous programming
Non-blocking I/O
Multithreading
Caching
Which of the following is a core module in Node.js?
express
http
mongoose
jquery
What is the default package manager for Node.js?
Bower
npm
Yarn
Composer
Which of the following commands is used to initialize a new Node.js project?
npm start
npm create
npm init
npm install
What does the 'Express' framework do?
It helps in styling web pages.
It is used for building web applications in Node.js.
It is a database management system.
It is a JavaScript library for animations.
In the context of web applications, what does MVC stand for?
Model-View-Controller
Model-View-Creator
Model-Variable-Controller
Model-View-Creative
Which of the following is NOT a part of the MERN stack?
MongoDB
Express
React
Angular
What is the role of a web server in web development?
To store static files only
To process requests and serve content to clients
To manage databases
To manipulate client-side scripts
In a typical web application architecture, what does the backend handle?
User interface design
Data management and business logic
Client-side scripting
Responsive design
What does the command npm install express do?
It installs the express package locally.
It installs the express package globally.
It updates the express package.
It removes the express package.
Which of the following best describes the role of MongoDB in a web application?
It serves HTML files.
It is a NoSQL database that stores data in JSON-like format.
It is a CSS framework.
It is a JavaScript library for DOM manipulation.
How can you start a Node.js application?
node app.js
start app.js
run app.js
execute app.js
What will console.log(typeof a); output if let a = 42;?
number
string
object
undefined
Which of the following best describes the purpose of the require function in Node.js?
To create a new module
To import modules into a file
To declare global variables
To execute a function
What happens if you call res.end() without first calling res.writeHead() in an HTTP server?
The server will crash.
The response will not send any headers.
The server will hang indefinitely.
The response will send a 404 status code.
In the context of Node.js, what does an EventEmitter do?
It manages HTTP requests.
It allows handling of asynchronous events.
It stores data in memory.
It compiles JavaScript code.
What is the purpose of the npm update command?
To install new packages
To update existing packages to their latest version
To initialize a new project
To uninstall packages
Which of the following is a benefit of using asynchronous programming in Node.js?
It simplifies code structure.
It allows handling of multiple I/O operations simultaneously.
It eliminates all bugs.
It makes code run faster on the client-side.
What type of application can you build using the Angular framework?
Server-side applications
Desktop applications
Single-page applications
Command-line applications
In the context of the web, what does the term "stack" refer to?
A collection of programming languages
A set of technologies used together for web development
A type of database
A framework for building APIs
What does the npm install -g command do?
Installs a package in the local directory
Installs a package globally on the system
Updates a previously installed package
Removes a package from the system
What is the primary purpose of using middleware in Express?
To handle errors
To process requests before they reach the route handler
To serve static files
All of the above
What does the http.createServer() method do in Node.js?
It creates a new HTTP server
It closes an existing HTTP server
It sends data to the client
It reads data from the client
In which file would you typically define your project's dependencies when using npm?
package.json
app.js
server.js
index.html
Which command would you use to check the current version of Node.js installed?
node -version
node --version
node -v
all of the above
If you wanted to create a simple web server that responds with "Hello World!", which of the following code snippets is correct?
http.createServer({ response: 'Hello World!' });
http.createServer(() => { res.write('Hello World!'); });
http.createServer((req, res) => { res.end('Hello World!'); }).listen(port);
http.createServer(res => res.write('Hello World!'));
In a Node.js application, what is the role of a callback function?
It synchronizes the execution of code.
It allows for asynchronous operations to complete before proceeding.
It automatically handles errors.
It is used to define global variables.
What does the app.use() method in Express do?
It defines static routes.
It mounts middleware functions at a specific path.
It creates an HTTP server.
It initializes the application.
Which of the following statements is true about React?
It is mainly used for server-side programming.
It is a framework for building user interfaces.
It is a database management tool.
It is a CSS preprocessor.
