Online Exam Quiz

questionQuestion  1 to 30

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

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

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

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

  • start
  • node start
  • node
  • run
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

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 of the following is a built-in HTTP module in Node.js?

  • request
  • fetch
  • http
  • axios
Mark for review

How do you include query parameters in a URL in Node.js?

  • Using the query property of the url module
  • Using the params property of the http module
  • Using the query property of the http module
  • Using the params property of the url module
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

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

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

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 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 HTTP status code represents "Not Found" in Node.js?

  • 200
  • 404
  • 500
  • 302
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

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

  • fs.read()
  • fs.readFile()
  • fs.open()
  • fs.readFileSync()
Mark for review

Which method is used to get information about a file in Node.js?

  • fs.info()
  • fs.fileInfo()
  • fs.stat()
  • fs.getFileInfo()
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 module is used to handle file system operations in Node.js?

  • fs
  • path
  • os
  • util
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

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

How do you handle form data in Node.js?

  • Using the formdata module
  • Using the body-parser middleware
  • Using the express framework
  • Using the express framework
Mark for review

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

  • util
  • express
  • events
  • http
Mark for review

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

  • sync()
  • await()
  • async()
  • callback()
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

How do you create a child process in Node.js?

  • Using the fork() method
  • Using the exec() method
  • Using the spawn() method
  • All of the above
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

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

  • fs.getExtension()
  • fs.extname()
  • fs.getFileExtension()
  • fs.fileExtension()
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

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