Create New Post

Node JS MCQs - 3

  1. What is the purpose of the npm install command in Node.js?

    • A) To initialize a new Node.js project
    • B) To install dependencies for a Node.js project
    • C) To start a new Node.js server
    • D) To uninstall Node.js from the system

    Answer: B) To install dependencies for a Node.js project

  2. Which of the following is a popular Node.js framework for building real-time web applications?

    • A) Express.js
    • B) Meteor.js
    • C) Django
    • D) Flask

    Answer: B) Meteor.js

  3. What is the purpose of the module.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

  4. Which of the following is a core module in Node.js for handling file operations?

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

    Answer: A) fs

  5. What is the purpose of the npm start command in Node.js?

    • A) To install Node.js on your system
    • B) To initialize a new Node.js project
    • C) To start a Node.js server defined in the package.json file
    • D) To update all dependencies in a Node.js project

    Answer: C) To start a Node.js server defined in the package.json file

  6. What is the purpose of the Buffer class in Node.js?

    • A) To manipulate binary data
    • B) To handle HTTP requests
    • C) To interact with the file system
    • D) To create web servers

    Answer: A) To manipulate binary data

  7. Which of the following is NOT a valid HTTP method in Node.js?

    • A) PUT
    • B) GET
    • C) POST
    • D) FETCH

    Answer: D) FETCH

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

  9. Which of the following is NOT true about the event-driven architecture in Node.js?

    • A) It allows for non-blocking, asynchronous I/O operations
    • B) It uses event emitters to handle events
    • C) It relies on a multi-threaded model for concurrency
    • D) It provides high scalability and performance

    Answer: C) It relies on a multi-threaded model for concurrency

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

Comments

Leave a Reply

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

36896