Online Exam Quiz

questionQuestion  1 to 30

How can you create a new project with npm?

  • npm new
  • npm create
  • npm init
  • npm start
Mark for review

What does 'process.env' contain?

  • Environment variables
  • Event loop status
  • Process status
  • File system paths
Mark for review

What is the default port number for an HTTP server in Node.js?

  • 3000
  • 8080
  • 8000
  • 80
Mark for review

What is the purpose of 'express-session'?

  • To handle file uploads
  • To manage user sessions
  • To parse JSON data
  • To handle routing
Mark for review

How can you handle exceptions in Node.js?

  • try-catch block
  • error handling block
  • exception block
  • handle block
Mark for review

What is 'Express.js'?

  • A Node.js module
  • A database
  • A web application framework
  • A frontend library
Mark for review

Which of the following is true about Node.js?

  • It is synchronous by default
  • It is asynchronous by default
  • It does not support I/O operations
  • It cannot be used for web applications
Mark for review

How can you send a JSON response in Express?

  • res.sendJson()
  • res.json()
  • res.send()
  • res.sendJSON()
Mark for review

What does the 'req.params' object contain in Express?

  • Route parameters
  • Query parameters
  • Header information
  • Cookie data
Mark for review

What is the purpose of the 'next' parameter in Express middleware?

  • To handle the next request
  • To pass control to the next middleware function
  • To end the response
  • To start a new session
Mark for review

How can you handle file uploads in Express?

  • Using 'body-parser'
  • Using 'express-fileupload'
  • Using 'fs' module
  • Using 'multer'
Mark for review

How can you create a server in Node.js?

  • http.createServer()
  • httpServer.create()
  • server.create()
  • server.httpCreate()
Mark for review

What is the use of 'cors' middleware in Express?

  • To handle cookies
  • To enable Cross-Origin Resource Sharing
  • To manage sessions
  • To parse form data
Mark for review

Which of the following is a Node.js web application framework?

  • Ruby on Rails
  • Laravel
  • Express
  • Django
Mark for review

What is the default scope in Node.js modules?

  • Global
  • Local
  • Block
  • Module
Mark for review

What is the purpose of the 'res' object in Express?

  • To handle HTTP requests
  • To handle HTTP responses
  • To parse URL parameters
  • To manage sessions
Mark for review

How do you start a Node.js application?

  • node app.js
  • start app.js
  • run app.js
  • execute app.js
Mark for review

Which of the following is used to make HTTP requests in Node.js?

  • http
  • axios
  • request
  • All of the above
Mark for review

Which function is used to include modules in Node.js?

  • import
  • include
  • require
  • get
Mark for review

What does the 'fs' module stand for?

  • File Stream
  • File System
  • File Structure
  • File Server
Mark for review

Which command is used to check the Node.js version?

  • node -v
  • node --version
  • node version
  • Both node -v and node --version
Mark for review

How do you handle cookies in Express?

  • Using 'express-cookies'
  • Using 'cookie-parser'
  • Using 'cookie-handler'
  • Using 'express-session'
Mark for review

Which method is used to parse JSON data in Node.js?

  • JSON.parse()
  • JSON.stringify()
  • JSON.toString()
  • JSON.convert()
Mark for review

What is the purpose of the 'app.listen()' function in Express?

  • To create a server
  • To start listening for connections
  • To handle GET requests
  • To handle POST requests
Mark for review

Which command is used to install Node.js?

  • npm install nodejs
  • node install
  • npm install
  • brew install node
Mark for review

What is 'body-parser' used for in Express?

  • To parse incoming request bodies
  • To handle cookies
  • To manage sessions
  • To serve static files
Mark for review

Which of the following is a database that can be used with Node.js?

  • MySQL
  • MongoDB
  • PostgreSQL
  • All of the above
Mark for review

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

  • fs.read()
  • fs.readFile()
  • fs.readFileSync()
  • Both fs.readFile() and fs.readFileSync()
Mark for review

What does the 'path' module provide?

  • A way to handle file paths
  • HTTP server functionality
  • Cryptographic functions
  • Database access
Mark for review

What is a callback function in Node.js?

  • A function passed as an argument to another function
  • A function that returns a promise
  • A function that is called at the end of a script
  • None of the above
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