-
What is Node.js?
- A) A JavaScript runtime built on Chrome's V8 JavaScript engine
- B) A front-end framework for building user interfaces
- C) A database management system
- D) A programming language
Answer: A) A JavaScript runtime built on Chrome's V8 JavaScript engine
-
Which of the following modules is used to create a web server in Node.js?
- A) http
- B) fs
- C) path
- D) os
Answer: A) http
-
What does npm stand for?
- A) Node Package Manager
- B) New Programming Method
- C) Node Program Module
- D) None of the above
Answer: A) Node Package Manager
-
How do you include external modules in a Node.js application?
- A) Using the require() function
- B) Using the import statement
- C) Using the import() function
- D) By directly referencing the module file
Answer: A) Using the require() function
-
What is the purpose of the
fs
module in Node.js?- A) To create a web server
- B) To interact with the file system
- C) To manage databases
- D) To handle HTTP requests
Answer: B) To interact with the file system
-
Which of the following is NOT a core module in Node.js?
- A) http
- B) fs
- C) express
- D) path
Answer: C) express
-
What is the event-driven architecture in Node.js?
- A) It allows for multiple threads to execute code concurrently
- B) It relies on callbacks to handle asynchronous operations
- C) It utilizes a single-threaded event loop to handle concurrent requests
- D) It uses event listeners to manage server requests
Answer: C) It utilizes a single-threaded event loop to handle concurrent requests
-
What is the purpose of the
npm init
command?- A) To install Node.js on your system
- B) To initialize a new Node.js project and create a package.json file
- C) To start a new Node.js server
- D) To install dependencies for a Node.js project
Answer: B) To initialize a new Node.js project and create a package.json file
-
Which of the following is a popular framework for building web applications with Node.js?
- A) Angular
- B) React
- C) Vue.js
- D) Express
Answer: D) Express
-
How do you handle errors in Node.js?
- A) Using try...catch statements
- B) Using the error event emitter
- C) Using callback functions
- D) All of the above
Answer: D) All of the above
Comments