MongoDB Questions and Answers – Getting Started with MongoDB – 1

This set of MongoDB Multiple Choice Questions & Answers (MCQs) focuses on “Getting Started with MongoDB-1”.

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
View Answer

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
View Answer

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
View Answer

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
View Answer

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

advertisement
advertisement

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
View Answer

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
View Answer

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

Note: Join free Sanfoundry classes at Telegram or Youtube

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
View Answer

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
View Answer

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

advertisement

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

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
View Answer

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

advertisement

Sanfoundry Global Education & Learning Series – MongoDB.

Here’s the list of Best Books in MongoDB.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.