Loading

Quipoin Menu

Learn • Practice • Grow

mongodb / Databases and Collections
mcq
Direction: Choose the correct option

Q1.

What is a database in MongoDB?
A. Similar to a table in SQL
B. A key-value store
C. A container for collections
D. A single document
Direction: Choose the correct option

Q2.

What is a collection in MongoDB?
A. A schema definition
B. A group of related documents
C. An equivalent of a SQL table
D. A join operation
Direction: Choose the correct option

Q3.

Which command switches to or creates a database named 'school'?
A. db = 'school'
B. CREATE DATABASE school;
C. switch school
D. use school
Direction: Choose the correct option

Q4.

How do you view all databases in the MongoDB shell?
A. db.show()
B. show dbs
C. list databases
D. SHOW DATABASES
Direction: Choose the correct option

Q5.

What happens when you insert a document into a collection that doesn't exist?
A. The document is ignored
B. An error is thrown
C. The collection is automatically created
D. The operation fails