MongoDB C100DBA - MongoDB Associate Database Administrator Exam
Page: 2 / 31
Total 152 questions
Question #6 (Topic: Exam A)
Given the following sample documents in the HR collection:
{ “name” : “A.S”, “age”: 23, “hobby”: [ “soccer”, “basketball” ]},
{ “name” : “B.M”, “age”: 36, “hobby”: [ “soccer”, “baseball” ]},
{ “name” : “C.W”, “hobby”: [ “basketball”, “cycling” ]},
{ “name” : “R.S”, “age”: 30, “hobby”: [ “soccer”, “cycling”, “baseball” ]},
{ “name” : “E.M”, “age”: 25, “hobby”: [ “cycling”, “basketball” ]}
What is the output of
db.HR.find( { age: { $in: [ 25, 36] } }, { _id: 0} )
{ “name” : “A.S”, “age”: 23, “hobby”: [ “soccer”, “basketball” ]},
{ “name” : “B.M”, “age”: 36, “hobby”: [ “soccer”, “baseball” ]},
{ “name” : “C.W”, “hobby”: [ “basketball”, “cycling” ]},
{ “name” : “R.S”, “age”: 30, “hobby”: [ “soccer”, “cycling”, “baseball” ]},
{ “name” : “E.M”, “age”: 25, “hobby”: [ “cycling”, “basketball” ]}
What is the output of
db.HR.find( { age: { $in: [ 25, 36] } }, { _id: 0} )
A. { “name” : “E.M”, “age”: 25, “hobby”: [ “cycling”, “basketball” ]}
{ “name” : “R.S”, “age”: 30, “hobby”: [ “soccer”, “cycling”, “baseball” ]}
{ “name” : “B.M”, “age”: 36, “hobby”: [ “soccer”, “baseball” ]} B. { “name” : “R.S”, “age”: 30, “hobby”: [ “soccer”, “cycling”, “baseball” ]} C. { “name” : “B.M”, “age”: 36, “hobby”: [ “soccer”, “baseball” ]} D. { “name” : “E.M”, “age”: 25, “hobby”: [ “cycling”, “basketball” ]} E. { “name” : “B.M”, “age”: 36, “hobby”: [ “soccer”, “baseball” ]}
{ “name” : “E.M”, “age”: 25, “hobby”: [ “cycling”, “basketball” ]}
{ “name” : “R.S”, “age”: 30, “hobby”: [ “soccer”, “cycling”, “baseball” ]}
{ “name” : “B.M”, “age”: 36, “hobby”: [ “soccer”, “baseball” ]} B. { “name” : “R.S”, “age”: 30, “hobby”: [ “soccer”, “cycling”, “baseball” ]} C. { “name” : “B.M”, “age”: 36, “hobby”: [ “soccer”, “baseball” ]} D. { “name” : “E.M”, “age”: 25, “hobby”: [ “cycling”, “basketball” ]} E. { “name” : “B.M”, “age”: 36, “hobby”: [ “soccer”, “baseball” ]}
{ “name” : “E.M”, “age”: 25, “hobby”: [ “cycling”, “basketball” ]}
Answer: E
Question #7 (Topic: Exam A)
Given the following document:
The name is M.M., the date of the exam is May 20, 2022, the subject is Math, and the score is 90.
What command will properly add this document to the exams collection?
The name is M.M., the date of the exam is May 20, 2022, the subject is Math, and the score is 90.
What command will properly add this document to the exams collection?
A. db.exams.upsertOne( { name: “M.M.”, date: “2022-05-20”, subject: “Math”, score: “90” } )
B. db.exams.insertOne( { name: “M.M.”, date: new Date (“2022-05-20”), subject: “Math”, score: 90 } )
C. db.exams.upsertOne( { name: “M.M.”, date: new Date (“2022-05-20”), subject: “Math”, score: 90 } )
D. db.exams.insertOne( { name: “M.M.”, date: “2022-05-20”, subject: “Math”, score: “90” } )
Answer: B
Question #8 (Topic: Exam A)
Given the following sample documents:
{ _id: 1, firstName: “Person1”, company: “CompanyA”, active: false }
{ _id: 2, firstName: “Person2”, company: “CompanyB”, active: false }
{ _id: 3, firstName: “Person3”, company: “CompanyC”, active: true }
{ _id: 4, firstName: “Person4”, company: “CompanyD”, active: true }
What code block should be used to delete the third document from a MongoDB collection in Java?
{ _id: 1, firstName: “Person1”, company: “CompanyA”, active: false }
{ _id: 2, firstName: “Person2”, company: “CompanyB”, active: false }
{ _id: 3, firstName: “Person3”, company: “CompanyC”, active: true }
{ _id: 4, firstName: “Person4”, company: “CompanyD”, active: true }
What code block should be used to delete the third document from a MongoDB collection in Java?
A. collection.DeleteOne(eq(“_id”, new ObjectId(3))));
B. collection.Delete(eq(“_id”, new ObjectId(3))));
C. collection.Delete(eq(“_id”, 3));
D. collection.DeleteOne(eq(“_id”, 3));
Answer: D
Question #9 (Topic: Exam A)
Given the following query generates a collection scan:
db.grades.find({“class_id” : 149, “scores.score” : {$gt : 75 }}). sort ({“score.type”:1})
Which two indexes improve the performance of the query the most? (Choose two.)
db.grades.find({“class_id” : 149, “scores.score” : {$gt : 75 }}). sort ({“score.type”:1})
Which two indexes improve the performance of the query the most? (Choose two.)
A. db.grades.createIndex({“scores.type” : 1, class_id : 1, “scores.score” : 1} )
B. db.grades.createIndex({ “scores.type” : 1, “scores.score” : 1, class_id : 1} )
C. db.grades.createIndex({class_id : 1, “score.type” : 1, “scores.score” : 1} )
D. db.grades.createIndex({class_id:1, “scores.score”:1, “score.type”:1} )
Answer: CD
Question #10 (Topic: Exam A)
Given the following query:
db.test.find(
{ reports: { $elemMatch: { item: “123”, point: { $gte: 8 }}}}
}
Which two documents from collection test will be returned by this query? (Choose two.)
db.test.find(
{ reports: { $elemMatch: { item: “123”, point: { $gte: 8 }}}}
}
Which two documents from collection test will be returned by this query? (Choose two.)
A. { “_id” : 4, “reports” : { “item” : “123”, “point” : 8 } }
B. { “_id” : 3, “reports” : [ { “item” : “123”, “point” : 8 },{ “item” : “213”, “point” : 7 } ] }
C. { “_id” : 2, “reports” : [ { “item” : “123”, “point” : 6 },{ “item” : “213”, “point” : 10 } ] }
D. { “_id” : 1, “reports” : [ { “item” : “123”, “point” : 9 },{ “item” : “213”, “point” : 7 } ] }
Answer: BD