Q1
Q1 What type of database is MongoDB?
Relational
Document-Oriented
Graph
Key-Value
Q2
Q2 In MongoDB, what does the term 'collection' refer to?
A group of databases
A single document
A group of documents
A type of index
Q3
Q3 What is the outcome of the command db.createCollection("myCollection") in MongoDB?
Creates a new document
Deletes a collection
Creates a new collection
Updates a collection
Q4
Q4 Which operating system is NOT supported by MongoDB?
Windows
Linux
macOS
iOS
Q5
Q5 What is the default port for MongoDB server?
27015
28017
27017
8080
Q6
Q6 Which of the following is required to install MongoDB?
Java Runtime Environment
Python
Node.js
None of these
Q7
Q7 In MongoDB, what is the role of the mongod process?
Manages the database
Runs the shell interface
Manages client connections
Handles replication
Q8
Q8 What is the primary function of the mongo shell?
Data backup
Database management and querying
User authentication
Server monitoring
Q9
Q9 Which file format is used for MongoDB configuration?
JSON
YAML
XML
INI
Q10
Q10 Which command is used to start a MongoDB server?
mongod start
mongo start
start mongod
run mongod
Q11
Q11 How do you specify an alternate configuration file when starting MongoDB?
mongod --config /path/to/config
mongod --file /path/to/config
mongod -c /path/to/config
mongod --use /path/to/config
Q12
Q12 Identify the issue:
mongodb --start
Incorrect command format
Missing configuration file
Incorrect file permissions
Outdated MongoDB version
Q13
Q13 MongoDB fails to start with error "Address already in use".
What is the likely cause?
Port conflict with another application
Insufficient permissions
Corrupted installation
Outdated MongoDB version
Q14
Q14 What does 'CRUD' stand for in MongoDB?
Create, Read, Update, Delete
Create, Retrieve, Upload, Delete
Connect, Read, Unload, Display
Create, Read, Utilize, Deploy
Q15
Q15 Which method is used to insert a single document into a MongoDB collection?
db.collection.insertOne()
db.collection.insert()
db.collection.addOne()
db.collection.create()
Q16
Q16 What does the find() method in MongoDB return?
A single document
An array of documents
A cursor
A JSON object
Q17
Q17 Which CRUD operation is used to add new data to a MongoDB database?
Insert
Select
Update
Delete
Q18
Q18 How does MongoDB treat fields that are not specified in the $set part of an update operation?
They are deleted
They remain unchanged
They are set to null
They are marked as undefined
Q19
Q19 What is the purpose of the $unset operator in an update operation in MongoDB?
To delete a field from a document
To set a field to null
To hide a field in the output
To create a new field
Q20
Q20 What does the upsert option do in an update operation in MongoDB?
Updates an existing document, otherwise does nothing
Updates all matching documents
Inserts a new document if no match is found
Deletes the document if it exists
Q21
Q21 What will the following command do?
db.users.remove({})
Remove all documents from the 'users' collection
Remove the 'users' collection
Remove one random document
Do nothing
Q22
Q22 Which command is used to update all documents that meet certain criteria in MongoDB?
db.collection.updateMany()
db.collection.updateOne()
db.collection.update()
db.collection.modify()
Q23
Q23 What does this command do?
db.products.find({price: {$gt: 100}})
Finds products with a price equal to 100
Finds products with a price less than 100
Finds products with a price greater than 100
Updates the price of products over 100
Q24
Q24 Which MongoDB command is used to add a new field to an existing document?
db.collection.update({}, {$set: {newField: value}})
db.collection.add({}, {newField: value})
db.collection.newField({newField: value})
db.collection.addField({newField: value})
Q25
Q25 Identify the issue:
db.users.find({age: "25"})
Incorrect collection name
Incorrect field name
Type mismatch in query value
Missing query operator
Q26
Q26 What's wrong with this update command?
db.users.update({name: "John"}, {age: 30})
It replaces the entire document
It's missing the $set operator
It updates all users named John
There's no issue
Q27
Q27 Spot the error in this command:
db.collection.deleteOne({ _id: 123 })
Incorrect method name
Incorrect field value
Missing quotation marks around the _id value
No error
Q28
Q28 Why might db.collection.insertOne({name: "Alice", age: null}) not add a new document?
'age' field cannot be null
'name' field is duplicated
Collection does not exist
Missing required fields
Q29
Q29 In MongoDB, what is a 'schema'?
A predefined structure for data
A query language for the database
A tool for data replication
A security feature
Q30
Q30 Which of the following best describes MongoDB's approach to schemas?
Rigid and predefined
Flexible and dynamic
Fixed and unchangeable
None, as MongoDB does not use schemas