MongoDB MCQs – Installation and Setup

11.) Which of the following platforms is supported by MongoDB?

A) Windows
B) macOS
C) Linux
D) All of the above

Answer: Option D

Explanation: MongoDB supports installation on multiple platforms, including Windows, macOS, and Linux.

12.) Which of the following command enables authentication in MongoDB?

A) mongod –auth
B) mongo –auth
C) mongod –enableAuth
D) mongo –enableAuth

Answer: Option A

Explanation: The mongod –auth command starts the MongoDB server with authentication enabled.

13.) What is the default database created during MongoDB installation?

A) test
B) admin
C) config
D) None

Answer: Option A

Explanation: MongoDB automatically creates a default test database during installation.

14.) What does the –bind_ip option specify in the MongoDB server?

A) Port for the server to listen on
B) IP addresses allowed to connect to the server
C) Authentication method
D) Path for logs

Answer: Option B

Explanation: The –bind_ip option specifies the IP addresses from which the MongoDB server can accept connections.

15.) Which of the following tools provides a GUI for managing MongoDB databases?

A) mongosh
B) MongoDB Compass
C) pgAdmin
D) MongoDB CLI

Answer: Option B

Explanation: MongoDB Compass is a graphical user interface for managing, querying, and analyzing MongoDB databases.

16.) Which of the following commands is used to take a backup of MongoDB data?

A) mongodump
B) mongorestore
C) mongoexport
D) mongoimport

Answer: Option A

Explanation: The mongodump command is used to create a backup of the MongoDB database.

17.) What is the purpose of the oplog in MongoDB?

A) To manage indexes
B) To track replication
C) To monitor server logs
D) To store schema validation rules

Answer: Option B

Explanation: The oplog (operations log) is used to record changes to a MongoDB database for replication purposes.

18.) How can you ensure MongoDB starts automatically after a system reboot?

A) Enable MongoDB as a system service
B) Add mongod to startup scripts
C) Use systemctl enable mongod on Linux
D) All of the above

Answer: Option D

Explanation: Depending on the OS, MongoDB can be set to start automatically using startup scripts or enabling it as a service.

19.) Which command initializes a replica set?

A) rs.init()
B) rs.start()
C) rs.initiate()
D) rs.setup()

Answer: Option C

Explanation: The rs.initiate() command is used to initialize a new replica set in MongoDB.

20.) Which tool is used to import data into MongoDB from JSON or CSV files?

A) mongoimport
B) mongoexport
C) mongorestore
D) mongodump

Answer: Option A

Explanation: The mongoimport tool imports data from JSON, CSV, or TSV files into a MongoDB collection.

Leave a Reply

Your email address will not be published. Required fields are marked *