Online Exam Quiz

questionQuestion  1 to 30

How can you sort the results of a MongoDB query?

  • sequence()
  • order()
  • arrange()
  • sort()
Mark for review

Which MongoDB method is used to return only specific fields?

  • returnFields()
  • select()
  • projection()
  • fields()
Mark for review

How do you delete a document in MongoDB?

  • dropOne()
  • removeOne()
  • deleteOne()
  • eraseOne()
Mark for review

What is MongoDB?

  • A programming language
  • A NoSQL database
  • An operating system
  • A SQL database
Mark for review

How do you create an index on a field in MongoDB?

  • addIndex()
  • createIndex()
  • indexField()
  • newIndex()
Mark for review

Which of the following is used to update a document in MongoDB?

  • changeOne()
  • updateOne()
  • modifyOne()
  • updateDoc()
Mark for review

Which command is used to view all collections in a database?

  • view collections
  • get collections
  • show collections
  • list collections
Mark for review

What is the default port for MongoDB?

  • 3306
  • 27017
  • 5432
  • 1433
Mark for review

In MongoDB, a document is stored in which format?

  • BSON
  • CSV
  • XML
  • JSON
Mark for review

Which command is used to drop a collection in MongoDB?

  • removeCollection()
  • drop()
  • deleteCollection()
  • dropCollection()
Mark for review

Which of the following is NOT a MongoDB data type?

  • boolean
  • int32
  • varchar
  • string
Mark for review

What is sharding in MongoDB?

  • Encrypting data
  • Distributing data across multiple machines
  • Compressing data
  • Backing up data
Mark for review

Which data model does MongoDB use?

  • Hierarchical model
  • Network model
  • Relational model
  • Document model
Mark for review

Which operator is used for a logical AND in MongoDB queries?

  • $or
  • $nor
  • $not
  • $and
Mark for review

What does the $unset operator do in MongoDB?

  • Sets a field to null
  • Updates a field value
  • Removes a field from a document
  • Adds a new field
Mark for review

Which method is used to find documents in MongoDB?

  • find()
  • fetch()
  • query()
  • search()
Mark for review

How do you view the roles of a user in MongoDB?

  • listRoles(<username>)
  • showUserRoles(<username>)
  • show roles for <username>
  • db.getUserRoles(<username>)
Mark for review

How do you create a new database in MongoDB?

  • use <database_name>
  • newDatabase <database_name>
  • create <database_name>
  • db.newDatabase(<database_name>)
Mark for review

What is the use of the $lookup operator in MongoDB?

  • Deletes documents
  • Joins collections
  • Updates documents
  • Indexes fields
Mark for review

How do you check the version of MongoDB you are running?

  • mongo --version
  • db.version()
  • mongod --version
  • mongo -v
Mark for review

How do you enable authentication in MongoDB?

  • Start mongod with --auth
  • Start mongod with --enableAuth
  • Start mongod with --authenticate
  • Start mongod with --secure
Mark for review

What does the $in operator do in MongoDB?

  • Matches any of the values specified in an array
  • Combines two fields
  • Inverts the query result
  • Checks if a field is null
Mark for review

What does the MongoDB $push operator do?

  • Removes an element from an array
  • Updates an element in an array
  • Adds an element to an array
  • Queries an array
Mark for review

What is GridFS used for in MongoDB?

  • Creating indexes
  • Backing up data
  • Storing large files
  • Sharding data
Mark for review

Which storage engine is the default in MongoDB?

  • MMAPv1
  • WiredTiger
  • InnoDB
  • RocksDB
Mark for review

Which of the following is NOT a MongoDB shell method?

  • find()
  • insert()
  • update()
  • add()
Mark for review

How do you list all databases in MongoDB?

  • list dbs
  • db.show()
  • db.list()
  • show dbs
Mark for review

What is the role of the MongoDB config server?

  • Handles replication
  • Manages user accounts
  • Stores metadata and configuration settings for sharding
  • Backs up data
Mark for review

What type of index does MongoDB create by default for the _id field?

  • Compound index
  • Text index
  • Unique index
  • Sparse index
Mark for review

How do you create a capped collection in MongoDB?

  • addCappedCollection()
  • createCapped()
  • createCollection() with capped
  • newCappedCollection()
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