Online Exam Quiz

questionQuestion  1 to 30

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 'req.body' contain in Express?

  • URL parameters
  • Query parameters
  • Request body data
  • Session data
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

How can you send a JSON response in Express?

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

How do you serve static files in Express?

  • app.static()
  • express.static()
  • app.serve()
  • express.serve()
Mark for review

What does 'npm init' command do?

  • Installs npm
  • Initializes a new Node.js project
  • Updates npm
  • Removes npm
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 install a package globally using npm?

  • npm install package
  • npm install package -g
  • npm global install package
  • npm add package
Mark for review

What does 'process.exit()' do in Node.js?

  • Ends the process
  • Starts a new process
  • Restarts the process
  • Pauses the process
Mark for review

How can you create a new project with npm?

  • npm new
  • npm create
  • npm init
  • npm start
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

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

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

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

How can you create a promise in Node.js?

  • new Promise()
  • Promise.create()
  • createPromise()
  • promise()
Mark for review

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

  • Ruby on Rails
  • Laravel
  • Express
  • Django
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

How can you handle file uploads in Express?

  • Using 'body-parser'
  • Using 'express-fileupload'
  • Using 'fs' module
  • Using 'multer'
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 does the 'req.query' object contain in Express?

  • Query string parameters
  • Route parameters
  • Header information
  • Cookie data
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

What is npm?

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

How can you create a server in Node.js?

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

How can you create a route in Express?

  • app.route()
  • app.get()
  • app.post()
  • All of the above
Mark for review

What is Node.js?

  • A runtime environment
  • A library
  • A framework
  • A database
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 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

What is 'nodemon'?

  • A Node.js module
  • A package manager
  • A tool that automatically restarts Node.js applications
  • A web server
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

What is 'async/await' used for in Node.js?

  • To handle synchronous code
  • To handle asynchronous code
  • To create a server
  • To read files
Mark for review

Which command is used to uninstall a package using npm?

  • npm delete package
  • npm remove package
  • npm uninstall package
  • npm unpackage
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