1. What is Node.js primarily used for?
A. Styling web pages
B. Creating mobile applications
C. Designing user interfaces
D. Running JavaScript on the server-side
2. Which module in Node.js is used to create a web server?
http
path
fs
url
3. What does npm stand for?
- Network Protocol Module
- Node Performance Monitor
- New Programming Method
- Node Package Manager
4. Which of the following is true about the Node.js event loop?
- It blocks I/O operations
- It uses multiple threads for JavaScript execution
- It handles asynchronous operations using a single thread
- It is only used for debugging
5. Which method is used to read a file asynchronously in Node.js?
fs.writeFile()
fs.open()
fs.readFile()
fs.readFileSync()
6. Which object is used in Node.js to handle asynchronous events?
- A) Callback
- B) EventEmitter
- C) Stream
- D) Promise
7. What does require()
do in Node.js?
- A) Makes HTTP requests
- B) Loads and caches a module
- C) Parses a JSON string
- D) Initializes the server
8.Which module is used to create a web server in Node.js?
- A) url
- B) events
- C) http
- D) express
9.Which of the following is true about Node.js?
- A) It is synchronous by default
- B) It is built on Java’s V8 engine
- C) It uses the V8 JavaScript engine
- D) It supports multithreading by default
10. Which function is used to read a file asynchronously in Node.js?
- A) fs.readFileSync
- B) fs.open
- C) fs.readFile
- D) fs.read
11. How do you export a function in Node.js?
- A) export function
- B) module.exports = myFunction
- C) exports: myFunction
- D) define(myFunction)
12. What does npm stand for?
- A) Node Package Manager
- B) Node Project Manager
- C) New Programming Module
- D) NodeJS Program Manager
13. Which keyword is used to handle exceptions in Node.js?
- A) throw
- B) catch
- C) try…catch
- D) error
14. Which method is used to create a server in Node.js?
- A) http.listen
- B) server.listen
- C) http.createServer
- D) express.create
15. Which of these is a third-party Node.js web framework?
- A) http
- B) fs
- C) express
- D) url
16. What is the use of process
in Node.js?
- A) To start an HTTP server
- B) To interact with OS processes
- C) To import modules
- D) To style HTML pages