Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages
Filter by Categories
nmims post
Objective Type Set
Online MCQ Assignment
Question Solution
Solved Question
Uncategorized

MongoDB MCQ Set 1

1. Which of the following collection do not support the TTL property ?
a) Compound indexes
b) Primary indexes
c) Composite indexes
d) All of the mentioned

View Answer

Answer: a [Reason:] The TTL index is a single field index.

2. Point out the correct statement :
a) Data expiration is useful for some classes of information, including machine generated event data, logs, and session information
b) A special TTL index property supports the implementation of TTL collections
c) TTL collections make it possible to store data in MongoDB and have the mongod automatically remove data after a specified number of seconds or at a specific clock time
d) All of the mentioned

View Answer

Answer: d [Reason:] The TTL feature relies on a background thread in mongod that reads the date-typed values in the index and removes expired documents from the collection.

3. If the indexed field in a document is not a _____ or an array that holds a date value(s), the document will not expire.
a) DATE
b) TIME
c) DATETIME
d) All of the mentioned

View Answer

Answer: a [Reason:] Built-in first-in-first-out property maintains the order of events, while managing storage use.

4. When the TTL thread is active, you will see _______ operations in the output of db.currentOp().
a) read
b) update
c) delete
d) all of the mentioned

View Answer

Answer: c [Reason:] When you build a TTL index in the background, the TTL thread can begin deleting documents while the index is building.

5. Point out the correct statement :
a) TTL indexes expire documents after the specified number of seconds has passed since the indexed field value
b) TTL indexes are special compound indexes
c) If a document does not contain the indexed field, the document will expire
d) None of the mentioned

View Answer

Answer: a [Reason:] The expiration threshold is the indexed field value plus the specified number of seconds.

6. Secondary members replicate _________ operations from the primary.
a) Update
b) Drop
c) Insert
d) None of the mentioned

View Answer

Answer: d [Reason:] On replica sets, the TTL background thread only deletes documents on the primary.

7. A collection with a TTL index has __________ enabled.
a) usePowerOf3Sizes
b) usePowerOf2Sizes
c) usePowerOf4Sizes
d) none of the mentioned

View Answer

Answer: b [Reason:] As a result of enabling usePowerOf2Sizes, MongoDB must allocate more disk space relative to data size.

8. Which field does not support TTL indexes ?
a) _identity
b) _option
c) _id
d) None of the mentioned

View Answer

Answer: c [Reason:] You cannot create a TTL index on a capped collection because MongoDB cannot remove documents from a capped collection.

9. You cannot use _________ to change the value of expireAfterSeconds of an existing index.
a) createIndex()
b) dropIndex()
c) removeIndex()
d) none of the mentioned

View Answer

Answer: a [Reason:] Instead use the collMod database command in conjunction with the index collection flag. Otherwise, to change the value of the option of an existing index, you must drop the index first and recreate.

10. You cannot create a TTL index on a ________ collection
a) Sharded
b) Capped
c) Primary
d) None of the mentioned

View Answer

Answer: b [Reason:] MongoDB cannot remove documents from a capped collection.

MongoDB MCQ Set 2

1. With the WiredTiger storage engine, use of _______ is strongly recommended to avoid performance issues
a) XFS
b) SSD
c) SST
d) All of the mentioned

View Answer

Answer: a [Reason:] Some Linux distributions require different versions of the kernel to support using XFS.

2. Point out the correct statement :
a) With the MMAPv1 storage engine, MongoDB preallocates its database files before using them and often creates large files
b) zlib provides better compression rate but has a higher performance cost
c) MongoDB includes support for many storage engines
d) All of the mentioned

View Answer

Answer: b [Reason:] WiredTiger uses prefix compression on all indexes by default.

3. MongoDB requires a filesystem that supports ______ on directories.
a) fsynconce()
b) fsync()
c) sync()
d) all of the mentioned

View Answer

Answer: b [Reason:] HGFS and Virtual Box’s shared folders do not support this operation.

4. MongoDB Cloud Manager provides integration with Amazon Web Services (AWS) and lets you deploy new ______ instances directly from MongoDB Cloud Manager.
a) ECS
b) EC2
c) EC3
d) All of the mentioned

View Answer

Answer: b [Reason:] MongoDB is compatible with EC2.

5. Point out the wrong statement :
a) When running MongoDB in production on Linux, it is recommended that you use Linux kernel version 2.6.36 or later
b) The MongoDB distribution for Solaris include support for the WiredTiger storage engine
c) By default, WiredTiger uses zip compression library
d) None of the mentioned

View Answer

Answer: c [Reason:] By default, WiredTiger uses snappy compression library.

6. WiredTiger can compress collection data using either snappy or zlib compression library.
a) snappy
b) zip
c) lib
d) Kit

View Answer

Answer: a [Reason:] snappy provides a lower compression rate but has little performance cost

7. Which of the following is especially important in Sharded Clusters ?
a) NSS
b) STP
c) NTP
d) SSD

View Answer

Answer: a [Reason:] Use the Network Time Protocol (NTP) to synchronize time among your hosts.

8. The TCP keepalive on the Azure load balancer is ______ seconds by default.
a) 100
b) 200
c) 240
d) None of the mentioned

View Answer

Answer: a [Reason:] You should set tcp_keepalive_time to 120 to ameliorate this problem.

9. On Linux, use the ______ command to check if disk I/O is a bottleneck for your database.
a) stat
b) iostats
c) iostat
d) none of the mentioned

View Answer

Answer: c [Reason:] Specify a number of seconds when running iostat to avoid displaying stats covering the time since server boot.

10. _____ is a command-line tool for monitoring network use.
a) bwm-ng
b) bwm-g
c) bwm-n
d) bwm-ngs

View Answer

Answer: a [Reason:] If you suspect a network-based bottleneck, you may use bwm-ng to begin your diagnostic process.

MongoDB MCQ Set 3

1. Which of the following relationship uses references to describe documents between connected data ?
a) One-to-One Relationships with Embedded Documents
b) One-to-Many Relationships with Embedded Documents
c) One-to-Many Relationships with Document References
d) None of the mentioned

View Answer

Answer: b [Reason:] One-to-Many Relationships with document references presents a data model that uses references to describe one-to-many relationships between documents.

2. Point out the correct statement :
a) One-to-One Relationships with embedded documents presents a data model that uses embedded documents to describe one-to-one relationships between connected data
b) One-to-One Relationships with document references presents a data model that uses embedded documents to describe one-to-one relationships between connected data
c) One-to-Many Relationships with embedded documents presents a data model that uses embedded documents to describe one-to-one relationships between connected data
d) All of the mentioned

View Answer

Answer: a [Reason:] One-to-Many Relationships with embedded documents presents a data model that uses embedded documents to describe one-to-many relationships between connected data.

3. If the address data is frequently retrieved with the name information,how will you modify the following schema representing one to one relationship with referencing ?

{
   _id: "joe",
   name: "Joe Bookreader"
}
{
   patron_id: "joe",
   street: "123 Fake Street",
   city: "Faketon",
   state: "MA",
   zip: "12345"
}

a)

 {
   _id: "joe",
   name: "Joe Bookreader",
   address: {
              street: "123 Fake Street",
              city: "Faketon",
              state: "MA",
              zip: "12345"
            }
} 

b)

 {
   _id: "joe",
   name: "Joe Bookreader",
   address-> {
              street: "123 Fake Street",
              city: "Faketon",
              state: "MA",
              zip: "12345"
            }
} 

c)

 {
   _id: "joe",
   name: "Joe Bookreader",
   address:: {
              street: "123 Fake Street",
              city: "Faketon",
              state: "MA",
              zip: "12345"
            }
} 

d) All of the mentioned

View Answer

Answer: a [Reason:] With the embedded data model, your application can retrieve the complete patron information with one query.

4. Which of the following is used to avoid repetition of data in MongoDB schema ?
a) DeReferences
b) References
c) Cursor
d) Collectors

View Answer

Answer: b [Reason:] When using references, the growth of the relationships determine where to store the reference.

5. Point out the wrong statement :
a) Decisions that affect how you model data can affect application performance and database capacity
b) Collections do enforce document structure
c) Data in MongoDB has a flexible schema
d) None of the mentioned

View Answer

Answer: b [Reason:] Collections do not enforce document structure.

6. What would be the more optimal schema to embed the address data entities in the patron data for following schema representing one to many relationship ?

{
   _id: "joe",
   name: "Joe Bookreader"
}
{
   patron_id: "joe",
   street: "123 Fake Street",
   city: "Faketon",
   state: "MA",
   zip: "12345"
}
{
   patron_id: "joe",
   street: "1 Some Other Street",
   city: "Boston",
   state: "MA",
   zip: "12345"
} 

a)

{
   _id: "joe",
   name: "Joe Bookreader",
   addresses: [
                {
                  street: "123 Fake Street",
                  city: "Faketon",
                  state: "MA",
                  zip: "12345"
                },
                {
                  street: "1 Some Other Street",
                  city: "Boston",
                  state: "MA",
                  zip: "12345"
                }
              ]
 } ?

b)

{
   _id: "joe",
   name: "Joe Bookreader",
   addresses: [
                {
                  street: "123 Fake Street",
                  city: "Faketon",
                  state: "MA",
                  zip: "12345"
                },
                [
                  street: "1 Some Other Street",
                  city: "Boston",
                  state: "MA",
                  zip: "12345"
                ]
              ]
 } ?

c)

{
   _id: "joe",
   name: "Joe Bookreader",
   addresses: [
                [
                  street: "123 Fake Street",
                  city: "Faketon",
                  state: "MA",
                  zip: "12345"
                ],
                {
                  street: "1 Some Other Street",
                  city: "Boston",
                  state: "MA",
                  zip: "12345"
                }
              ]
 } ?

d) None of the mentioned

View Answer

Answer: a [Reason:] In this one-to-many relationship between patron and address data, the patron has multiple address entities.

7. How will avoid mutable, growing arrays in the following schema ?

{
   name: "O'Reilly Media",
   founded: 1980,
   location: "CA",
   books: [12346789, 234567890, ...]
}
{
    _id: 123456789,
    title: "MongoDB: The Definitive Guide",
    author: [ "Kristina Chodorow", "Mike Dirolf" ],
    published_date: ISODate("2010-09-24"),
    pages: 216,
    language: "English"
}
{
   _id: 234567890,
   title: "50 Tips and Tricks for MongoDB Developer",
   author: "Kristina Chodorow",
   published_date: ISODate("2011-05-06"),
   pages: 68,
   language: "English"
} 

a)

{
   _id: "oreilly",
   name: "O'Reilly Media",
   founded: 1980,
   location: "CA"
}
[
   _id: 123456789,
   title: "MongoDB: The Definitive Guide",
   author: [ "Kristina Chodorow", "Mike Dirolf" ],
   published_date: ISODate("2010-09-24"),
   pages: 216,
   language: "English",
   publisher_id: "oreilly"
]
{
   _id: 234567890,
   title: "50 Tips and Tricks for MongoDB Developer",
   author: "Kristina Chodorow",
   published_date: ISODate("2011-05-06"),
   pages: 68,
   language: "English",
   publisher_id: "oreilly"
}

b)

{
   _id: "oreilly",
   name: "O'Reilly Media",
   founded: 1980,
   location: "CA"
}
[
   _id: 123456789,
   title: "MongoDB: The Definitive Guide",
   author: [ "Kristina Chodorow", "Mike Dirolf" ],
   published_date: ISODate("2010-09-24"),
   pages: 216,
   language: "English",
   publisher_id: "oreilly"
]
[
   _id: 234567890,
   title: "50 Tips and Tricks for MongoDB Developer",
   author: "Kristina Chodorow",
   published_date: ISODate("2011-05-06"),
   pages: 68,
   language: "English",
   publisher_id: "oreilly"
]

c)

{
   _id: "oreilly",
   name: "O'Reilly Media",
   founded: 1980,
   location: "CA"
}
{
   _id: 123456789,
   title: "MongoDB: The Definitive Guide",
   author: [ "Kristina Chodorow", "Mike Dirolf" ],
   published_date: ISODate("2010-09-24"),
   pages: 216,
   language: "English",
   publisher_id: "oreilly"
}
{
   _id: 234567890,
   title: "50 Tips and Tricks for MongoDB Developer",
   author: "Kristina Chodorow",
   published_date: ISODate("2011-05-06"),
   pages: 68,
   language: "English",
   publisher_id: "oreilly"
}

d) None of the mentioned

View Answer

Answer: c [Reason:] To avoid mutable, growing arrays, store the publisher reference inside the book document.

8. __________ define what records to select for read, update, and delete operations.
a) Query optimizer
b) Query selector
c) Update definitions
d) All of the mentioned

View Answer

Answer: b [Reason:] Update definitions, which define what fields to modify during an update.

9. The ___________ JavaScript shell and the MongoDB language drivers translate between BSON and the language-specific document representation.
a) mongod
b) mongo
c) json
d) none of the mentioned

View Answer

Answer: b [Reason:] MongoDB stores documents on disk in the BSON serialization format. BSON is a binary representation of JSON documents, though it contains more data types than JSON.

10. Which of the following statement is incorrect about documents in MongoDB ?
a) The field names cannot start with the dollar sign ($) character
b) The field names cannot contain the dot (.) character
c) The field names cannot contain the null character
d) None of the mentioned

View Answer

Answer: d [Reason:] BSON documents may have more than one field with the same name.

MongoDB MCQ Set 4

1. ___________ data models allow applications to store related pieces of information in the same database record.
a) Reference
b) Embedded
c) External
d) None of the mentioned

View Answer

Answer: b [Reason:] As a result, applications may need to issue fewer queries and updates to complete common operations.

2. Point out the correct statement :
a) With MongoDB, you cannot embed related data in a single structure or document
b) The key consideration for the structure of your documents is the decision to embed or to use references
c) Reference schema is generally known as “denormalized” models
d) None of the mentioned

View Answer

Answer: b [Reason:] Effective data models support your application needs.

3. Embedded data model is used when you have _________ relationships between entities
a) contains
b) isa
c) inheritance
d) all of the mentioned

View Answer

Answer: a [Reason:] Embedding provides better performance for read operations.

4. Normalized data models describe relationships using ___________ between documents.
a) relativeness
b) references
c) evaluation
d) none of the mentioned

View Answer

Answer: b [Reason:] Normalized data models can require more round trips to the server.

5. Point out the wrong statement :
a) Embedded data models make it possible to update related data in a single atomic write operation
b) Embedding related data in documents may lead to situations where documents grow after creation
c) With the MMAPv1 storage engine, document growth can impact write performance and lead to data fragmentation
d) All of the mentioned

View Answer

Answer: d [Reason:] In version 3.0.0, MongoDB uses Power of 2 Sized Allocations as the default allocation strategy for MMAPv1 in order to account for document growth, minimizing the likelihood of data fragmentation.

6. To interact with embedded documents, use ___________ notation to “reach into” embedded documents.
a) period
b) dot
c) comma
d) colon

View Answer

Answer: b [Reason:] References provides more flexibility than embedding.

7. MongoDB using the mmapv1 storage engine has limits on the number of __________ .
a) namespaces
b) collections
c) documents
d) none of the mentioned

View Answer

Answer: a [Reason:] The namespace file defaults to 16 MB.

8. To get the current number of namespaces in the mongo shell, use :
a) db.system.namespaces.countc()
b) db.system.namespaces.count(*)
c) db.system.namespaces.count()
d) all of the mentioned

View Answer

Answer: c [Reason:] The limit on the number of namespaces depend on the .ns size.

9. The __________ feature of collections expires documents after a period of time.
a) TEL
b) TTL
c) TPL
d) None of the mentioned

View Answer

Answer: b [Reason:] Consider using the TTL feature if your application requires some data to persist in the database for a limited period of time.

10. Capped collections provide __________ management of inserted documents in MongoDB.
a) FIFO
b) LIFO
c) LRU
d) MRU

View Answer

Answer: a [Reason:] Capped collections efficiently support operations that insert and read documents based on insertion order.

MongoDB MCQ Set 5

1. ________ store the relationships between data by including links or references from one document to another.
a) Capped
b) Embedded
c) External
d) References

View Answer

Answer: d [Reason:] Applications can resolve these references to access the related data. Broadly, these are normalized data models.

2. Point out the correct statement :
a) In practice, the documents in a collection share a different structure
b) Data in MongoDB has a flexible schema
c) The key challenge in data modeling is balancing the needs of the application, the performance characteristics of the database engine, and the data retrieval patterns
d) None of the mentioned

View Answer

Answer: b [Reason:] MongoDB’s collections do not enforce document structure.

3. In MongoDB, write operations are atomic at the __________ level.
a) collection
b) document
c) row
d) all of the mentioned

View Answer

Answer: b [Reason:] No single write operation can atomically affect more than one document or more than one collection.

4. ______________ documents capture relationships between data by storing related data in a single document structure.
a) Capped
b) Embedded
c) External
d) Internal

View Answer

Answer: b [Reason:] MongoDB documents make it possible to embed document structures in a field or array within a document.

5. Point out the wrong statement :
a) The key decision in designing data models for MongoDB applications revolves around the structure of documents and how the application represents relationships between data
b) There are two tools that allow applications to represent these relationships: references and embedded documents
c) When designing data models, always consider the application usage of the data (i.e. queries, updates, and processing of the data) as well as the inherent structure of the data itself
d) All of the mentioned

View Answer

Answer: d [Reason:] Denormalized data models allow applications to retrieve and manipulate related data in a single database operation.

6. A ____________ data model with embedded data combines all related data for a represented entity in a single document.
a) normalized
b) denormalized
c) non relational
d) relational

View Answer

Answer: b [Reason:] This facilitates atomic write operations since a single write operation can insert or update the data for an entity.

7. For the __________ storage engine, if the document size exceeds the allocated space for that document, MongoDB relocates the document on disk.
a) MAPv1
b) MAPv2
c) MAPv3
d) MAPv4

View Answer

Answer: c [Reason:] Normalizing the data would split the data across multiple collections and would require multiple write operations that are not atomic collectively.

8. With MongoDB 3.0.0,the default use of the Power of _________ Allocations minimizes the occurrences of re-allocations as well as allows for the effective reuse of the freed record space.
a) 2 Sized
b) 3 Sized
c) 4 Sized
d) 5 Sized

View Answer

Answer: a [Reason:] When using MMAPv1, if your applications require updates that will frequently cause document growth to exceeds the current power of 2 allocation, you may want to refactor your data model to use references between data in distinct documents rather than a denormalized data model.

9. ___________ strategy is used to explicitly avoid document growth.
a) deallocation
b) allocation
c) pre-allocation
d) none of the mentioned

View Answer

Answer: c [Reason:] A data model that embeds related data in a single document facilitates atomic operations.

10. Each index in MongoDB requires at least _________ of data space.
a) 8KB
b) 28KB
c) 68KB
d) 108KB

View Answer

Answer: a [Reason:] Adding an index has some negative performance impact for write operations.