Create New Post

Node JS MCQs - 2

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

  2. Which of the following Node.js modules is commonly used for database operations?

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

    Answer: D) mongoose

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

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

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

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

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

    • A) GET
    • B) POST
    • C) DELETE
    • D) UPDATE

    Answer: D) UPDATE

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

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

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

Leave a Reply

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

27056