Online Exam Quiz

questionQuestion  1 to 30

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 command is used to start a Node.js REPL session?

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

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

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 method is used to extract file extension in Node.js?

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

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

  • 200
  • 404
  • 500
  • 302
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 of the following is NOT a built-in module in Node.js?

  • fs
  • http
  • express
  • os
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

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 module is used to parse JSON strings in Node.js?

  • url
  • querystring
  • json
  • None of the above
Mark for review

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

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

Which module is used to handle file system operations in Node.js?

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

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 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 NOT a core module in Node.js?

  • util
  • express
  • events
  • http
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

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

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 handle errors in Node.js asynchronous operations?

  • Using try-catch blocks
  • Using callback functions
  • Using promises
  • 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 rename a file in Node.js?

  • fs.rename()
  • fs.move()
  • fs.relocate()
  • fs.rewrite()
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 __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 remove a directory in Node.js?

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

How do you exit from a Node.js program?

  • exit()
  • return
  • process.exit()
  • quit()
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