Weekend Special - 75% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: discactive

MongoDB C100DBA MongoDB Associate Database Administrator(Based on MongoDB 6.0 and 7.0+) Exam Practice Test

Page: 1 / 17
Total 172 questions

MongoDB Associate Database Administrator(Based on MongoDB 6.0 and 7.0+) Questions and Answers

Question 1

Which of the following does MongoDB use to provide High Scalability?

Options:

A.

Replication

B.

Write Concern

C.

Indexing

D.

Sharding

Question 2

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?

Options:

A.

missing operations will need to be manually re-performed

B.

the secondary with the most current oplog will be elected primary

C.

reads will be stale until the primary comes back up

D.

the primary may roll back the operations once it recovers

E.

the most current secondary will roll back the operations following the election

Question 3

Which of the following is incorrect statement about find and findOne operations in MongoDB?

Options:

A.

findQ returns all the documents in a collection while findOne() retrieves only the first one.

B.

find.limit(l) is not the same query as findOne()

C.

findOneQ returns the actual first document retrieved from a collection

D.

findQ and findOneQ returns cursors to the collection documents

Question 4

Which are the ONLY ways to project portions of an array?

Options:

A.

$slice

B.

$

C.

All of the above

D.

$ elemMatch

Question 5

A MongoDB database administrator needs to improve the performance of the following query:

db.employees.find(

{},

{ name: 1, department: 0, salary: 1 }

).sort({ department: 1, salary: -1 });

What index should the administrator use to achieve this goal?

Options:

A.

db.employees.createIndex({ department: 1, salary: 1, name: 1 });

B.

db.employees.createIndex({ department: 1, salary: -1 });

C.

db.employees.createIndex({ salary: 1, name: 1, department: 0 });

D.

db.employees.createIndex({ name: 1, department: 1, salary: -1 });

Question 6

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?

Options:

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})

Question 7

Which node in a replica set does accept write operation?

Options:

A.

arbiter

B.

hidden

C.

primary

D.

secondary

Question 8

A MongoDB administrator is currently managing a single node MongoDB Enterprise deployment. The administrator is considering setting up replication with a secondary node and a delayed member.

Which TWO reasons align to the objectives of the administrator?

Options:

A.

Minimizing data loss when there are human errors.

B.

Allowing longer term data retention.

C.

Distributing data.

D.

Providing higher availability.

E.

Enabling encryption at rest.

Question 9

Which of the following needs to be performed prior to initiate backup on a sharded cluster?

Options:

A.

db.stopBalancer( )

B.

sh.stopServer( )

C.

db.stopServer( )

D.

sh.stopBalancer( )

Question 10

What does the following $slice query return using the following command? db.posts.find( {}, { comments: { $slice: [ -10, 5 ] } } )

Options:

A.

Returns 5 comments, beginning with the last 10 items

B.

Returns 10 comments, beginning with the last

C.

Returns 10 comments, beginning with the first

D.

Returns 5 comments, beginning with the first 10 items

Question 11

Consider a clothing collection that contains these documents:

{ " _id " : 1, " item " : " sweater " , " sizes " : [ " XS " , " S " ] }

{ " _id " : 2, " item " : " t-shirt " , " sizes " : [ " S " , " M " , " XL " ] }

{ " _id " : 3, " item " : " vest " , " sizes " : [ " M " , " L " , " XL " , " XXL " ] }

What does the following query return?

db.clothing.find({ " sizes " : " M " })

Options:

A.

Only document _id: 3.

B.

All three documents.

C.

Only document _id: 2.

D.

Documents _id: 2 and _id: 3.

Question 12

What tool do you use to see if you have a problem in the consumption of disk I / 0?

Options:

Question 13

Which TWO commands can be used to remove the role, " specialRole " from " user1 " ?

Options:

A.

db.revokeRolesFromUser( " user1 " , [{ " myDB " : " specialRole " }])

B.

db.revokeRoleFromUser( " user1 " , " specialRole " )

C.

db.revokeRolesFromUser( " user1 " , [{ role: " specialRole " , db: " myDB " }])

D.

db.revokeRoleFromUser({ user: " user1 " , role: " specialRole " })

E.

db.revokeRolesFromUser( " user1 " , [ " specialRole " ])

Question 14

A MongoDB administrator is managing a database for a hospital system.

The patients collection contains:

- Carlos Martinez, diagnosis Hypertension, room 203

- Maria Lopez, diagnosis Hypertension, room 207

- Juan Perez, diagnosis Arrhythmia, room 207

The administrator runs:

db.patients.updateMany(

{ diagnosis: " Hypertension " },

{ $set: { room: 207 } }

)

What output should the administrator expect?

Options:

A.

acknowledged: true, matchedCount: 1, modifiedCount: 1

B.

acknowledged: true, matchedCount: 3, modifiedCount: 1

C.

acknowledged: true, matchedCount: 1, modifiedCount: 2

D.

acknowledged: true, matchedCount: 2, modifiedCount: 1

Question 15

Which of the following is a valid Replica Set configuration if you want:

1-Have 3 copies of everything

2- That RS3 is never primary

2- That 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)

Options:

A.

ORS1

B.

ORS2

C.

ORS3

D.

O arbiter

E.

RSO

Question 16

The difference between $push and $addToSet is:

Options:

A.

$addToSet needs the fields to be already present while $push will work even if the field is not present

B.

$addToSet adds the item to the field only if it does not exist already; while $push pushes the item to the field irrespective of whether it was present or not

C.

$addToSet adds the item to the field only if the new item is of the same datatype

D.

There is no major difference between them. $addToSet is a deprecated version of $push.

Question 17

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?

Question # 17

Options:

A.

db.posts.createIndex({commerits.$.author " :-l});

B.

db.posts.createIndex({comments.$.author " : {$desc:l > });

C.

db.posts.createIndex({comments.author " :-l});

Question 18

Which of the following node is used during election in a replication cluster?

Options:

A.

primary

B.

arbiter

C.

hidden

D.

secondary

Question 19

What is the equivalent command in MongoDB for the following SQL query?

SELECT * FROM posts WHERE author like " %john% "

Options:

A.

db.posts.find( { author: /John/ } )

B.

db.posts.find( { author: /AjohnA/ > )

C.

db.posts.find( { $like: {author: /John/} } )

D.

db.posts.find( { author: {$like: /John/} } )

Question 20

What command is used to grant a role " customRole1 " to an existing user called " user1 " ?

Options:

A.

db.grantRoles( " user1 " , [ " customRole1 " ])

B.

db.createUser({ user: " user1 " , pwd: " pwd1 " , roles: [{ role: " customRole1 " , db: " admin " }] })

C.

db.addRoleToUser( " user1 " , [ " customRole1 " ])

D.

db.grantRolesToUser( " user1 " , [ " customRole1 " ])

Question 21

In a sharded replicas set environment with multiple mongos servers, which of the following would decide the mongos failover?

Options:

A.

mongos

B.

mongo shell

C.

individual language drivers

D.

mongod

Question 22

A collection and a document in MongoDB is equivalent to which of the SQL concepts respectively?

Options:

A.

Column and Row

B.

Table and Row

C.

Database and Table

D.

Table and Column

Question 23

Which is the default mode in which the explain() command runs?

Options:

A.

allPlansExecution

B.

customExecutionStats

C.

queryPlanner

D.

executionStats

Question 24

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 > > ] > )

Options:

A.

{ ' ' __id " :3, " a " : 4, " c " :0, " b " :14}

B.

{ ' ' _Jd " :7, " a " : 8, " c " :1, " b " :7}

C.

{ " .Jd " :6, " a " : 1, " c " :1, " b " :5}

D.

{ ' ' \Jd " :9, " a " : 17, " c " : 1, " b " : 1}

E.

{ \Jd " :10, " a " : 3, " c " : 1, " b " : 1}

F.

{ " .Jd " :: 2, " a " : 2, " c " :: 0, " b " : 1}

G.

{ " .Jd " :: 4, " a " : 5, " c " :: 0, " b " : 17}

Question 25

You are in a sharded cluster. What will you do prior to initiating backup in sharded cluster?

Options:

A.

db.stopBalancer()

B.

db.stopserver()

C.

sh.stopBalancer()

D.

sh.stopserverQ

Question 26

Which of the following does MongoDB use to provide High Availability and fault tolerance?

Options:

A.

Sharding

B.

Indexing

C.

Replication

D.

Write Concern

Question 27

' mongoimport ' command is used for

Options:

A.

Batch data insertion

B.

None of the above

C.

Multiple command import

D.

Multiple command insertion

Question 28

A MongoDB administrator needs to create a new role with only the read privileges for the products database.

What command should the administrator use?

Options:

A.

db.createRole({ role: " productRead " , privileges: [ { resource: { db: " products " , collection: " * " }, actions: [ " readAnyDatabase " ] } ] , roles: [] }, { w: " majority " , wtimeout: 5000 })

B.

db.createRole({ role: " productRead " , privileges: [ { resource: { db: " products " , collection: " " }, actions: [ " find " ] } ] , roles: [] }, { w: " majority " , wtimeout: 5000 })

C.

db.createRole({ role: " productRead " , privileges: [ { resource: { db: " products " , collection: " * " }, actions: [ " readWrite " ] } ] , roles: [] }, { w: " majority " , wtimeout: 5000 })

D.

db.createRole({ role: " productRead " , privileges: [ { resource: { db: " products " , collection: " * " }, actions: [ " read " ] } ] , roles: [] }, { w: " majority " , wtimeout: 5000 })

Question 29

Which of the following commands will return all the posts with number of likes greater than 100 and less than 200, both inclusive?

Options:

A.

db.posts.find({ likes : { $gte : 100 , $lte : 200 } } );

B.

db.posts.find({ likes : { $gt : 100 , $lte : 200 } } );

C.

db.posts.find({ likes : { $gte : 100, $lt : 200 } } );

D.

db.posts.find({ likes : { $gt : 100, $lt : 200 > > );

Question 30

Mongodb does provide high availability via which option?

Options:

A.

Replication

B.

Indexing

C.

Sharding

D.

Journaling

Question 31

What command is used to check the value that " logLevel " is set to?

Options:

A.

db.runCommand({ getParameter: 1, " logLevel " : 1 })

B.

db.getParameter( " logLevel " )

C.

db.getParameter({ " logLevel " : 1})

D.

db.adminCommand({ getParameter: 1, " logLevel " : 1 })

Question 32

Which of the following command inside aggregate command is used in MongoDB aggregation to filter the documents to pass only the documents that match the specified condition(s) to the next pipeline stage.

Options:

A.

$aggregate

B.

$sum

C.

$match

D.

$group

Question 33

In a replica set, a_________number of members ensures that the replica set is always able to select a primary.

Options:

A.

Even

B.

Odd

C.

2

D.

Depends on the application architecture

Question 34

Consider an inventory collection that contains these documents:

{ " _id " : 1, " product " : " x-small box " , " colors " : [ " brown " , " black " , " white " ], " qty " : 50 }

{ " _id " : 2, " product " : " small box " , " colors " : [ " brown " , " white " ], " qty " : 60 }

{ " _id " : 3, " product " : " medium box " , " colors " : [ " black " , " grey " , " white " ], " qty " : 45 }

{ " _id " : 4, " product " : " large box " , " colors " : [ " grey " ], " qty " : 50 }

{ " _id " : 5, " product " : " x-large box " , " colors " : [ " grey " , " white " ], " qty " : 10 }

What result set does the following query return?

db.inventory.find({

$or: [

{ " product " : " x-small box " },

{

$and: [

{ " qty " : { $ne: 50 } },

{ " colors " : { $nin: [ " brown " ] } }

]

}

]

})

Options:

A.

Documents _id:3 and _id:5.

B.

Documents _id:1 and _id:3.

C.

Documents _id:1, _id:2, _id:3, and _id:5.

D.

Documents _id:1, _id:3, and _id:5.

Question 35

Consider an orders collection that contains these documents:

{ _id: 1, product: " X-pad " , quantity: 950 }

{ _id: 2, product: " X-pad-pro " , quantity: 1000 }

{ _id: 3, product: " X-phone " , quantity: 850 }

{ _id: 4, product: " X-phone-pro " , quantity: 1350 }

Commands A and B are run at the same time. Assume that no other operations are running.

Options:

A.

)db.orders.findAndModify({query: { " product " : " X-phone " },update: { $set: { " quantity " : 1250 } }})

B.

)db.orders.updateMany({}, { $set: { " quantity " : 0 } })What is the possible findAndModify output and database state after these operations complete? Select TWO.

C.

findAndModify output shows quantity 1250; final X-phone quantity is 1250 while all others are 0.

D.

findAndModify output shows quantity 850; final quantities for all four documents are 0.

E.

findAndModify output shows quantity 0; final quantities for all four documents are 0.

F.

findAndModify output shows quantity 0; final X-phone quantity is 1250 while all others are 0.

Question 36

In order to ensure that you can maintain high availability in the face of server failure, you should implement which of the following?

Options:

A.

Sharding

B.

Properly defined user roles

C.

Replication

D.

Put indexes on all of your documents

E.

The proper storage engine

Question 37

Using an arbiter allows one to easily ensure an odd number of voters in replica sets. Why is this important?

Options:

A.

To help in disaster recovery

B.

To protect agains network partitions

C.

To enable certain read preference settings

D.

To add greather redundancy

E.

For more efficient backup operations

Question 38

What are TWO functions of sharding?

Options:

A.

Supporting deployments that distribute data across different geographical zones.

B.

Supporting deployments that require strong consistency across geographical zones.

C.

Supporting deployments with very large data sets and high throughput operations.

D.

Supporting deployments where datasets fit into RAM and performance needs are met.

E.

Supporting deployments that require redundancy and increased data availability.

Question 39

Which of the following aggregation commands in MongoDB does not support sharded collections?

Options:

A.

mapReduce

B.

group

C.

aggregate

D.

All of the above

Question 40

Which of the following aggregate commands in MongoDB uses a pipeline approach with the goals of improving the aggregation performance?

Options:

A.

mapReduce

B.

group

C.

aggregate

D.

All of the above

Question 41

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?

Options:

A.

A, B, C

B.

A

C.

B, C

D.

A, B

Question 42

The following aggregation option is used to specify the specific fields that needs to be passed to the next stage of the aggregation pipeline:

Options:

A.

$project

B.

$aggregate

C.

$match

D.

$group

Question 43

A database administrator notices that operations on the qa database are not completing, and have been in progress for longer than expected.

What command can the administrator run to see information on in-progress operations on the qa database?

Options:

A.

db.listOps.ns(/^qa\./)

B.

db.listOps(/^qa\./)

C.

db.currentOp({ " ns " : /^qa\./})

D.

db.currentOp.ns(/^qa\./)

Question 44

What is the output of the following program?

Options:

A.

60 s

B.

1s

C.

100 s

D.

100 ms

Question 45

Which features of relational database management systems were deliberately omitted in MongoDB and help us to obtain horizontal scalability? Check all that apply.

Options:

A.

Multi-statement transactions

B.

Joins

C.

Authentication

Question 46

Which of the following is supported by MongoDB?

Options:

A.

Transaction Management

B.

ACID Transactions

C.

Journaling

D.

Relationships between Collections (Primary Key Foreign Key)

Question 47

What " stage " indicates that no indexes were available for a query pattern?

Options:

A.

FETCH

B.

IXSCAN

C.

COLLSCAN

D.

GROUP

Question 48

Consider the following document:

> db.c.find()

{ " _id " : 12, b : [ 3, 5, 7, 2, 1, -4, 3, 12 ] }

Which of the following queries on the " c " collection will return only the first five elements of the array in the " b "

field? E.g.,

Document you want returned by your query:

{ " _id " : 12, " b " : [ 3, 5, 7, 2, 1 ] >

Options:

A.

db.c.find( { > , { b : { $slice : [ 0 , 5 ] } } )

B.

db.c.find( { b : [ 0 , 5 ] > )

C.

db.c.find( { > , { b : { $substr[ 0 , 5 ] > > )

D.

db.c.find( { > , { b : [ 0, 1, 2, 3, 4, 5 ] > )

E.

db.c.find( { > , { b : [ 0 , 5 ] > )

Question 49

You are comparing values of different BSON types in mongodb. You want to compare from lowest to highest. Which comparison order is used?

Options:

A.

MinKey, Null, Numbers,Symbol, String,Object,Array,BinData

B.

MinKey, Null, Numbers,Object,Array,BinData,Symbol, String

C.

Object/Array^inData/Symbol,MinKey, Null, Numbers,String

D.

Objec^Array^inData,Symbol, String,MinKey, Null, Numbers

Question 50

Which of the following commands finds all the documents in the posts collection with post timestamp field as null?

Options:

A.

db.posts.find( { post_timestamp: { $fieldtype: null } } )

B.

db.posts.find( { post_timestamp: { $type: null } } )

C.

db.posts.find( { post_timestamp : { $type; 10 > > )

D.

db.posts.find( { post_timestamp: { $fieldtype: 10 } } )

Question 51

Addding the index {a:l} can potentially decrease the speed of which of the following operations? Check all that apply.

Options:

A.

db.collection.update({b:456 > , {$inc: {a:l > })

B.

db.collection.find( {a : 232} )

C.

db.collection.insert( { a:341})

Page: 1 / 17
Total 172 questions