MongoDB Sample quiz / questions

  1. How does the value of _id get assigned to a document? (select all that apply)

_id field values are sequential integer values.

We can assign non ObjectId type value (numeric or text) when inserting a new document, as long as that value is unique to the collection.

It is automatically generated as an ObjectId type if not populated during the insert.

2. A query may include a_______ that specifies the fields from the matching documents to

return.

(select one correct answer)

projection                                                                lookup

union                                                                      selection

3. How is MongoDB Atlas related to MongoDB the Database? (select all that apply)

MongoDB Database has the same functionality as Atlas, but without the friendly user interface.

They both are MongoDB products.

Atlas has many tools and services within it that are built specifically for the MongoDB Database.

Atlas is a MongoDB service that can work with any database.

4. Which of the following is the most important consideration while designing the schema (data model) for MongoDB?

(select one correct answer)

The schema should be kept in 3NF similar to SQL schemas.

The schema should focus on creating possible embedded documents.

The schema should be modelled based on the data access and query patterns.

The schema should contain maximum indexes.

5. Select valid MongoDB documents from the given choices: (select all that apply)

A{ “_id”: 1,
“pet”: “cat”,
“name”: “Furball” ,
“fur”: “soft” }
B{ “_id”: 1,
“pet”: “cat”,
“name”: “Furball” ,
“attributes”: {
“coat”: “soft fur”,
“paws”: “cute” }
}
    C    { “_id”: “record1”} 
  • 6. In a MongoDB Document what is the role of fields and values? (select all that apply)

Values do not have to be attached to fields, and can be stand alone data points.

Each field has a value associated with it.

A field is a unique identifier for a specific datapoint.

  • 7. MongoDB scales horizontally using_______ for load balancing purpose.

(select one correct answer)

Oplog                                                                      Replication

Partitioning                                                              Sharding

  • 8. What does the following query do when performed on the posts collection? db.posts.update({_id:1},{$set:{Author:”Tom”}})

(select all that apply)

Sets the complete document with _id as 1 with the document specified in second parameter by replacing it completely

Updates the Author field as “Tom” for the document having _id as 1

Adds a new field Author if Author is not already present for the document

  • 9. What is the minimum sensible number of voting nodes to a replica set? (select one correct answer)

2                                                                             4

3                                                                             5

10. What is the MongoDB Database? (select all that apply)

The MongoDB database is an organized way to store and access data.

MongoDB database organizes documents in rows and columns.

MongoDB’s database uses tables of related data.

MongoDB is a NoSQL database that uses documents to store data in an organized way.

11. What is the maximum size of a MongoDB document? (select one correct answer)

64 KB                                                                      64 MB

2 MB                                                                       16 MB

12.Which type of indexes does MongoDB support? (select all that apply)

Compound Indexes                                                Multikey Indexes

Geospatial Indexes

13.Which of the following is true about Documents & Collections in MongoDB? (select one correct answer)

Collections are tables of documents and other collections.

Documents are made up of collections.

Collections consist of one or many documents.

Collections are documents that are organized in rows and columns.

14.MongoDB “replica sets” provide high________ _.

(select one correct answer)

scalability

performance                                                          

availability

all the above

15.By default, the _id field is included in the results of a query.

To suppress the id field from the result set, specify_______ in the projection.

(select one correct answer)

_id: 1                                                                       _id: -1

_id: 0                                                                       _id: null

Answer Key 
1.2. a3.4. c
5.6.7. d8.
9. c10.11. d12.
13. c14. d15. c 
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.