MongoDB Questions and Answers Part-8

1. __________ is a part of the standard MongoDB distribution and provides a full JavaScript environment.
a) mongod
b) mongodb
c) mongo
d) none of the mentioned

Answer: c
Explanation: mongo provides complete access to the JavaScript language and all standard functions as well as a full database interface for MongoDB.

2. Point out the correct statement.
a) MMS provides backup and monitoring
b) MongoDB can also be configured for data replication
c) MMS is available to all users in the cloud and on-premises as part of MongoDB Standard and Enterprise Subscriptions
d) all of the mentioned

Answer: d
Explanation: MongoDB is limited to a total data size of about 2GB for all databases in 32-bit mode.

3. mongo looks for a database server listening on port 27017 on the ________ interface.
a) web
b) localhost
c) web host
d) all of the mentioned

Answer: b
Explanation: To connect to a server on a different port or interface, use the –port and –host options.

4. After starting the mongo shell, your session will use the ________ database by default.
a) mongo
b) master
c) test
d) primary

Answer: c
Explanation: At any time, db operation at the mongo shell is used to report the name of the current database.

5. Point out the wrong statement.
a) MongoDB works right out of the box, and you can dive right into developing your application, instead of spending a lot of time fine-tuning obscure database configurations
b) MongoDB works hard to be very easy to install, configure, maintain, and use
c) MongoDB does not provide a lot of the features of a traditional RDBMS
d) none of the mentioned

Answer: c
Explanation: MongoDB focuses on flexibility, power, speed, and ease of use.

6. __________ command display the list of databases.
a) show db
b) show dbs
c) show data
d) display dbs

Answer: b
Explanation: Show dbs print a list of all databases on the server.

7. Which of the following operation is used to switch to new database mydb?
a) use dbs
b) use db
c) use mydb
d) use mydbs

Answer: c
Explanation: .Confirm that your session has the mydb database as context, by checking the value of the db object, which returns the name of the current database.

8. Which of the following also returns a list of databases?
a) show databases
b) show database
c) display dbs
d) all of the mentioned

Answer: a
Explanation: show databases is new in version 2.4.

9. Command to check existence of collection is _____________
a) show collection
b) show collections
c) show collect
d) none of the mentioned

Answer: b
Explanation: The mongo shell will return the list of the collections in the current database.

10. Which of the following method is used to query documents in collections?
a) find
b) move
c) shell
d) replace

Answer: a
Explanation: The find() method with no parameters returns all documents from a collection and returns all fields for the documents.