Uploaded by angelodorsette

C100DEV MongoDB Certified Developer Associate Exam Questions

advertisement
Pass MongoDB C100DEV Exam with Real Questions
MongoDB C100DEV Exam
MongoDB Certified Developer Associate
https://www.passquestion.com/C100DEV.html
35% OFF on All, Including C100DEV Questions and Answers
Pass MongoDB C100DEV Exam with PassQuestion C100DEV
questions and answers in the first attempt.
https://www.passquestion.com/
1/6
1.Why is MongoDB a NoSQL database?
A. Because MongoDB uses a structured way to store and organize data (collections).
B. Because MongoDB uses tables, rows and columns to organize data.
C. Because MongoDB does not utilize tables, rows and columns to organize data.
Answer: A,C
Explanation:
https://www.mongodb.com/nosql-explained
2.Suppose you have a movies collection with the following document structure:
{
_id: ObjectId("573a1390f29313caabcd60e4"),
title: 'The Immigrant',
fullplot: "Charlie is on his way to the USA. He wins in a card game, puts the money in Edna's bag (she and
her sick mother have been robbed of everything). When he retrieves a little for himself he is accused of
being a thief. Edna clears his name. Later, broke, Charlie finds a coin and goes into a restaurant." }
You want to perform text search queries on fullplot field.
What do you have to do?
Just query the database. For example:
A. Just query the database. For example:
db.movies.find( { $text: { $search: 'spaceship'} } ).explain()
B. First, create a text index: db.movies.createIndex( { fullplot: 'text' } ) Then query the database:
db.movies.find( { $text: { $search: 'spaceship' } } )
C. First, create an index:
D. db.movies.createIndex( { fullplot: 1 } ) Then query the database:
db.movies.find( { $text: { $search: 'spaceship' } } )
Answer: B
Explanation:
https://docs.mongodb.com/manual/text-search/
https://docs.mongodb.com/manual/core/index-text/
3.In your database there is a collection named trips with the following document structure:
{
'_id': ObjectId("572bb8222b288919b68abf6d"),
'trip_duration': 858,
'start_station id': 532,
'end_station_id': 401,
'bike_id': 17057,
'start_station_location': { type: 'Point', coordinates: [ -73.960876, 40.710451 ] }, 'end_station_location':
{ type: 'Point', coordinates: [ -73.98997825, 40.72019576 ] }, 'start_time':
ISODate("2016-01-01T00:09:31.000Z"), 'stop_time': ISODate("2016-01-01T00:23:49.000Z") }
How can you extract all trips from this collection ended at stations that are to the west of the -73.5
longitude coordinate?
A. db.trips.find( { 'coordinates': { $lt: -73.5 } } )
B. db.trips.find( { 'end_station_location.coordinates.0': { $gt: -73.5 } } )
2/6
C. db.trips.find( { 'end_station_location.coordinates.0': { $lt: -73.5 } } )
D. db.trips.find( { 'end_station_location.coordinates.1': { $lt: -73.5 } } )
Answer: C
Explanation:
https://docs.mongodb.com/manual/reference/operator/query/lt/
4.You have a developers collection with the following document structure:
{
_id: 1,
fname: 'John',
lname: 'Smith',
tech_stack: ['sql', 'git', 'python', 'linux', 'django', 'aws']
},
{
_id: 2,
fname: 'Michael',
lname: 'Doe',
tech_stack: [ 'git', 'python', 'sqlite', 'linux', 'flask' ]
}
Which of the following queries will return only the first three elements of the array in the tech_stack field?
A. db.developers.find( {}, { tech_stack: [0, 1, 2] } )
B. db.developers.find( { tech_stack: { $slice: [0, 3] } } )
C. db.developers.find( {}, { tech_stack: [0, 3] } )
D. db.developers.find( {}, { tech_stack: { $slice: [0, 3] } } )
Answer: D
Explanation:
https://docs.mongodb.com/manual/reference/operator/update/slice/
5.What is the built-in database called local in MongoDB for?
A. The local database plays an important role in the authentication and authorization process. Certain
actions performed by administrators also require access to this database.
B. The local database is used to store information about shards in shared MongoDB cluster.
C. The local database stores data describing the MongoDB server. For replica sets, it also stores
information about the replication process.
Answer: C
Explanation:
https://docs.mongodb.com/manual/reference/local-database/
6.Given a movies collection where each document has the following structure:
{
_id: ObjectId("573a1390f29313caabcd60e4"),
genres: [ 'Short', 'Comedy', 'Drama' ],
title: 'The Immigrant',
year: 1917,
3/6
imdb: { rating: 7.8, votes: 4680, id: 8133 },
countries: [ 'USA' ]
}
Which of the following queries will find all Comedy movies that were made in 2000? (select 2)
A. db.movies.find( { year: 2000 }, { genres: "Comedy" } )
B. db.movies.find( { $or: [ { year: 2000 }, { genres: "Comedy" } ] } )
C. db.movies.find( { year: 2000, genres: "Comedy" } )
D. db.movies.find( { $and: [ { year: 2000 }, { genres: "Comedy" } ] } )
Answer: C,D
Explanation:
https://docs.mongodb.com/manual/reference/method/db.collection.find/
https://docs.mongodb.com/manual/reference/operator/query/and/
7.Which cursor method should you use to specify the maximum number of documents returned?
A. cursor.map()
B. cursor.limit()
C. cursor.skip()
D. cursor.hint()
E. cursor.count()
Answer: B
Explanation:
https://docs.mongodb.com/manual/reference/method/cursor.limit/
8.What does it command do in the mongo shell?
A. Iterates through the cursor results.
B. Terminates the current query execution.
C. it is not a mongo shell command.
D. Displays cluster statistics.
Answer: A
9.Which of the following commands will successfully insert exactly two new documents into an empty
companies collection?
A. db.companies.insertMany([
{"_id": 1, "name": "Facebook"},
{"_id": 1, "name": "Twitter"},
{"_id": 2, "name": "Tesla"}
], {"ordered": false})
B. db.companies.insertMany([
{"_id": 1, "name": "Facebook"},
{"_id": 1, "name": "Twitter"},
{"_id": 2, "name": "Tesla"}
])
C. db.companies.insertMany([
{"_id": 1, "name": "Facebook"},
4/6
{"_id": 2, "name": "Twitter"}
])
D, db.companies.insertMany([
{"_id": 1, "name": "Facebook"},
{"_id": 2, "name": "Twitter"},
{"_id": 2, "name": "Tesla"}
])
E. db.companies.insertMany([
F. {"name": "Facebook"},
G. {"name": "Twitter"}
H. ])
Answer: A,C,D,E
Explanation:
https://docs.mongodb.com/manual/reference/method/db.collection.insertMany/
10.Which of the following commands will delete a collection named restaurants?
A. db.restaurants.dropCollection()
B. db.restaurants.delete()
C. db.restaurants.remove()
D. db.restaurants.drop()
Answer: D
Explanation:
https://docs.mongodb.com/manual/reference/method/db.collection.drop/
11.What are some of the uses for the $ sign in MQL (MongoDB Query Language)? (select 2)
A. The $ sign has no special meaning in MQL.
B. When $ is used to prefix a field name,wwwit.dumpspandarepresentsthev.luecomstored in that field.
C. $ denotes an operator - all MQL operators have the $ prefix.
Answer: B,C
Explanation:
https://docs.mongodb.com/manual/core/dot-dollar-considerations/
12.Given a movies collection where each document has the following structure:
{
_id: ObjectId("573a1390f29313caabcd60e4"),
genres: [ 'Short', 'Comedy', 'Drama' ],
title: 'The Immigrant',
year: 1917,
imdb: { rating: 7.8, votes: 4680, id: 8133 },
countries: [ 'USA' ]
}
Which of the following queries will find all movies that do not contain the Comedy and Romance genres?
A. db.movies.find( { genres: { $or: ["Comedy", "Romance"] } } )
B. db.movies.find( { genres: { $in: ["Comedy", "Romance"] } } )
5/6
C. db.movies.find( { genres: { $nin: ["Comedy", "Romance"] } } )
Answer: C
Explanation:
https://docs.mongodb.com/manual/reference/operator/query/nin/
13.In your database a movies collection is given where each document has the following structure:
{
_id: ObjectId("573a1391f29313caabcd9264"),
genres: [ 'Romance', 'Drama' ],
title: 'The Divorcee',
languages: [ 'English', 'French' ],
year: 1930,
imdb: { rating: 6.9, votes: 1740, id: 20827 },
countries: [ 'USA' ]
}
Which of the following queries will return all movies that are in the Fantasy and Drama (both) genre?
A. db.movies.find( { genres: { $elemMatch: ['Fantasy', 'Drama'] } } )
B. db.movies.find( { genres: { $in: ['Fantasy', 'Drama'] } } )
C. db.movies.find( { genres: { $size: ['Fantasy', 'Drama'] } } )
D. db.movies.find( { genres: { $all: ['Fantasy', 'Drama'] } } )
Answer: D
Explanation:
https://docs.mongodb.com/manual/reference/operator/query/all/
14.Which cursor method should you use to force MongoDB to use a specific index for a query?
A. cursor.index()
B. cursor.hint()
C. cursor.explain()
D. cursor.use()
Answer: B
Explanation:
https://docs.mongodb.com/manual/reference/method/cursor.hint/
15.Given the following MongoDB URI: mongodb+srv://datascientist34:ta33w9rd@xtr-187.srv.net/admin
Which of the following statements are true? (select 2)
A. There are 178 nodes in the xtr replica set.
B. The password used for authentication is xtr-178
C. The password used for authentication is ta33w9rd
D. The user datascientist34 is trying to authenticate on database admin.
Answer: C,D
Explanation:
https://docs.mongodb.com/manual/reference/connection-string/
6/6
Download