nosql all
After deleting a document, the MongoDB Shell will return a document that contains two properties: acknowledged, which is set to a boolean, and deletedCount, which is set to a number. True/False?
True
Document databases can't handle transactions that operates over multiple documents. Select one: True False
True
In mongosh, when you assign the cursor returned from the find() method to a variable using the var keyword, the cursor does not automatically iterate. True/False
True
MongoDB can ingest multiple shapes and formats of data from different sources. True/False
True
MongoDB follows a code-first approach, which means you can start writing your data as soon as you connect to the database. True/False
True
Which of the following statements regarding the replaceOne() method for the MongoDB Shell (mongosh) are true? (Select all that apply.) a. This method returns a document containing an acknowledgement of the operation, a matched count, modified count, and an upserted ID (if applicable). b. This method accepts a filter document, a replacement document, and an optional options document. c. This method is used to replace a single document that matches the filter document. d. This method can replace multiple documents in a collection.
a. This method returns a document containing an acknowledgement of the operation, a matched count, modified count, and an upserted ID (if applicable). b. This method accepts a filter document, a replacement document, and an optional options document. c. This method is used to replace a single document that matches the filter document.
What does iterate the cursor to apply a JavaScript function to each document from the cursor? (Select one) a. cursor.forEach() b. cursor.hasNext() c. cursor.toArray() d. cursor.next() e. db.collection.find()
a. cursor.forEach()
Which of the following line skips the first 5 documents in the bios collection and returns all remaining documents?: a. db.bios.find().skip(5) b. db.bios.find().sort(5) c. db.bios.find().skip(1) d. db.bios.find().limit(5)
a. db.bios.find().skip(5)
In the MongoDB shell, how can you tell if an index was used with a query?: a. db.customers.find({lastName: 'smith'}).explain() b. db.customers.find({lastName: 'smith'}).plan() c. db.customers.find({lastName: 'smith'}).usedIndex() d. db.customers.find({lastName: 'smith'}).perf()
a. db.customers.find({lastName: 'smith'}).explain()
You have a collection of thousands of students. You'd like to return the second set of 20 documents from the sorted collection. What is the proper order in which to apply the operations?: a. sort, skip, limit b. limit, sort, skip c. sort, limit, skip d. limit, skip, sort
a. sort, skip, limit
Which of th following expression is used to gets the first document from the source documents according to the grouping? a. $first b. $push c. $addToSet d. $last
a. $first
MongoDB documents of a similar type are grouped into a. A collection b. An index c. A replica set d. A cluster
a. A collection
What is the BSON in MongoDB? a. Binary representation of JSON b. A query language c. A backup tool d. none of the mentioned
a. Binary representation of JSON
How is data stored in a MongoDB database? a. Data is stored in documents b. Data is stored in tables c. Data is stored in key-value pairs d. Data is stored in rows and columns
a. Data is stored in documents
Which of the following phases are included in our data modeling methodology for MongoDB? (Select all that apply.) a. Identifying the relationships between pieces of information. b. Identifying the workload of the system. c. Applying schema design patterns.
a. Identifying the relationships between pieces of information. b. Identifying the workload of the system. c. Applying schema design patterns.
Which of the following are use cases in which you should model your data for performance rather than simplicity? (Select all that apply.) a. It is expected that the solution will be designed with only 10 shards. b. The application is being developed by 100 engineers. c. There is not an applicable design pattern to the solution.
a. It is expected that the solution will be designed with only 10 shards. b. The application is being developed by 100 engineers.
Which of the following is an online NoSQL database developed by MongoDB? a. MongoDB Atlas b. MongoDB Shell c. NoSQL Cloud d. MongoDB Compass
a. MongoDB Atlas
Which of the following statements are true about MongoDB documents? (Select all that apply.) a. MongoDB documents have a flexible schema. b. MongoDB documents are stored as BSON documents. c. MongoDB documents within a collection must have the same fields.
a. MongoDB documents have a flexible schema. b. MongoDB documents are stored as BSON documents.
Which of the following statements are true about data modeling using MongoDB? a. MongoDB will help you iterate on the schema designs of your models throughout your application's lifecycle. b. MongoDB is schema-less so you should not worry about designing a schema for your models. c. MongoDB should only be used for unstructured datasets.
a. MongoDB will help you iterate on the schema designs of your models throughout your application's lifecycle.
Which of the following is not a usual constraint that would impact your data model for MongoDB? a. Operating System b. Disk Drives c. RAM d. Security e. Network
a. Operating System
Why is version control important for MongoDB deployments? a. To track changes in the MongoDB deployment over time. b. To simplify the backup process. c. To prevent unauthorized access to the MongoDB deployment. d. To ensure compatibility between MongoDB and third-party applications
a. To track changes in the MongoDB deployment over time.
How does the value of _id get assigned to a document? Check all answers that apply: a. You can select a non ObjectId type value when inserting a new document, as long as that value is unique to this collection. b. When a document is inserted a random field is picked to serve as the _id field. c. It is automatically generated as an ObjectId type value. d. _id field values are sequential integer values.
a. You can select a non ObjectId type value when inserting a new document, as long as that value is unique to this collection. c. It is automatically generated as an ObjectId type value.
What component acts as an interface between a client application and sharded cluster in MongoDB? a. mongos b. mongod c. config servers d. primary shard
a. mongos
Where is the database created correctly? : a. use db_name b. using db_name c. set db_name d. create db_name e. make db_name
a. use db_name
Which of the following documents is correct JSON? a. {"name" : "Devi", "age": 19, "major": "Computer Science"} b. ["name": "Devi", "age": 19, "major": "Computer Science"] c. {name: "Devi", age: 19, major: "Computer Science"}
a. {"name" : "Devi", "age": 19, "major": "Computer Science"}
Which one is not Comparison Operators? a.$exists b.$ne c.$gte d.$gt
a.$exists
Which MongoDB aggregation pipeline stage is used to group documents together based on a specific key? a.$group b.$match c.$sort d.$project
a.$group
Which MongoDB aggregation pipeline stage is used to sort the documents based on specified field? a.$sort b.$group c.$match d.$project
a.$sort
Which statement accurately describes the importance of backups in MongoDB? a.Regular backups should be taken and stored in a secure location to ensure data recovery in the event of a disaster. b.Backups are only needed for non-production MongoDB deployments. c.Backups are optional and not necessary for maintaining the security of a MongoDB deployment. d.MongoDB does not provide any built-in backup options, so users must rely solely on third-party solutions.
a.Regular backups should be taken and stored in a secure location to ensure data recovery in the event of a disaster.
What is true about $group stages in aggregation framework ? a.This is a filtering operation and thus this can reduce the amount of documents that are given as input to the next stage. b.This does the actual aggregation c.Sorts the documents d.None of the above
a.This is a filtering operation and thus this can reduce the amount of documents that are given as input to the next stage.
Which of the following statements regarding the deleteMany() MongoDB Shell (mongosh) method are correct? (Select all that apply.) a.This method accepts a filter document and an optional options document and is used to delete multiple documents in a collection. b.This method is used to delete multiple collections at once. c.This method can be used to delete all documents in a collection. d.This method is used to delete the first document that matches a filter document.
a.This method accepts a filter document and an optional options document and is used to delete multiple documents in a collection. c.This method can be used to delete all documents in a collection.
Which one is an Update Operators a.all answers are correct b.$mul c.$addToSet d.$rename e.$pop
a.all answers are correct
How to count number of the documents in the cursor a.cursor.count() b.cursor.limit(<number>) c.there is no right answer d.cursor.skip(<number>) e.cursor.sort({<field1>: 1})
a.cursor.count()
How to delete Collection a.db. <Collection name>.drop() b.show collections c.db.createCollection("<Collection name>") d.Use <database name> e.db.dropDatabase()
a.db. <Collection name>.drop()
What methods deletes collection with all documents and indexes? (Select all that apply.) a.db.dropDatabase() b.db.indexname.removes(query) c.db.databases.remove(query) d.db.deleteOne(query) e.db.collection.drop()
a.db.dropDatabase() e.db.collection.drop()
How to List all Collections inside active Database a.show collections b.db.dropDatabase() c.db. <database name>.drop() d.db.createCollection("<Collection name>") e.Use <database name>
a.show collections
Which one is not Query Operators? a. $gt b. $regex c. $It d. $all е. $or
b. $regex
Which port does MongoDB use? : a. 27710 b. 27017 c. 27170 d. 72071
b. 27017
What statement is true with regard to the localhost exception? a. Localhost connections are blacklisted by default. b. Any user logging on from localhost bypasses authentication. c. You can create the first user when connecting to a newly configured mongod from localhost. d. You need to use the mongod user to create additional users when connecting to a mongod for the first time.
b. Any user logging on from localhost bypasses authentication.
What is the document? a. None answers correct b. Document is the equivalent to rows in RDBMS c. Document is the equivalent to tables in RDBMS d. In mongoldb document is the log files.
b. Document is the equivalent to rows in RDBMS
Which of the following statements are true about the mongo shell? (check all that apply) a. mongo shell automatically returns an ordered list of results b. It allows you to interact with your MongoDB instance without using a Graphical User Interface c. It is a fully functioning JavaScript interpreter
b. It allows you to interact with your MongoDB instance without using a Graphical User Interface c. It is a fully functioning JavaScript interpreter
MongoDB is schemaless. What does that mean? a. That you can only store structured data in MongoDB. b. MongoDB does not require that you create the schema and the table structures before writing the data. c. The schema is already created, so all you need to do is to create the table structures that will hold your data. d. With MongoDB, you don't need to alter your tables to store additional fields.
b. MongoDB does not require that you create the schema and the table structures before writing the data.
What is the main aim of NoSQL? a. NoSQL databases allow storing non-structured data. b. NoSQL provides an alternative to SQL databases to store textual data. c. NoSQL is a new data format to store large datasets. d. NoSQL is not suitable for storing structured data.
b. NoSQL provides an alternative to SQL databases to store textual data.
What is a characteristic of column-based NoSQL databases? a. Columns are grouped together in families because they are often accessed individually. b. Rows in column families can share all, a subset, or none of the columns. c. Rows in column families are required to share the same columns. d. Rows in column families share a common key or identifier.
b. Rows in column families can share all, a subset, or none of the columns.
Which of the following is not a NoSQL database? a. Amazon SimpleDB b. SQL server c. Cassandra d. MongoDB e. None of the mentioned
b. SQL server
What is the outcome of this command line instruction? mongod --dbpath /data/db --port 40001 --replSet RS-0 --bind_ip 10.0.0.10 a. Log files will be stored in folder /data/db b. The mongod will be listening for incoming requests on port 40001 c. All incoming requests need to come from a client with ip 10.0.0.10 d. The mongod will be accepting requests on localhost
b. The mongod will be listening for incoming requests on port 40001
What is the most common trait among all NoSQL databases? a. They are all open source b. They are all non-relational c. They are all relational d. They are all document-based
b. They are all non-relational
What makes Key-Value NoSQL databases powerful for basic CRUD operations? a.The value blob is opaque. b. They are represented as a hashmap. c. They are atomic for key operations. d. They shard easily across nodes.
b. They are represented as a hashmap.
How to change active Database? a.db. <database name>.drop() b.Use <database name> c.there is no right answer d.db.createCollection("<database name>") e.db.dropDatabase()
b.Use <database name>
How to iterate all documents in the cursor and perform operation with each of them a.cursor.next() b.cursor.forEach(<function>) c.cursor.objsLeftInBatch() d.cursor.toArray() e.cursor.hasNext()
b.cursor.forEach(<function>)
What method does instruct the server to avoid closing a cursor automatically after a period of inactivity? (Select one) a.cursor.pretty() b.cursor.noCursorTimeout() c.cursor.objsLeftInBatch() d.cursor.readConcern()e.cursor.readPref()
b.cursor.noCursorTimeout()
Which command returns all of the documents in the customers collection?: a.db.customers.all(); b.db.customers.find(); c.db.find().customers(); d.db.customers.show();
b.db.customers.find();
The _______ operator can be used to identify an element in the array to be updated without explicitly specifying the position of the element.: a. $elemMatch b. Updating an array field without knowing its index is not possible c. $ d. $slice
c. $
To remove a database and all of its records from MongoDB, what operator should you use?: a. removeAll() b. clear() c. dropDatabase() d. deleteDatabase()
c. dropDatabase()
What does "horizontal scalability" refer to in the context of NoSQL databases? a. Normalizing data structures b. Expanding the database server vertically c. Adding more servers to handle increased load d. All of the mentioned e. Implementing strict ACID transactions
c. Adding more servers to handle increased load
Which use case would be a poor choice for a document type NoSQL database? a. Event logging for a process b. Operational data sets for a web app c. Aggregate-oriented design d. Online blogging
c. Aggregate-oriented design
Working with MongoDB is easy because ____________ a. It allows you to share data in a relational way only. b. You need to first create the schema and the table structures that will hold your data. c. It allows you to focus on what data you are writing and how you are going to read it. d. You need to alter your tables if you decide to store an additional field.
c. It allows you to focus on what data you are writing and how you are going to read it.
What statement is false about naming a database in MongoDB? a. It must be fewer than 64 characters b. It cannot contain any of these symbols \."$*<>:|? c. It can be empty d. It cannot contain null
c. It can be empty
What are the four main categories of NoSQL databases? a. Key-Value, Distributed, Column, Graph b. Key-Value, Document, Common, Graph c. Key-Value, Document, Column, Graph d. Key-Value, Relational, Column, Graph
c. Key-Value, Document, Column, Graph
The "Many Sources One View" use case of MongoDB suggests that a. MongoDB can collect vast amounts of data. b. MongoDB can store data collected from multiple sources as long as they are the same format. c. MongoDB can ingest different types of data from different sources and consolidate it into one view for all data. d. MongoDB can store data that is of different types and formats.
c. MongoDB can ingest different types of data from different sources and consolidate it into one view for all data.
What may be the most common reason to use a NoSQL database? a. Security b. Consistency c. Scalability d. Availability
c. Scalability
What does it mean when we say that MongoDB follows a code-first approach? a. It allows you to use third-party frameworks to give you read and write operations. b. You can store unstructured data. c. There are no complex table definitions so you can start writing your first data as soon as you connect to your MongoDB database. d. You're ready to work on your database as soon as your table design is created.
c. There are no complex table definitions so you can start writing your first data as soon as you connect to your MongoDB database.
Which MongoDB command is used to display the database you are currently using? a. None of the mentioned b. show currentDatabase c. db d. use db e. show db
c. db
Where is the collection created correctly? : a. db.createCollections(some) b. db.collection("some") c. db.createCollection("some") d. db.create("some")
c. db.createCollection("some")
How can you view all available databases in MongoDB using the command line? a. view databases; b. display databases; c. show dbs; d. list dbs; e. show db;
c. show dbs;
What's not included in CRUD operations? a. delete b. update c. write d. create e. read
c. write
What is true about $unwind stages in aggregation framework ? a.This stage we will increase the amount of documents for the next stage. b.All of the mentioned c.It is used to unwind (split) document that are using arrays. d.When using an array, the data is kind of pre-joined and this operation will be undone with this to have individual documents again.
c.It is used to unwind (split) document that are using arrays.
Which statement accurately describes MongoDB Native Authentication? a.MongoDB Native Authentication is a ticket-based authentication system often used in enterprise environments. b.None of the mentioned c.MongoDB Native Authentication allows users to authenticate using a username and password combination. d.MongoDB Native Authentication involves verifying users using an LDAP server.
c.MongoDB Native Authentication allows users to authenticate using a username and password combination.
How to sort documents in the cursor a.there is no right answer b.cursor.skip(<number>) c.cursor.sort({<field1>: 1}) d.cursor.count() e.cursor.limit(<number>
c.cursor.sort({<field1>: 1})
The basic syntax of Aggregation is? a.aggregate(AGGREGATE_OPERATION) b.db.COLLECTION_NAME.aggregate({key:1}) c.db.COLLECTION_NAME.aggregate(AGGREGATE_OPERATION) d.db.COLLECTION_NAME.aggregation(AGGREGATE_OPERATION)
c.db.COLLECTION_NAME.aggregate(AGGREGATE_OPERATION)
You are going to do a series of updates to multiple records. You find setting the multi option of the update() command too tiresome. What should you do instead?: a. Set the global multi option to True b. Use the replaceMany() command instead c. Use the updateMulti() command instead d. Use the updateMany() command instead
d. Use the updateMany() command instead
What method does return an array that contains all the documents from a cursor? (Select one) a. db.collection.find() b. cursor.forEach() c. cursor.hasNext() d. cursor.toArray() e. cursor.readConcern()
d. cursor.toArray()
Which MongoDB aggregation pipeline stage is used to calculate the sum of field? a. $min b. $avg c. $max d. $sum
d. $sum
Which encryption algorithm is commonly used for MongoDB encryption at rest? a. Triple Data Encryption Standard (3DES) algorithm b. RSA algorithm c. Diffie-Hellman key exchange algorithm d. Advanced Encryption Standard (AES) algorithm
d. Advanced Encryption Standard (AES) algorithm
What is the name of the fully managed service model that many NoSQL databases now leverage? a. Software-as-a-service (SaaS) b. Network-as-a-service (NaaS) с. Platform-as-a-service (PaaS) d. Database-as-a-service (DBaaS)
d. Database-as-a-service (DBaaS)
Which category of NoSQL databases is it recommended not to shard data on? a. Key-Value NoSQL databases b. Column-based NoSQL databases c. Document-based NoSQL databases d. Graph NoSQL databases
d. Graph NoSQL databases
What common trait does the NoSQL family of databases share? a. Exclusion of SQL b. Tabular style c. Technology d. Non-relational
d. Non-relational
What will be the output -javascript db.posts.find( { likes: { $gt: 200}, likes: { $lt : 400 } } ); a. Will return syntax error b. none of the mentioned c. Posts with likes less than 400 d. Posts with likes greater than 200 but less than 400 e. Posts with likes greater than or equal to 200 but less than or equal to 400
d. Posts with likes greater than 200 but less than 400
Typical MongoDB setups are a three-node replica set. The ________________ process keeps a copy of your data on the primary node on the other data bearing nodes in the cluster. a. Clustering b. Redundancy c. Aggregation d. Replication
d. Replication
___________ provided by MongoDB means as your data needs grow, you can introduce bigger, faster, and better hardware, and partition your data. a. Flexibility b. High availability c. Self-management d. Scalability
d. Scalability
Which document formats are typically used for documents stored in a document-based NoSQL database? a. XML and CSV format b. PDF and JSON format c. CSV and JSON format d. XML and JSON format
d. XML and JSON format
Which one is an Update Methods a. Update() b. updateMany) c. replaceOne() d. all answers are correct e. updateOne()
d. all answers are correct
Which of the following is a valid query using the find method to retrieve documents with a specific value in a field? a. find(field: "value"); b. find({value: $field}); c. find({value, field}); d. find({field: "value"}); e. find(field = "value");
d. find({field: "value"});
You are attempting to run a mongod with the following options in your terminal. Assume the directory paths and permissions are correctly set. The mongod is not starting. mongod --port 35000 --dbpath /home/user/mongodb/data --fork What is the cause? a. the port must be 27017 b. the directory /home/user/mongodb/data is empty c. −−b∈dipall is not specified d. −−logpath is not specified
d. −−logpath is not specified
Which of th following expression is used to calculates the average of all given values from all documents in the collection? a.$min b.$sum c.$max d.$avg
d.$avg
Which security measure in MongoDB helps restrict database operations based on user roles? a.Encryption b.Authentication c.Auditing d.Authorization
d.Authorization
What does MongoDB security primarily aim to ensure? a.Query optimization and performance tuning. b.High availability and fault tolerance. c.Data normalization and consistency. d.Confidentiality, integrity, and availability of data.
d.Confidentiality, integrity, and availability of data.
Which of the following is NOT a key consideration for server and network setup in MongoDB? a.Network binding b.Authentication and authorization c.SSL/TLS encryption d.Database schema design e.Firewall configuration
d.Database schema design
How to limit number of the documents in the cursor a.there is no right answer b.cursor.count() c.cursor.sort({<field1>: 1}) d.cursor.limit(<number>) e.cursor.skip(<number>)
d.cursor.limit(<number>)
How to quantity of documents left in current batch a.cursor.hasNext() b.var cursor = db. <Collection name>.find(<args>); c.cursor.next() d.cursor.objsLeftInBatch() e.there is no right answer
d.cursor.objsLeftInBatch()
How to Delete Database a.Use <database name> b.show collections c.db. <collection name>.drop() d.db.dropDatabase() e.db.createCollection("<Collection name>"
d.db.dropDatabase()
Which of the following tasks can you accomplish in MongoDB Compass? a. Create aggregation pipelines with the Aggregation Pipeline Builder. b. Run commands from the embedded MongoDB Shell. c. Import data from CSV or JSON files. d. Query data directly in the Compass query bar. e. All of the above.
e. All of the above.
Which of the following best describes MongoDB? a. Relational database b. Graph database c. None of the mentioned d. Spreadsheet program e. Document-based NoSQL database
e. Document-based NoSQL database
How to skip certain number of the documents a.there is no right answer b.cursor.limit(<number>) c.cursor.sort({<field1>: 1}) d.cursor.count() e.cursor.skip(<number>)
e.cursor.skip(<number>)
How to iterate all documents in the cursor and push them to the array a.cursor.objsLeftInBatch() b.cursor.next() c.var cursor = db. <Collection name>.find(<args>); d.cursor.hasNext() e.cursor.toArray()
e.cursor.toArray()
How to Returns One Document in Extended JSON format a.all answers are correct b.db. <Collection name>.insertMany() c.there is no right answer d.db. <Collection name>.insertOne(<object>) e.db. <Collection name>.findOne(<query>,<fields> )
e.db. <Collection name>.findOne(<query>,<fields> )
How to insert Many Documents a.there is no right answer b.db. <Collection name>.insertOne() c.db. <Collection name>.insertOne(<object>) d.all answers are correct e.db. <Collection name>.insert(<Array of objects>)
e.db. <Collection name>.insert(<Array of objects>)
How to create new Collection? a.db. <database name>.drop() b.there is no right answer c.db.dropDatabase() d.Use <database name> e.db.createCollection("<Collection name>")
e.db.createCollection("<Collection name>")
What are the types of NoSQL databases? a. Key-value stores b. Graph & Column-oriented databases с. All of the above d. Document databases
с. All of the above
In MongoDB operations modify the data of a single collection. a. READ b. GRID с. CRUD d. All of the mentioned
с. CRUD