Online Exam Quiz

questionQuestion  1 to 30

How do you import modules in Node.js?

  • Using the require() function
  • Using the import statement
  • Using the include() method
  • Using the use() function
Mark for review

What does the os module provide in Node.js?

  • Methods for handling file system operations
  • Methods for interacting with the operating system
  • Methods for parsing URLs
  • Methods for handling HTTP requests and responses
Mark for review

How do you set environment variables in Node.js?

  • Using the export command
  • Using the process.env object
  • Using the set command
  • Using the env module
Mark for review

What is the purpose of the util module in Node.js?

  • To perform mathematical operations
  • To handle file system operations
  • To provide utility functions
  • To create web servers
Mark for review

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

  • util
  • express
  • events
  • http
Mark for review

Which HTTP status code represents "Not Found" in Node.js?

  • 200
  • 404
  • 500
  • 302
Mark for review

Which method is used to rename a file in Node.js?

  • fs.rename()
  • fs.move()
  • fs.relocate()
  • fs.rewrite()
Mark for review

What is npm in Node.js?

  • Node Package Manager
  • Node Programming Module
  • New Project Manager
  • None of the above
Mark for review

What does the process.argv array contain?

  • Environment variables
  • Command-line arguments
  • Process information
  • File system paths
Mark for review

Which method is used to remove a directory in Node.js?

  • fs.deleteDir()
  • fs.removeDir()
  • fs.rmdir()
  • fs.unlink()
Mark for review

Which HTTP method is used to retrieve data from the server in Node.js?

  • GET
  • POST
  • PUT
  • DELETE
Mark for review

Which method is used to execute shell commands in Node.js?

  • child_process.exec()
  • child_process.spawn()
  • child_process.fork()
  • child_process.shell()
Mark for review

What is the purpose of the crypto module in Node.js?

  • To handle cryptographic functions
  • To manipulate arrays
  • To create child processes
  • To handle file system operations
Mark for review

Which event loop does Node.js use?

  • Single-threaded event loop
  • Multi-threaded event loop
  • Synchronous event loop
  • Asynchronous event loop
Mark for review

How do you handle sessions in Node.js?

  • Using the express-session middleware
  • Using the session module
  • Using the cookie-parser middleware
  • All of the above
Mark for review

Which method is used to write to a file asynchronously in Node.js?

  • fs.writeFile()
  • fs.writeFileSync()
  • fs.appendFile()
  • fs.open()
Mark for review

How do you handle cookies in Node.js?

  • Using the cookie-parser middleware
  • Using the cookies module
  • Using the express framework
  • All of the above
Mark for review

What is the purpose of the child_process module in Node.js?

  • To handle child processes
  • To interact with the file system
  • To create HTTP servers
  • To manipulate arrays
Mark for review

Which of the following is a built-in HTTP module in Node.js?

  • request
  • fetch
  • http
  • axios
Mark for review

What is Node.js?

  • A web browser
  • A server-side JavaScript runtime
  • A front-end framework
  • A database management system
Mark for review

Which Node.js module is used to create a web server?

  • fs
  • http
  • url
  • path
Mark for review

What does the http.createServer() method return in Node.js?

  • An HTTP request object
  • An HTTP response object
  • An HTTP server object
  • An HTTP client object
Mark for review

Which method is used to get the current working directory in Node.js?

  • fs.getcwd()
  • fs.cwd()
  • process.cwd()
  • process.getwd()
Mark for review

Which of the following is NOT a built-in module in Node.js?

  • fs
  • http
  • express
  • os
Mark for review

Which Node.js method is used to handle asynchronous operations?

  • sync()
  • await()
  • async()
  • callback()
Mark for review

Which method is used to extract file extension in Node.js?

  • fs.getExtension()
  • fs.extname()
  • fs.getFileExtension()
  • fs.fileExtension()
Mark for review

Which command is used to start a Node.js REPL session?

  • start
  • node start
  • node
  • run
Mark for review

What does the EventEmitter class do in Node.js?

  • Emits events asynchronously
  • Handles HTTP requests
  • Provides encryption functions
  • Converts callback functions to promises
Mark for review

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

  • To manipulate streams of data
  • To handle binary data
  • To perform mathematical calculations
  • To create and manage child processes
Mark for review

What does the term "middleware" refer to in Node.js?

  • Software components that execute in a specific order
  • Functions that have access to the request and response objects
  • External libraries used to handle routing
  • Modules imported using require()
Mark for review

blinkerOnline

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • Answered
  • Not Answered
  • Marked for Review