
DCWA MongoDB Quiz
Authored by G H
Science
University
Used 4+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
6 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What would be the output from the following command?
db.students.find({"school.students": {$lte: 5000}})
Nothing
[ { _id: '100', school: { _id: 'SCI', students: 4500 } },
{ _id: '200', school: { _id: 'SCI', students: 4500 } },
{ _id: '600', school: { _id: 'SCI', students: 4500 } } ]
[ { _id: '100', name: 'John', gpa: 3.7, school: { _id: 'SCI', students: 4500 }},
{ _id: '200', name: 'Mary', gpa: 3.3, school: { _id: 'SCI', students: 4500 }},
{ _id: '600', name: 'Ann', gpa: 2.3, school: { _id: 'SCI', students: 4500 }} ]
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What would be the result of running the following command?
db.students.insertOne({name: "Ryan", gpa: 3.9, school: {_id: "SCI", students: 4500}})
A new document with attributes name, gpa, and school would be inserted into the collection
No new document would be inserted into the collection
A new document with attributes _id, name, gpa, and school would be inserted into the collection
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What would be the result of running the following command?
db.students.aggregate([{$group: {_id: "$school._id", avg: {$agv: "$gpa"}}}])
[ { _id: 'SCI', avg: 3.1 }, { id: 'BUS', avg: 2.7 }, { id: null, avg: 1.8 } ]
[ { _id: null, avg: 2.75 } ]
Nothing would be output
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What would be the result of running the following command?
db.students.updateMany({},{$set: {"school.students": 1000}})
[ { _id: '100', name: 'John', gpa: 3.7, school: { _id: 'SCI', students: 1000 } },
{ _id: '200', name: 'Mary', gpa: 3.3, school: { _id: 'SCI', students: 1000 } },
{ _id: '300', name: 'Tom', gpa: 2.1, school: { _id: 'BUS', students: 1000 } },
{ _id: '400', name: 'Mary', gpa: 1.8 },
{ _id: '500', name: 'Bob', gpa: 3.3, school: { _id: 'BUS', students: 1000 } }, { _id: '600', name: 'Ann', gpa: 2.3, school: { _id: 'SCI', students: 1000 } } ]
[ { _id: '100', name: 'John', gpa: 3.7, school: { _id: 'SCI', students: 1000 } },
{ _id: '200', name: 'Mary', gpa: 3.3, school: { _id: 'SCI', students: 1000 } },
{ _id: '300', name: 'Tom', gpa: 2.1, school: { _id: 'BUS', students: 1000 } },
{ _id: '400', name: 'Mary', gpa: 1.8, school: { students: 1000 } },
{ _id: '500', name: 'Bob', gpa: 3.3, school: { _id: 'BUS', students: 1000 } }, { _id: '600', name: 'Ann', gpa: 2.3, school: { _id: 'SCI', students: 1000 } } ]
[ { _id: '100', name: 'John', gpa: 3.7, school: { _id: 'SCI', students: 4500 } },
{ _id: '200', name: 'Mary', gpa: 3.3, school: { _id: 'SCI', students: 4500 } },
{ _id: '300', name: 'Tom', gpa: 2.1, school: { _id: 'BUS', students: 5520 } },
{ _id: '400', name: 'Mary', gpa: 1.8, school: { students: 1000 } },
{ _id: '500', name: 'Bob', gpa: 3.3, school: { _id: 'BUS', students: 5520 } },
{ id: '600', name: 'Ann', gpa: 2.3, school: { _id: 'SCI', students: 4500 } } ]
[ { _id: '100', name: 'John', gpa: 3.7, school: { _id: 'SCI', students: 5500 } },
{ _id: '200', name: 'Mary', gpa: 3.3, school: { _id: 'SCI', students: 5500 } },
{ _id: '300', name: 'Tom', gpa: 2.1, school: { _id: 'BUS', students: 6520 } },
{ _id: '400', name: 'Mary', gpa: 1.8 },
{ _id: '500', name: 'Bob', gpa: 3.3, school: { _id: 'BUS', students: 6520 } }, { _id: '600', name: 'Ann', gpa: 2.3, school: { _id: 'SCI', students: 5500 } } ]
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What would be the result of running the following command?
db.students.aggregate([{$match: {"school._id": "BUS"}}, {$group: {_id: null, max: {$max: "$gpa"}}}])
[ { _id: null, max: 9.3 } ]
[ { _id: null, max: 3.7 } ]
[ { _id: null, max: 3.3 } ]
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of the following would produce this output?
[ { _id: '500', name: 'Bob', gpa: 3.3, school: { id: 'BUS', students: 5520 } } ]
db.students.find({$and: [{gpa: {$gt: 2.5}}, {"school._id": 1}]})
db.students.find({gpa: {$gt: 2.5}}, {"school._id": 1})
Either of these commands
Neither of these commands
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?