Online Exam Quiz

questionQuestion  1 to 30

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

What is npm in Node.js?

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

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

  • request
  • fetch
  • http
  • axios
Mark for review

What does the __dirname variable represent in Node.js?

  • The current file's directory
  • The root directory of the project
  • The parent directory of the current file
  • The home directory of the user
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

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

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

  • To handle streams of data
  • To create web servers
  • To manipulate arrays
  • To handle HTTP requests and responses
Mark for review

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

  • To handle HTTP requests and responses
  • To manipulate file paths
  • To handle file uploads
  • To create child processes
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

What does the url.parse() method do in Node.js?

  • Parses URL strings into URL objects
  • Parses query strings into key-value pairs
  • Parses JSON strings into JavaScript objects
  • None of the above
Mark for review

What does the require.resolve() method do in Node.js?

  • Resolves a module's path
  • Resolves a module's dependencies
  • Resolves a module's exports
  • Resolves a module's version
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

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 module is used to handle file system operations in Node.js?

  • fs
  • path
  • os
  • util
Mark for review

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

  • fs
  • http
  • express
  • os
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 cluster module in Node.js?

  • To handle clustering of processes
  • To handle cryptographic functions
  • To manipulate arrays
  • To create web servers
Mark for review

How can you install a Node.js package globally?

  • Using npm install -g <package-name>
  • Using npm install --global <package-name>
  • Using npm install --g <package-name>
  • Using npm global install <package-name>
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

How do you handle file uploads in Node.js?

  • Using the http module
  • Using the fs 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 method is used to get the current working directory in Node.js?

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

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

  • fs.read()
  • fs.readFile()
  • fs.open()
  • fs.readFileSync()
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

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

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

How do you delete a file in Node.js?

  • Using the fs.delete() method
  • Using the fs.unlink() method
  • Using the fs.remove() method
  • Using the fs.deleteFile() method
Mark for review

How do you install all dependencies listed in a package.json file?

  • Using npm install
  • Using npm install --save
  • Using npm install --all
  • Using npm install --dependencies
Mark for review

How do you handle errors in Node.js asynchronous operations?

  • Using try-catch blocks
  • Using callback functions
  • Using promises
  • All of the above
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 method is used to create a directory in Node.js?

  • fs.mkdir()
  • fs.createDir()
  • fs.newDir()
  • fs.makeDir()
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