-
What is the purpose of the
Buffer
class in Node.js?- A) To manipulate binary data
- B) To manage HTTP requests
- C) To handle file system operations
- D) To create web servers
Answer: A) To manipulate binary data
-
Which of the following Node.js modules is commonly used for database operations?
- A) fs
- B) http
- C) os
- D) mongoose
Answer: D) mongoose
-
What is the purpose of the
process
object in Node.js?- A) To manage child processes
- B) To provide information about the current Node.js process
- C) To handle HTTP requests
- D) To interact with the file system
Answer: B) To provide information about the current Node.js process
-
Which of the following is NOT true about Node.js?
- A) It is single-threaded
- B) It is asynchronous
- C) It uses the Chrome V8 JavaScript engine
- D) It is only used for front-end development
Answer: D) It is only used for front-end development
-
What is the purpose of the
setTimeout()
function in Node.js?- A) To pause the execution of the current thread for a specified amount of time
- B) To schedule a callback function to be executed after a specified delay
- C) To terminate the Node.js process
- D) To set a timeout for HTTP requests
Answer: B) To schedule a callback function to be executed after a specified delay
-
What is the purpose of the
require()
function in Node.js?- A) To include external modules
- B) To define variables
- C) To create a new file
- D) To send HTTP requests
Answer: A) To include external modules
-
Which of the following is NOT a valid HTTP method in Node.js?
- A) GET
- B) POST
- C) DELETE
- D) UPDATE
Answer: D) UPDATE
-
What is the purpose of the
exports
object in Node.js?- A) To import modules
- B) To create an HTTP server
- C) To export variables, functions, or classes from a module
- D) To handle database operations
Answer: C) To export variables, functions, or classes from a module
-
Which of the following is NOT true about callbacks in Node.js?
- A) Callbacks are asynchronous
- B) Callbacks are used to handle asynchronous operations
- C) Callbacks are always executed immediately
- D) Callbacks are functions passed as arguments to other functions
Answer: C) Callbacks are always executed immediately
-
What is the purpose of the
path
module in Node.js?- A) To handle HTTP requests
- B) To interact with the file system
- C) To manage child processes
- D) To create a web server
Answer: B) To interact with the file system
Comments