Olete.in
Articles
Mock Tests
🧪 MongoDB MCQ Quiz Hub
MongoDB Mcq Question Set 3
Choose a topic to test your knowledge and improve your MongoDB skills
1. Which of the following function is valid for creation of new data inside MongoDB Shell?
function insertData(dbName, colName, num) { var col = db.getSiblingDB(dbName).getCollection(colName); for (i = 0; i < num; i++) { col.insertData({x:i}); } print(col.count()); }
function insertData(dbName, colName, num) { var col = db.getSiblingDB(dbName).getCollection(colName); for (i = 0; i < num; i++) { col.insert({x:i}); } print(col.count()); }
insertData(dbName, colName, num) { var col = db.getSiblingDB(dbName).getCollection(colName); for (i = 0; i < num; i++) { col.insert({x:i}); } print(col.count()); }
None of the mentioned
2. Point out the wrong statement.
Database is a physical container for collections
A single MongoDB server typically has single databases
Collection is the equivalent of an RDBMS table
None of the mentioned
3. _id is a ________ bytes hexadecimal number which assures the uniqueness of every document.
13
16
12
10
4. Which of the following statement will insert 400 documents in to the testData collection?
insertData("test", "testData", 200)
insertData("test", "testData", 400)
insertData("test", "testData", 600)
All of the Mentioned
5. The mongo shell loads and parses the ___________ file on startup.
mongo.js
mongoc.js
mongorc.js
All of the Mentioned
6. To iterate the cursor and return more documents, type _________ in the mongo shell.
cursor
it
next
None of the mentioned
7. Which of the following key is used to denote uniqueness in the collection?
_id
id
id_
None of the mentioned
8. A query may include a ___________ that specifies the fields from the matching documents to return.
selection
projection
union
None of the mentioned
9. Point out the correct statement.
Secondary indexes allow applications to store a view of a portion of the collection in an efficient data structure
MongoDB has full support for secondary indexes
Most indexes store an ordered representation of all values of a field or a group of fields
All of the Mentioned
10. MongoDB stores all documents in _______
tables
collections
rows
All of the Mentioned
11. In MongoDB _________ operations modify the data of a single collection.
CRUD
GRID
READ
All of the Mentioned
12. Point out the wrong statement.
Indexes cannot enforce uniqueness in collection
CRUD stands for create, read, update, and delete
CRUD application is the most simplest application
All of the Mentioned
13. Which of the following operation adds a new document to the users collection?
add
insert
truncate
drop
14. Which of the following preference determines how the client direct read operations to the set?
read
write
update
delete
15. Applications can also control the behavior of write operations using _______ concern.
read
write
truncate
All of the Mentioned
16. MongoDB process collection of documents using _________ operations.
Hbase
Hive
Map-reduce
None of the mentioned
17. Which of the following pipeline is used for aggregation in MongoDB?
data processing
information processing
knowledge processing
None of the mentioned
18. The order of documents returned by a query is not defined unless you specify a ______
sortfind()
sortelse()
sort()
none of the mentioned
19. Point out the correct statement.
Queries specify criteria, or conditions, that identify the documents that MongoDB returns to the clients
Write operations, or queries, retrieve data stored in the database
The selection limits the amount of data that MongoDB returns to the client over the network
All of the Mentioned
20. In aggregation pipeline, the _______ pipeline stage provides access to MongoDB queries.
$catch
$match
$batch
All of the Mentioned
21. Which of the following method returns one document?
findOne()
findOne1()
selectOne()
All of the Mentioned
22. Point out the wrong statement.
sort() modifier sorts the results by age in ascending order
Queries in MongoDB return all fields in all matching documents by default
To scale the amount of data that MongoDB sends to applications, include a projection in the queries.
none of the mentioned
23. Which of the following is the second argument to projection?
findOne()
findOne1()
selectOne()
find()
24. Which of the following query selects documents in the records collection that match the condition { “user_id”: { $lt: 42 } }?
db.records.findOne( { “user_id”: { $lt: 42 } }, { “history”: 0 } )
db.records.find( { “user_id”: { $lt: 42 } }, { “history”: 0 } )
db.records.findOne( { “user_id”: { $lt: 42 } }, { “history”: 1 } )
db.records.select( { “user_id”: { $lt: 42 } }, { “history”: 0 } )
25. Which of the following functionality is used for aggregation framework?
$match
$project
$projectmatch
All of the mentioned
26. To suppress the _id field from the result set, specify _________ in the projection document.
_id: 1
_id: 0
_id: it
None of the mentioned
27. Which of the following is not a projection operator?
$slice
$elemMatch
$
None of the mentioned
28. Which of the following flag can be set by mongo shell?
Timeout
noTimeout
Time
None of the mentioned
29. Point out the correct statement.
Intervening read operations on a document may result in a cursor that returns a document more than once if that document has changed
The MongoDB server returns the query results in batches
Subsequent batch size is 50 megabytes
None of the mentioned
30. Which of the following will display complete list of available cursor flags?
cursor.Option()
cursor.addOption()
cursor.addOptions()
All of the Mentioned
31. To describe the message structure, a ________ like struct is used.
Pascal
C++
C
Java
32. Point out the wrong statement.
The MongoDB Wire Protocol is a simple socket-based, request-response style protocol
For queries that include a sort operation without an index, the server must load all the documents in memory to perform the sort before returning any results
Clients communicate with the database server through a regular TCP/IP socket
All of the mentioned
33. ____ specifies the number of documents to return in each batch of the response from the MongoDB instance.
cursor.batchSize(size)
cursor.Size(size)
cursor.batch(size)
All of the Mentioned
34. The __________ method returns a document that includes a metrics field.
db.serverStats()
db.serverStatus()
db.status()
All of the Mentioned
35. ________ is a client or database-generated identifier that uniquely identifies this message.
messageLength
responseTo
requestID
All of the Mentioned
36. Which of the following operator is not very selective?
$nine
$nin
$ain
None of the mentioned
37. An index cannot cover a query on a _______ collection when run against a mongos if the index does not contain the shard key.
vertical
sharded
horizontal
None of the mentioned
38. ______ concern describes the guarantee that MongoDB provides when reporting on the success of a write operation.
Write
Read
Update
None of the mentioned
39. Point out the correct statement.
Read operations on sharded clusters are most efficient when directed to a specific shard
Sharded clusters allow you to partition a data set among a cluster of mongod instances in a way that is nearly transparent to the application
For a sharded cluster, applications issue operations to one of the mongos instances associated with the cluster
All of the Mentioned
40. When inserts, updates and deletes have a _________ write concern, write operations return quickly.
strong
weak
average
very strong
41. The mongo shell and the MongoDB drivers use __________ as the default write concern.
Nacknowledged
Acknowledgement
Acknowledged
All of the mentioned
42. Point out the wrong statement.
When a query does not include a shard key, the mongos can use cluster metadata from the config database to route the queries to shards
On larger clusters, scatter gather queries are unfeasible for routine operations
Replica sets use read preferences to determine where and how to route read operations to members of the replica set
None of the mentioned
43. _______ is used to control mongod commits in the journal.
commitIntervMs
commitInterval
commitIntervalMs
All of the Mentioned
44. Clients can set a __________ value as part of a replica acknowledged write concern.
timeout
wtimeout
waittimeout
None of the mentioned
45. MongoDB does not ___________ modifications made before the wtimeout interval expired.
commit
rollback
save
All of the Mentioned
46. With an __________ write concern, MongoDB does not acknowledge the receipt of write operations.
Nacknowledged
Acknowledgement
Acknowledged
Unacknowledged
47. With a receipt acknowledged write concern, the _________confirms that it received the write operation and applied the change to the in-memory view of data.
mongod
mongos
mongo
mongoc
48. Indexes are typically available in ______ or located sequentially on disk.
RAM
ROM
CMOS
None of the mentioned
49. Point out the wrong statement.
Query selectivity refers to how well the query predicate excludes or filters out documents in a collection
Query selectivity can determine whether or not queries can use indexes effectively or even use indexes at all
More selective queries match a larger percentage of documents
All of the Mentioned
50. ______ is used to determine whether a query is a covered query.
explainstats()
explain()
explainall()
All of the Mentioned
Submit