MongoDB is a modern NoSQL database designed for scalability, flexibility, and high performance. It uses a document-oriented model, storing data in BSON format, a binary representation of JSON. Developers prefer MongoDB for its powerful query language and seamless CRUD (Create, Read, Update, Delete) operations. Explore its fundamental concepts and gain valuable insights into databases, collections, documents, and query fundamentals with these MCQs.
a) Tables
b) Documents
c) Rows
d) Columns
a) Relational
b) NoSQL
c) Columnar
d) Hierarchical
a) Schema-less database
b) Table-based database
c) Fixed-schema database
d) XML-based database
a) 8080
b) 27017
c) 3306
d) 1433
a) show version;
b) db.version();
c) version();
d) mongo --version;
a) HTML
b) JSON
c) XML
d) YAML
a) ObjectId
b) Decimal
c) Table
d) Binary Data
a) Human-readability
b) Binary storage of data
c) Less data compression
d) Complex syntax
a) Extended data types
b) Only integers
c) Nested tables
d) XML parsing
a) To store strings
b) Unique identification for documents
c) Reference collections
d) Optimize queries
a) A column in SQL
b) A row in SQL
c) A table in SQL
d) A database in SQL
a) Storing tables
b) Organizing collections
c) Storing BSON files
d) Managing columns
a) Array
b) Dictionary-like structure
c) Table
d) Column
a) db.createCollection()
b) create collection
c) db.addCollection()
d) create()
a) It throws an error
b) The collection is automatically created
c) The document is rejected
d) Requires explicit permission
a) db.insert()
b) db.collection.insertOne()
c) insert()
d) collection.add()
a) db.collection.findAll()
b) db.collection.getAll()
c) db.collection.find()
d) findAll()
a) $modify
b) $set
c) $update
d) $change
a) $deleteAll
b) remove()
c) deleteMany({})
d) $dropAll
deleteMany({}) on a collection?a) Deletes all documents in the collection
b) Deletes specific documents based on criteria
c) Throws an error
d) Drops the collection
a) db.collection.filter()
b) db.collection.find()
c) db.filter()
d) findByCondition()
a) $select
b) db.collection.find({fields})
c) Projection
d) $includeFields
a) $and
b) $all
c) $both
d) $combine
a) $gt
b) $gte
c) $greater
d) $greaterThan
a) $exists
b) $hasField
c) $fieldExists
d) $contains
a) Single-field
b) Compound
c) Text
d) All of the above
a) drop()
b) db.collection.dropIndex()
c) removeIndex()
d) db.collection.remove()
$in operator do in a query?a) Matches values equal to one of several specified values
b) Checks if a field exists
c) Matches fields that are not null
d) Filters documents with nested fields
a) find({status: "active"})
b) db.find("status = active")
c) db.collection.find({status: "active"})
d) db.query({status: "active"})
a) db.collection.sortBy()
b) sort({field: order})
c) db.collection.find().sort()
d) orderBy()
| QNo | Answer |
|---|---|
| 1 | b) Documents |
| 2 | b) NoSQL |
| 3 | a) Schema-less database |
| 4 | b) 27017 |
| 5 | b) db.version(); |
| 6 | b) JSON |
| 7 | c) Table |
| 8 | b) Binary storage of data |
| 9 | a) Extended data types |
| 10 | b) Unique identification for documents |
| 11 | c) A table in SQL |
| 12 | b) Organizing collections |
| 13 | b) Dictionary-like structure |
| 14 | a) db.createCollection() |
| 15 | b) The collection is automatically created |
| 16 | b) db.collection.insertOne() |
| 17 | c) db.collection.find() |
| 18 | b) $set |
| 19 | c) deleteMany({}) |
| 20 | a) Deletes all documents in the collection |
| 21 | b) db.collection.find() |
| 22 | c) Projection |
| 23 | a) $and |
| 24 | a) $gt |
| 25 | a) $exists |
| 26 | d) All of the above |
| 27 | b) db.collection.dropIndex() |
| 28 | a) Matches values equal to one of several specified values |
| 29 | c) db.collection.find({status: "active"}) |
| 30 | c) db.collection.find().sort() |