Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

MongoDB Quiz

Total questions: 30

Worksheet time: 15mins

Name
Class
Date
1.

What does NoSQL stand for?

a)

Not Only SQL

b)

No Structured Query Language

c)

Non-Standard Query Language

d)

None of the above

2.

Which of the following is NOT a characteristic of NoSQL databases?

a)

Schema flexibility

b)

High availability

c)

Fixed schema

d)

Horizontal scalability

3.

What type of data model does MongoDB use?

a)

Key-Value Store

b)

Document Store

c)

Column Family Store

d)

Graph Database

4.

In MongoDB, what is a collection?

a)

A single data record

b)

A grouping of related documents

c)

A type of database

d)

A field within a document

5.

Which command is used to create a new collection in MongoDB?

a)

createCollection()

b)

insertCollection()

c)

newCollection()

d)

addCollection()

6.

When inserting a document in MongoDB, which method is used?

a)

addOne()

b)

insert()

c)

insertOne()

d)

create()

7.

What is the default port for MongoDB?

a)

8080

b)

27017

c)

5432

d)

3306

8.

Which command would you use to connect to a MongoDB server?

a)

mongo connect

b)

mongo --connect

c)

mongo

d)

connect mongo

9.

What is the purpose of creating indexes in MongoDB?

a)

To speed up data insertion

b)

To speed up data retrieval

c)

To compress data

d)

To secure data

10.

Which MongoDB command is used to delete a document?

a)

drop()

b)

delete()

c)

remove()

d)

deleteOne()

11.

In MongoDB, which role provides read and write access to a database?

a)

read

b)

readWrite

c)

dbAdmin

d)

userAdmin

12.

What is the primary function of user roles in MongoDB?

a)

To manage data

b)

To define user permissions

c)

To create collections

d)

To enforce data integrity

13.

What command is used to enable access control in MongoDB?

a)

setAuth()

b)

--auth

c)

enableAuth()

d)

startAuth()

14.

How can you create an admin user in MongoDB?

a)

db.createAdminUser()

b)

db.createUser()

c)

db.createAdmin()

d)

db.addUser()

15.

What is the use of the aggregation framework in MongoDB?

a)

To perform complex data operations

b)

To create indexes

c)

To define user roles

d)

To backup databases

16.

Which of the following would you use to connect to MongoDB from a Node.js application?

a)

MongoClient

b)

MongoDBClient

c)

NodeMongoClient

d)

MongoDBConnection

17.

In a Node.js application, which package is used to interact with MongoDB?

a)

mongodb

b)

mongo-driver

c)

mongo-package

d)

db-mongo

18.

When performing CRUD operations, which method would you use to update a document in MongoDB?

a)

updateRecord()

b)

updateOne()

c)

modify()

d)

changeOne()

19.

Which command is used to create a unique index on a field in a MongoDB collection?

a)

createIndex({ field: 1 })

b)

createUniqueIndex({ field: 1 })

c)

createIndex({ field: 1 }, { unique: true })

d)

addIndex({ field: 1 })

20.

What does BSON stand for in MongoDB?

a)

Binary Standard Object Notation

b)

Binary JSON

c)

Basic Structured Object Notation

d)

Binary Structured Object Notation

21.

Which command is used to view all collections in the current database?

a)

show collections

b)

list collections

c)

display collections

d)

get collections

22.

What is the purpose of the use command in MongoDB?

a)

To switch to a different database

b)

To create a new collection

c)

To insert a document

d)

To delete a database

23.

What method would you use to find all documents in a collection?

a)

findAll()

b)

getAll()

c)

find()

d)

query()

24.

How do you drop a collection in MongoDB?

a)

dropCollection()

b)

removeCollection()

c)

db.collection.drop()

d)

deleteCollection()

25.

In a MongoDB document, what is a field?

a)

A type of collection

b)

A single record

c)

A key-value pair

d)

A database identifier

26.

What is a capped collection in MongoDB?

a)

A collection with a fixed size

b)

A collection that cannot be deleted

c)

A collection that only allows unique values

d)

A collection with unlimited size

27.

Which command is used to create a backup of a MongoDB database?

a)

mongodump

b)

backupMongo

c)

dumpMongo

d)

createBackup

28.

In Node.js, what is the purpose of the client.close() method?

a)

To disconnect from the database

b)

To delete the database

c)

To remove the client object

d)

To close the application

29.

Which method would you use to aggregate data in MongoDB?

a)

aggregateData()

b)

processData()

c)

aggregate()

d)

summarize()

30.

How do you enable schema validation in MongoDB?

a)

By creating a schema with createCollection()

b)

By using createSchema()

c)

By setting validation rules in the database

d)

By adding a validation flag to the collection