MongoDB Questions and Answers Part-2

1. MongoDB provides high ____________ with replica sets.
a) performance
b) availability
c) scalability
d) none of the mentioned

Answer: b
Explanation: A replica set consists of two or more copies of the data.

2. Point out the correct statement.
a) MongoDB cannot be used as a file system
b) MongoDB can run over single servers only
c) Embedded documents and arrays reduce need for joins
d) None of the mentioned

Answer: c
Explanation: MongoDB can run over multiple servers, balancing the load and/or duplicating data to keep the system up and running in case of hardware failure.

3. ___________ replicas maintain a copy of the data on the primary using built-in replication.
a) Primary
b) Secondary
c) Backup
d) All of the mentioned

Answer: b
Explanation: When a primary replica fails, the replica set automatically conducts an election process to determine which secondary should become the primary.

4. MongoDB scales horizontally using _________ for load balancing purpose.
a) Replication
b) Partitioning
c) Sharding
d) None of the mentioned

Answer: c
Explanation: The user chooses a shard key, which determines how the data in a collection will be distributed.

5. Point out the wrong statement.
a) Each replica set member will act in the role of primary replica only
b) The primary replica performs all writes and reads by default
c) Secondaries can also perform read operations, but the data is eventually consistent by default
d) None of the mentioned

Answer: a
Explanation: Each replica set member may act in the role of the primary or secondary replica at any time.

6. MongoDB can be used as a ____________ taking advantage of load balancing and data replication features over multiple machines for storing files.
a) AMS
b) CMS
c) File system
d) None of the mentioned

Answer: a
Explanation: The data is split into ranges (based on the shard key) and distributed across multiple shards.

7. ____________ can be used for batch processing of data and aggregation operations.
a) Hive
b) MapReduce
c) Oozie
d) None of the mentioned

Answer: b
Explanation: The aggregation framework enables users to obtain the kind of results for which the SQL GROUP BY clause is used.

8. MongoDB supports fixed-size collections called ____________ collections.
a) primary
b) secondary
c) capped
d) all of the mentioned

Answer: c
Explanation: This type of collection maintains insertion order and, once the specified size has been reached, behaves like a circular queue.

9. MongoDB uses a ____________ lock that allows concurrent read access to a database but exclusive write access to a single write operation.
a) readers
b) readers-writer
c) writer
d) none of the mentioned

Answer: b
Explanation: Before version 2.2, this lock was implemented on a per-mongod basis. Since version 2.2, the lock has been implemented at the database level.

10. Which of the following sorting is not supported by MongoDB?
a) collation
b) collection
c) heap
d) none of the mentioned

Answer: a
Explanation: MongoDB does not support collation-based sorting and is limited to byte-wise comparison via memcmp.