Create New Post

Node JS MCQs - 1

  1. 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

  2. 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

  3. 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

  4. 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

  5. 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

  6. Which of the following is NOT a core module in Node.js?

    • A) http
    • B) fs
    • C) express
    • D) path

    Answer: C) express

  7. 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

  8. 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

  9. 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

  10. 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

Leave a Reply

Your email address will not be published. Required fields are marked *

71126