C100DBA MongoDB
C100DBA MongoDB
C100DBA MongoDB
C100DBA Exam
MongoDB Certified DBA Associate Exam
A. Multi-statement transactions
B. Joins
C. Authentication
Answer(s): A,B
2. The following aggregation option is used to specify the specific fields
that needs to be passed to the next stage of the aggregation pipeline:
A. $project
B. $aggregate
C. $match
D. $group
Answer(s): A
A. Skip and limit nullify each other. Hence returning the first five
documents.
B. Skips the first five documents and returns the next five
C. Limits the first five documents and then return them in reverse order
D. Skips the first five documents and returns the sixth document five
times
Answer(s): B
4. What tool do you use to see if you have a problem in the consumption of
disk I / 0?
A. Mongoperf
B. mongofile
Answer(s): A
A. Transaction Management
B. ACID Transactions
C. Journaling
Answer(s): C
6. The MongoDB explain() method does not support which of the following
verbosity mode:
A. executionStats
B. queryPlanner
C. customExecutionStats
D. allPlansExecution
Answer(s): A
7. Consider a collection posts which has fields: Jd, post_text, post_author,
post_timestamp, post_tags etc. Which of the following query retrieves
ONLY the key named post_text from the first document retrieved?
A. db.posts.finOne({},{_id:0, post_text:1})
B. db.posts.findOne({post_text: 1})
C. db.posts.find({},{_id:Of post_text:1})
D. db.posts.finOne«},{post_text:l})
Answer(s): A
8. In a sharded replica set environment, the w Option provides ability for
write concern and j Option provides ability for the data to be written on disk
journal. Consider that we have a seven member replica set and we want to
assure that the writes are committed to journal.
What should be the value of j?
A. 1
B. 2
C. 0
D. 7
Answer(s): B
9. Aggregation Pipelines have a limit of:
Answer(s): B
10. What is the maximum size of a MongoDB document?
A. 2 MB
B. 12 MB
Answer(s): D
11. If the value of totalKeysExamined is 30000 and the value of
totalDocsExamined is 0, which of the following option is correct?
Answer(s): B
12. Given a collection posts as shown below having a document array
comments, which of the following command will create an index on the
comment author descending?
A. db.posts.createIndex({commerits.$.author":-l});
B. db.posts.createIndex({comments.$.author": {$desc:l>});
C. db.posts.createIndex({comments.author":-l});
Answer(s): C
13. Which option should be used to update all the documents with the
specified condition in the MongoDB query?
Answer(s): D
14. Which mongodb tool is used to report details on number of database
operations in MongoDB?
A. mongorestore
B. mongostat
C. mongodump
D. mongotop
Answer(s): B
15. In a sharded replica set environment, the w Option provides ability for
write concern and j Option provides ability for the data to be written on disk
journal. Consider that we have a seven member replica set and we want to
assure that the writes are committed to journal.
What should be the value of j?
A. 7
B. 2
C. 1
D. 0
Answer(s): C
16. What read preference should your application use if you want to read
from the primary under normal circumstances but allow reads from
secondaries when a primary is unavailable?
A. secondaryPreferred
B. Secondary
C. nearest
D. primary
E. primaryPreferred
Answer(s): E
17. Which of the following operators is used to updated a document
partially?
A. $set
B. $update
C. $project
D. $modify
Answer(s): A
18. What is the first task that a secondary would perform on being
prompted by another secondary for an election?
B. Vote for the first secondary so that it would become the next primary
Answer(s): D
19. Which of the documents below will be retrieved by the following query?
Assume the documents are stored in a collection called "sample". Check
all that apply.
db.sample.find( { "$or" : [ { "a" : { "$in" : [ 3, 10] > }, { "b" : { "$lt" : 2 > > ] > )
Answer(s): D,E,F,I,J
20. JSON stands for
Answer(s): A
21. What is the replication factor for a replicated cluster with 1 primary, 3
secondaries with one of them hidden. The set also has an arbiter?
B. 5
C. 3
D. 4
Answer(s): D
22.Which operations add new documents to a collection?
A. Create
B. update
C. insert
D. delete
Answer(s): A,C
23. Consider that you have a collection called population which has fields
state and city. Which of the following query will calculate the population
grouped by state and city?
Answer(s): B
25. Which of the tags in a replica set configuration specify the operations
to be read from the node with the least network latency?
A. netLatency
B. secondaryPreferred
C. nearest
D. primaryPreferred
Answer(s): C
26. What is the output of the following program?
A. 60 s
B. 1s
C. 100 s
D. 100 ms
Answer(s): A
27. Which node in a replica set does accept write operation?
A. arbiter
B. hidden
C. primary
D. secondary
Answer(s): C
28. Using an arbiter allows one to easily ensure an odd number of voters in
replica sets. Why is this important?
Answer(s): B
29. Which of the following statements are true about the $match pipeline
operator? Check all that apply.
Answer(s): A,B,C
30. Which of the following is a valid Replica Set configuration if you want:
3 replicas), while RSI and RS2 could NOT have priority 0 or be hidden or
anything like that
In a 4-member RS RSO , RSI, RS2 and RS3 + Referee, RSO (primary) falls
after some write operations that have
replicated RSI and RS2 (but NOT RS3), who can get up as the new primary?
The configuration comes and in it we see that RS2 has a hidden: true (or a
priority: 0, (I don't remember)
A. ORS1
B. ORS2
C. ORS3
D. O arbiter
E. RSO
Answer(s): A
31. Given a replica set with five data-bearing members, suppose the
primary goes down with operations in its oplog that have been copied from
the primary to only one secondary. Assuming no other problems occur,
which of the following describes what is most likely to happen?
B. the secondary with the most current oplog will be elected primary
E. the most current secondary will roll back the operations following the
election
Answer(s): B
32. Which command can be used to rebuild the indexes on a collection in
MongoDB?
A. db.collection.createlndex({relndex:l})
B. db.collection.reIndex({author:l})
C. db.collection.relndexQ
D. db.collection.createIndex({author:l}).reIndex()
Answer(s): C
33. What does the totalKeysExamined field returned by the explain method
indicate?
Answer(s): B
34. In order to ensure that you can maintain high availability in the face of
server failure, you should implement which of the following?
A. Sharding
C. Replication
Answer(s): C
35. Which option can be used with update command so that a new
document gets created if no matching document is found based on the
query condition?
Answer(s): D
36. Dada una coleccion, cuales devuelve con la siguiente query
db.coleccion.find({nombre:"ruben",apellido:"gomez"},{nombre:l,apellido:l,
aficion:l});
Answer(s): A,D
37. MongoDB is
B. Object-oriented DBMS
C. Relational DBMS
D. Document-oriented DBMS
Answer(s): D
38. Which are the ONLY ways to project portions of an array?
A. $slice
B. $
D. $ elemMatch
Answer(s): C
39. In a replicated cluster, which of the following node would only be used
during an election?
A. arbiter
B. primary
C. hidden
D. secondary
Answer(s): A
40. Which of the following node is used during election in a replication
cluster?
A. primary
B. arbiter
C. hidden
D. secondary
Answer(s): B
41. You have designed a web application with mongoDB. You have
configured replication. The replica set is in place and function properly.
What happens in case of failure?
A. Switchover needs to be done manually
Answer(s): B
42. You have a replicated cluster with 1 primary, 3 secondary, 1 arbiter. One
of the secondary is hidden. What is the replication factor of this replicated
cluster?
A. 7
B. 03
C. 04
D. 06
Answer(s): C
41. In a replica set, a_________number of members ensures that the replica
set is always able to select a primary.
A. Even
B. Odd
C. 2
Answer(s): B
42. Consider that you have a collection called population which has fields
state and city. Which of the following query will calculate the population
grouped by state and city?
Answer(s): C
43. Which of the following operator can be used to limit the number of
documents in an array field of a document after an update is performed?
A. $arrayLimit
C. $removeFromSet
Answer(s): B
44. Which mongodb tools allow us to work with our data in a human
readable format?
A. mongoexport
B. mongostat
C. mongoimport
D. mongodump
Answer(s): A,C
45. Write the command(s) are correct to enable sharding on a database
"testdb" and shard a collection "testCollection" with _id as shard key.
A. sh.enableSharding("testdb") &
sh.shardCollection("testdb.testCollection", {_id : 1 }, true )
Answer(s): A
46. Which of the following is true about aggregation framework?
Answer(s): A,C,D
47. What is the use of mongodump and mongorestore tools?
Answer(s): A
48. Which of the following are common uses of the mongo shell? Check all
that apply
Answer(s): A,B
49. When should we consider representing a one-to-many relationship in
an embedded collection instead of separate collection?
C. Always
D. Never
Answer(s): A
50. Which of the following command is used to get all the indexes on a
collection?
A. db.collection.showIndexes()
B. db.collection.findlndexes()
C. db.showIndexes()
D. db.collection.getlndexesQ
Answer(s): D
51. If you have created a compound index on (A,B, C) which of the
following access pattern will not be able to utilize the index?
A. A, B, C
B. A
C. B, C
D. A, B
Answer(s): C
52. Mongodb does provide high availability via which option?
A. Replication
B. Indexing
C. Sharding
D. Journaling
Answer(s): A
53. You are in a sharded cluster. What will you do prior to initiating backup
in sharded cluster?
A. db.stopBalancer()
B. db.stopserver()
C. sh.stopBalancer()
D. sh.stopserverQ
Answer(s): C
54. You are comparing values of different BSON types in mongodb. You
want to compare from lowest to highest. Which comparison order is used?
Answer(s): A
55. Below is a sample document in a given collection test.
{ a : 5, b : 3, c: 2, d : 1 >
Given a compound index { a: 1, b:l, c:l, d:l}, Which of the below query will
not use in- memory sorting? Select all valid.
A. db.test.find( { a: 5, b: 3 } ).sort( { c: 1, d : 1 } )
B. db.test.find( { a: 5, b: 3 } ).sort( { a: 1} )
Answer(s): A,D
56. Which of the following is incorrect statement about find and findOne
operations in MongoDB?
Answer(s): D
57. Which of the following aggregate commands in MongoDB uses a
pipeline approach with the goals of improving the aggregation
performance?
A. mapReduce
B. group
C. aggregate
Answer(s): C
58. `$set' sets the value of
A. Code block
B. Name/value pair
C. Key
D. None of the above
Answer(s): C
59. You perform the following query on the sayings collection, which has
the index
{ quote : "text" }:
Assuming the documents below are in the collection, which ones will the
following query return? Check all that apply.
Answer(s): B,C
60. What tool would you use if you want to save a gif file in mongo?
A. mongofile
B. Mongoperf
Answer(s): A
61. Which option can be used with update command so that a new
document gets created if no matching document is found based on the
query condition?
A. 16 MB
B. 12 MB
C. 2 MB
Answer(s): A
63. The oplog (operations log) is a special capped collection that keeps a
rolling record of all operations that modify the data stored in your
databases. All the replica set members contain a copy of the oplog in the
following collection:
A. <replicasetid>.oplog.rs
B. oplog.rs
C. <database>..oplog.rs
D. local.oplog.rs
Answer(s): D
64. In a collection that contains 100 post documents, what does the
following command do? db. posts. find().skip(5).limit(5)
A. Skip and limit nullify each other. Hence returning the first five
documents
B. Limits the first five documents and then return them in reverse order
C. Skips the first five documents and returns the sixth document five
times
D. Skips the first five documents and returns the next five
Answer(s): D
65. In a sharded replicas set environment with multiple mongos servers,
which of the following would decide the mongos failover?
A. mongos
B. mongo shell
D. mongod
Answer(s): C
66. In what format does mongodump creates backup files?
A. BSON
B. JSON
C. SOAP
D. XML
Answer(s): A
67. In which of the following scenarios is sharding not the correct option.
Select all that apply.
Answer(s): A,D
68. Consider the following posts document:
Which of the following queries will return the documents but with only the
first two tags in the tags array?
A. db.posts.find({author:"Tom"».limit({tags:2})
B. db.posts.find({author:"Tom"».limit($slice:{tags:2>)
D. db.posts.find({author:"Tom">,{tags:{$slice:2»)
Answer(s): D
69. Given a collection posts as shown below having a document array
comments, which of the following command will create an index on the
comment author descending?
A. db.posts.createIndex({^comments.$.author":-l});
C. db.posts.createIndex({^commerits.author";-!});
Answer(s): C
70. Which of the following collections stores authentication credentials in
MongoDB?
A. test.users
B. local.users
C. system.users
D. users.users
Answer(s): C
1. Which features of relational database management systems were
deliberately omitted in MongoDB and help us to obtain horizontal
scalability? Check all that apply.
Answer :
Multi-statement transactions
Joins
2. In a collection that contains 100 post documents, what does the following
command do? db. posts. find().skip(5).limit(5)
Answer :
Skips the first five documents and returns the next five
Answer :
Journaling
Answer :
16 MB document and 100 MB RAM
Answer :
The query used an index to fetch the results
Answer :
4
Answer :
Create
insert
9. Hat RSI and RS2 can be primary? You had to see the different
configurations, RS3 could be hidden or priority 0 (But not a referee because
we need 3 replicas), while RSI and RS2 could NOT have priority 0 or be
hidden or anything like that . In a 4-member RS RSO, RSI, RS2 and RS3 +
Referee, RSO (primary) falls after some write operations that have replicated
RSI and RS2 (but NOT RS3), who can get up as the new primary?
The configuration comes and in it we see that RS2 has a hidden: true (or a
priority: 0, (I don't remember)
Answer :
ORS1
10. Given a replica set with five data-bearing members, suppose the primary
goes down with operations in its oplog that have been copied from the
primary to only one secondary. Assuming no other problems occur, which of
the following describes what is most likely to happen?
In order to ensure that you can maintain high availability in the face of server
failure, you should implement which of the following?
Answer :
Replication
11. MongoDB is________.
Answer :
Document-oriented DBMS
12. In a replicated cluster, which of the following node would only be used
during an election?
Answer :
arbiter
13. The following aggregation option is used to specify the specific fields that
needs to be passed to the next stage of the aggregation pipeline:
Answer :
$project
14. The MongoDB explain() method does not support which of the following
verbosity mode:
Answer :
executionStats
15. Consider a collection posts which has fields: Jd, post_text, post_author,
post_timestamp, post_tags etc. Which of the following query retrieves ONLY
the key named post_text from the first document retrieved?
Answer :
db.posts.finOne({},{_id:0, post_text:1})
16. Which option should be used to update all the documents with the
specified condition in the MongoDB query?
Answer :
specify {multi: true} as the third parameter of update
command
Answer :
mongostat
18. In a sharded replica set environment, the w Option provides ability for
write concern and j Option provides ability for the data to be written on disk
journal. Consider that we have a seven member replica set and we want to
assure that the writes are committed to journal. What should be the value of
j?
Answer :
1
19. What read preference should your application use if you want to read
from the primary under normal circumstances but allow reads from
secondaries when a primary is unavailable?
Answer :
primaryPreferred
20. What is the first task that a secondary would perform on being prompted
by another secondary for an election?
Answer :
Connect to primary to confirm its availability
21. Consider that you have a collection called population which has fields
state and city. Which of the following query will calculate the population
grouped by state and city?
Answer :
db.population.aggregate( [{ $group: { _id: { state: Estate ", city: n$city
" },pop: { $sum: "$pop " } } }] )
22. Which of the following is true about sharding?
Answer :
We cannot change a shard key directly/automatically once it is set up
23. Which of the tags in a replica set configuration specify the operations to
be read from the node with the least network latency?
Answer :
nearest
Answer :
To protect agains network partitions
25. Which of the following statements are true about the $match pipeline
operator? Check all that apply.
Answer :
You should use it early as possible in the pipeline
It can be used as many time as needed
It has a sintax similar to findQ commands.
26. Which command can be used to rebuild the indexes on a collection in
MongoDB?
Answer :
db.collection.relndexQ
27. What does the totalKeysExamined field returned by the explain method
indicate?
Answer :
Number of index entries scanned
28. Which option can be used with update command so that a new document
gets created if no matching document is found based on the query condition?
Answer :
Specify {upsert : true } as the third parameter of update command
Answer :
{ "-id " : Objectld( "580a42b5dfblb5al7427d302 "), "nombre " : "ruben
", "apellido " : "gomez ", "aficion " : v u "flipar " }
{ "_id " : Objectld( "580a42acdfblb5al7427d301 "), "nombre " : "ruben
", "apellido " : "gomez " >
Answer :
arbiter
31. Which of the documents below will be retrieved by the following query?
Assume the documents are stored in a collection called "sample ". (Choose
all that apply)
Answer :
{''__id " :3, "a ": 4, "c " :0, "b " :14}
{ ''Jd " :9, "a ": 17, "c ": 1, "b ": 1}
{ Jd " :10, "a ": 3, "c ": 1, "b ": 1}
{ ".Jd " :: 2, "a ": 2, "c " :: 0, "b ": 1}
33. The following aggregation option is used to specify the specific fields
that needs to be passed to the next stage of the aggregation pipeline:
$project
$aggregate
$match
$group
34. In a collection that contains 100 post documents, what does the
following command do? db. posts. find().skip(5).limit(5)
Skip and limit nullify each other. Hence returning the first five documents.
Skips the first five documents and returns the next five
Limits the first five documents and then return them in reverse order
Skips the first five documents and returns the sixth document five times
36. The MongoDB explain() method does not support which of the following
verbosity mode:
executionStats
queryPlanner
customExecutionStats
allPlansExecution
Which of the following query retrieves ONLY the key named post_text from
the first document retrieved?
db.posts.finOne({},{_id:0, post_text:1})
db.posts.findOne({post_text: 1})
db.posts.find({},{_id:Of post_text:1})
db.posts.finOne«},{post_text:l})
38. In a sharded replica set environment, the w Option provides ability for
write concern and j Option provides ability for the data to be written on disk
journal. Consider that we have a seven member replica set and we want to
assure that the writes are committed to journal.
43. Which option should be used to update all the documents with the
specified condition in the MongoDB query?
specify {all: true} as the third parameter of update command
updateAII instead of update
specify {updateAII: true} as the third parameter of update command
specify {multi: true} as the third parameter of update command
46. What read preference should your application use if you want to read
from the primary under normal circumstances but allow reads from
secondaries when a primary is unavailable?
secondaryPreferred
Secondary
nearest
primary
primaryPreferred
48. What is the first task that a secondary would perform on being
prompted by another secondary for an election?
Start the election process for primary
Vote for the first secondary so that it would become the next primary
Vote for itself and then call for election
Connect to primary to confirm its availability
49. Which of the documents below will be retrieved by the following query?
Assume the documents are stored in a collection called "sample". Check
all that apply.
db.sample.find( { "$or" : [ { "a" : { "$in" : [ 3, 10] > }, { "b" : { "$lt" : 2 > > ] > )
{''__id" :3, "a": 4, "c" :0, "b" :14}
{''_Jd" :7, "a": 8, "c" :1, "b" :7}
{".Jd" :6, "a": 1, "c" :1, "b" :5}
{ ''Jd" :9, "a": 17, "c": 1, "b": 1}
{ Jd" :10,"a": 3, "c": 1, "b": 1}
{".Jd" :: 2, "a": 2, "c" :: 0, "b": 1}
{".Jd" :: 4, "a": 5, "c" :: 0, "b": 17}
{".Jd" :: 1, "a": 0, "c" :: 0, "b": 2}
{".Jd" :: 5, "a": 3, "c" :: 0, "b": 12}
{".Jd" :: 8, "a": 11, "c": 1, "b": 0}
51. What is the replication factor for a replicated cluster with 1 primary, 3
secondaries with one of them hidden. The set also has an arbiter?
None of the above
5
3
4
Which of the following query will calculate the population grouped by state
and city?
db.population.aggregate( [{ $group: { _id: { state: "$state", city; "$city" },pop: {
$sum: 1 > > >] )
db.population.aggregate( [{ $group: { _id: { state: Estate", city: "$city" },pop: {
$pop: 1 } } }] )
db.population.aggregate( [{ $group: { _id: { state: Estate", city: n$city"
},pop: { $sum: "$pop" } } }] )
db.population.aggregate( [{ $group: { _id: { city: "$city" },pop: { $sum: "$pop" } } }]
)Multi Document Transaction is not supported by MongoDB
55. Which of the tags in a replica set configuration specify the operations
to be read from the node with the least network latency?
netLatency
secondaryPreferred
nearest
primaryPreferred
58. Using an arbiter allows one to easily ensure an odd number of voters in
replica sets.
59. Which of the following statements are true about the $match pipeline
operator? Check all that apply.
You should use it early as possible in the pipeline
It can be used as many time as needed.
It has a sintax similar to findQ commands.
You had to see the different configurations, RS3 could be hidden or priority
0 (But not a referee because we need 3 replicas), while RSI and RS2 could
NOT have priority 0 or be hidden or anything like that .
In a 4-member RS RSO, RSI, RS2 and RS3 + Referee, RSO (primary) falls
after some write operations that have replicated RSI and RS2 (but NOT
RS3), who can get up as the new primary?
The configuration comes and in it we see that RS2 has a hidden: true (or a
priority: 0, (I don't remember)
ORS1
ORS2
ORS3
O arbiter
RSO
61. Given a replica set with five data-bearing members, suppose the
primary goes down with operations in its oplog that have been copied from
the primary to only one secondary.
63. What does the totalKeysExamined field returned by the explain method
indicate?
Number of documents that match the query condition
Number of index entries scanned
Details the completed execution of the winning plan as a tree of stages
Number of documents scanned
64. In order to ensure that you can maintain high availability in the face of
server failure, you should implement which of the following?
Sharding
Properly defined user roles
Replication
Put indexes on all of your documents
The proper storage engine
65. Which option can be used with update command so that a new
document gets created if no matching document is found based on the
query condition?
upsert command instead of update command
{update: true, insert: true} as the third parameter of update command
This has to be handled in application code (Node.js, PHP, JAVA, C#, etc.) and
cannot be handled in mongo shell query
Specify {upsert : true } as the third parameter of update command
67. MongoDB is
None of the above
Object-oriented DBMS
Relational DBMS
Document-oriented DBMS
68. Which are the ONLY ways to project portions of an array?
$slice
$
All of the above
$ elemMatch
69. In a replicated cluster, which of the following node would only be used
during an election?
Arbiter
primary
hidden
secondary