MongoDB Multiple Choice Question

Question : 1 Which of the following is true about MongoDB?

  • A

    MongoDB is a relational database management system (RDBMS).

  • B

    MongoDB stores data in tables.

  • C

    MongoDB uses SQL as its query language.

  • D

    MongoDB stores data in JSON-like documents.

Answer:

Question : 2 What is the primary database model used by MongoDB?

  • A

    Relational Model

  • B

    Document Model

  • C

    Hierarchical Model

  • D

    Network Model

Answer:

Question : 3 Which of the following statements is true about collections in MongoDB?

  • A

    Collections in MongoDB are similar to tables in relational databases.

  • B

    Collections in MongoDB store data in key-value pairs.

  • C

    Collections in MongoDB can only store a single document.

  • D

    Collections in MongoDB use a fixed schema.

Answer:

Question : 4 What is the purpose of the "_id" field in MongoDB documents?

  • A

    To specify the data type of the document.

  • B

    To store the creation date of the document.

  • C

    To uniquely identify each document in a collection.

  • D

    To define the primary key of the document.

Answer:

Question : 5 Which of the following is NOT a data type supported by MongoDB?

  • A

    String

  • B

    Integer

  • C

    Array

  • D

    Date Object

Answer:

Question : 6 Which of the following is true about BSON in MongoDB?

  • A

    BSON stands for Binary Serialized Object Notation.

  • B

    BSON is a binary representation of JSON-like documents used in MongoDB.

  • C

    BSON is a query language for MongoDB.

  • D

    BSON is used to define schema in MongoDB.

Answer:

Question : 7 Which command is used to start the MongoDB server?

  • A

    mongo

  • B

    mongod

  • C

    start mongod

  • D

    run mongod

Answer:

Question : 8 What is the default port number for MongoDB?

  • A

    27017

  • B

    3306

  • C

    5432

  • D

    8080

Answer:

Question : 9 Which of the following is NOT a valid command in the MongoDB shell?

  • A

    show dbs

  • B

    use databaseName

  • C

    create collectionName

  • D

    insert documentName

Answer:

Question : 10 Which command is used to create a new database in MongoDB?

  • A

    create databaseName

  • B

    use databaseName

  • C

    db.createDatabase(databaseName)

  • D

    db.databaseName.insert(document)

Answer:

Question : 11 Which MongoDB method is used to query documents in a collection?

  • A

    find()

  • B

    query()

  • C

    select()

  • D

    search()

Answer:

Question : 12 Which operator is used for equality comparison in MongoDB queries?

  • A

    =

  • B

    ==

  • C

    ===

  • D

    $eq

Answer:

Question : 13 What is the purpose of the "limit" method in MongoDB queries?

  • A

    To limit the number of documents returned by the query.

  • B

    To sort the documents returned by the query.

  • C

    To skip a specified number of documents in the query result.

  • D

    To perform a case-insensitive search.

Answer:

Question : 14 Which MongoDB method is used to update documents in a collection?

  • A

    update()

  • B

    modify()

  • C

    save()

  • D

    updateOne()

Answer:

Question : 15 What is the purpose of the "sort" method in MongoDB queries?

  • A

    To limit the number of documents returned by the query.

  • B

    To skip a specified number of documents in the query result.

  • C

    To perform a case-insensitive search.

  • D

    To sort the documents returned by the query.

Answer:

Question : 16 Which MongoDB method is used to delete documents from a collection?

  • A

    remove()

  • B

    delete()

  • C

    deleteOne()

  • D

    deleteMany()

Answer:

Question : 17 What is the purpose of the "projection" parameter in MongoDB queries?

  • A

    To specify the criteria for document selection.

  • B

    To specify the fields to return in the query result.

  • C

    To limit the number of documents returned by the query.

  • D

    To sort the documents returned by the query.

Answer:

Question : 18 Which MongoDB method is used to create an index on a collection?

  • A

    createIndex()

  • B

    index()

  • C

    addIndex()

  • D

    createIndexOne()

Answer:

Question : 19 What is the purpose of indexing in MongoDB?

  • A

    To sort documents in a collection.

  • B

    To reduce the size of the database.

  • C

    To improve the performance of queries by allowing faster access to data.

  • D

    To compress data stored in the database.

Answer:

Question : 20 Which MongoDB method is used to aggregate data from a collection?

  • A

    aggregate()

  • B

    group()

  • C

    merge()

  • D

    aggregate()

Answer:

Question : 21 What is the purpose of the "pipeline" parameter in MongoDB aggregation?

  • A

    To specify the criteria for document selection.

  • B

    To specify the fields to return in the query result.

  • C

    To define a sequence of data processing operations to be applied to the documents.

  • D

    To sort the documents returned by the query.

Answer:

Question : 22 Which MongoDB method is used to create a backup of a database?

  • A

    backup()

  • B

    dump()

  • C

    snapshot()

  • D

    mongodump()

Answer:

Question : 23 What is the purpose of the "mongorestore" command in MongoDB?

  • A

    To restore a backup of a database.

  • B

    To create a backup of a database.

  • C

    To drop a database.

  • D

    To check the status of a database.

Answer:

Question : 24 Which MongoDB method is used to retrieve metadata about the database server?

  • A

    serverInfo()

  • B

    serverMetadata()

  • C

    dbStats()

  • D

    isMaster()

Answer:

Question : 25 What is the purpose of the "mongostat" command in MongoDB?

  • A

    To view the status of a MongoDB instance.

  • B

    To view the content of a database.

  • C

    To perform statistical analysis on data stored in MongoDB.

  • D

    To monitor the performance of a MongoDB instance.

Answer: