Font size
WorksheetsQuiz-1-Sec-e
Total questions: 80
Worksheet time: 43mins
Consider that you have the following two documents in the products collection:
{ "_id" : 1, "prices" : [ 60, 100, 200 ] }
{ "_id" : 2, "prices" : [ 20, 90, 150 ] }
What will the following query result into:
db.products.update( { _id: 1, prices: 100 }, { $set: { "prices.$" : 111 } } )
Updates 60 to 100
Updates 100 to 111
Updates 60,100 and 200 to 111
Removes the three elements of the prices array and replaces it only a single element 111
What kind of NoSQL database MongoDB is?
Document Oriented
Key Value
Graph
Column Oriented
Which of the following is a valid MongoDB JSON document:
{}
{ "user_id"=1, "user_name"="Joe Sanders", "occupation"=["engineer","writer"] }
{ "user_id":1; "user_name":"Joe Sanders"; "occupation":["engineer","writer"] }
{ "user_id":1, "user_name":"Joe Sanders", "occupation":[ "occupation1":"engineer", "occupation2":"writer" ] }
Which of the following commands create an unique index on author field of the posts collection?
db.posts.createIndex({"author":1 }, {"unique": true});
db.posts.createIndex({"author": unique });
db.posts.createIndex({"author": {$unique:1} });
db.posts.createIndexUnique({"author":1 });
In a collection that contains 100 post documents, what does the following command do?
db.posts.find().skip(5).limit(5)
Skip and limit nullify each other. Hence returning the first five documents.
Skips the first five documents and returns the sixth document five times
Skips the first five documents and returns the next five
Limits the first five documents and then return them in reverse order
Consider a collection posts which has fields: id, posttext, post_author, post_timestamp, post_tags etc. Which of the following query retrieves ONLY the key named post_text from the first document retrieved?
db.posts.find({},{_id:0, post_text:1})
db.posts.findOne({post_text:1})
db.posts.finOne({},{post_text:1})
db.posts.finOne({},{_id:0, post_text:1})
A collection and a document in MongoDB is equivalent to which of the SQL concepts respectively?
Table and Row
Table and Column
Column and Row
Database and Table
Which of the following MongoDB query is equivalent to the following SQL query:
UPDATE users SET status = "C" WHERE age > 25
db.users.update( { age: { $gt: 25 } }, { status: "C" })
db.users.update( { age: { $gt: 25 } }, { $set: { status: "C" } })
db.users.update( { age: { $gt: 25 } }, { $set: { status: "C" } }, { multi: true })
db.users.update( { age: { $gt: 25 } }, { status: "C" }, { multi: true })
Which syntax returns the first matching result in a Mongo database?
db.find()
db.Find()
db.findone()
db.findOne()
Which is the best syntax to add a new entry to a Mongo database?
db.insert({"title":"Two Cities"})
db.add("title":"Two Cities")
db.insert({"title","Two Cities"})
db.add("title","Two Cities")
What is the name of the group of related data stored in a Mongo database?
A cell.
A document.
A spreadsheet.
A table.
Which syntax is correct for declaring a Mongo collection named theFarm?
farmdb = new Mongo.collection('theFarm');
farmdb = new Mongo.Collection('theFarm');
farmdb = new mongo.Collection('theFarm');
farmdb = new mongo.collection('theFarm');
Where should a newly created JavaScript file containing the definition of a Mongo collection be imported?
In the client-side JavaScript code.
In the server-side JavaScript code.
In both the client-side and server-side JavaScript code.
No import is necessary because Meteor detects it automatically.
Which function has the correct syntax to return the number of records stored in a collection?
db.find().count
db.find().count()
db.find.count()
db.find.count
What does the MongoDB find function return?
A cursor.
A pointer.
A record.
An array.
Point out the correct statement
MongoDB is classified as a NoSQL database
MongoDB favors XML format more than JSON
MongoDB is column oriented database store
All of the mentioned
Which of the following format is supported by MongoDB?
SQL
XML
BSON
All of the mentioned
MongoDB has been adopted as ________ software by a number of major websites and services.
Frontend
Proprietary
Backend
All of the mentioned
MongoDB is a _________ database that provides high performance, high availability, and easy scalability.
Graph
Key value
Document
All of the mentioned
NoSQL databases is used mainly for handling large volumes of ______________ data.
Unstructured
Structured
Semi-structured
All of the mentioned
Collection is a group of MongoDB ___________?
Database
Document
Row
Table
Port number for Mongodb
3000
8080
27017
127
How to get the list of databases in your system?
display dbs
db
show db
show dbs
How to create a database in mongodb?
create databaseName
new databaseName
use databaseName
None of the above
Which of the following method is used to query documents in collections?
move
shell
find
replace
What is mongoose ?
A middleware used to work with MongoDB
code name of MongoDb in Express.
Which of the following statements need not be a part of the mongoose database integration module ?
require express
require mongoose
creating a schema
creating a model
Which HTTP method is advised to send sensitive information like password and OTP while sending it to the application server ?
GET
POST
DELETE
What is the equivalent command in MongoDB for the following SQL query?
SELECT * FROM posts WHERE author like "%john%"
db.posts.find( { author: /john/ } )
db.posts.find( { author: {$like: /john/} } )
db.posts.find( { $like: {author: /john/} } )
db.posts.find( { author: /^john^/ } )
Initial release of MongoDB was in the year?
2000
2005
2009
2011
MongoDB is a _________ database that provides high performance, high availability, and easy scalability.
Graph
Key-Value
Document
All the above
BSON is a binary representation of ________ documents.
JSON
XML
Script
All the above
____________ method renders the document in a JSON-like format.
displayjson
printjson
printdoc
Which of the following method corresponds to Order by clause in SQL?
sort()
order()
orderby()
All the above
The __________ method limits the number of documents in the result set.
limit
limitOf
limitBy
None of the Above
Which of the following line skips the first 5 documents in the bios collection and returns all remaining documents?
db.bios.find().limit( 5 )
db.bios.find().skip( 1 )
db.bios.find().skip( 5)
db.bios.find().sort( 5 )
Which of the following is not a NoSql database?
Cassandra
MongoDB
MySql
HBase
What is the interactive shell for MongoDB called?
Mongo
dbmong
mongosh
mongodb
What is the maximum size of a MongoDB document?
2MB
16MB
12MB
No limit.Depends on RAM
mongo looks for a database server listening on port
27017
8080
23
443
How many bits involve in _id?
9
10
11
12
Which of the following is not part of _id?
Timestamp
machineID
processID
counter
documentID
What name is given to columns in MongoDB?
Collections
Fields
Documents
Database
What name is given to Table in MongoDB?
Collections
Fields
Documents
Database
db.dropDatabase() is the command to?
Drop any one database randomly
Error command had no DB name
Drop database that is currently mounted
No such command exist
which of the following will display only students name and GPA?
db.Students.find({},{"sName":1, "GPA":1})
db.Students.find({},{"sName":1, "GPA":1, "_id":0})
db.Students.find({},{"sName":1, "GPA":0})
db.Students.find({"sName":1, "GPA":1, "_id":0})
Which of the following will display details of sName "Sumit"?
db.Students.find({sName: "Sumit"})
db.Students.find({sName: "Sumit"},{"sName":1, "GPA":1, "_id":0})
db.Students.find({sName: "Sumit"},{"sName":1, "GPA":0})
db.Students.find({sName: Sumit})
Which of the following will display the number of students having GPA greater than 3.7?
db.Students.find({})
db.Students.find({GPA:3.7})
db.Students.find({GPA:{$gt:3.7}})
db.Students.find({$gt:{GPA:3.7}})
_id is a (a) bytes hexadecimal number which assures the uniqueness of every document.
The following key is used to denote uniqueness in the collection?
id_
_id
id-
id
Please select the correct option
Replica Set is related to high availability whereas Sharding is related to automatic vertical scaling
Sharding is related to high availability whereas Replica Set is related to automatic horizontal scaling
Replica Set is related to high availability whereas Sharding is related to automatic horizontal scaling
I'm not a DBA, why do I need to know this?
Horizontal Scaling...
Involves dividing the system dataset and load over multiple servers, adding additional servers to increase capacity as required
Involves increasing the capacity of a single server, such as using a more powerful CPU, adding more RAM, or increasing the amount of storage space
Involves the proper configuration of a hidden member that will be receiving all the data written to the primary member, and will become available for reporting purposes
I don't know, but sharding is something cool for sure
Please select the correct statement
MongoDB distributes the read and write workload across the shards in the sharded cluster, allowing each shard to process a subset of cluster operations
In production environments, individual shards should not be deployed as replica sets, because it might decrease the redundancy and availability
MongoDB distributes the read and write workload across the members in the replica set, allowing each member to process a subset of cluster operations
Are there really gems for the quiz winners?
Please select the correct statement
A role grants privileges to perform sets of actions on defined resources. A given role applies to all the databases and can not grant access down to a collection level of granularity
MongoDB grants access to data and commands through role-based authorization and provides built-in roles that provide the different levels of access commonly needed in a database system
It is the final question, yaay!!
MongoDB provides the built-in database user and database administration roles on every database, but you can't use them without a shard cluster properly configured
Name each operator in this image.
(don't hit enter!)
What is a Cluster?
Which of the following is not a part of Cassandra architecture?
column
memtable
sstable
cache
caassandra was born at?
yahoo
none
MongoDB supports query joins between collections.
True
false
Point out the wrong statement :
Non Relational databases require that schemas be defined before you can add data
NoSQL databases are built to allow the insertion of data without a predefined schema
NewSQL databases are built to allow the insertion of data without a predefined schema
all
the term nosql was introduced by______
brewers
doug cutting
carlo strozzi
none
Which one of the following is equivalent in MongoDB select* from employee order by salary desc;?
db.employee.find.sort({“salary”:1}]
db.employee.sort ({“salary”:-1}]
db.employee.find.sort ({“salary”:-1}
db.employee.sort({“salary”:1}]
mongo looks for a database server listening on port 27017 on the ________ interface.
Point out the wrong statement.
MongoDB works right out of the box, and you can dive right into developing your application, instead of spending a lot of time fine-tuning obscure database configurations
MongoDB works hard to be very easy to install, configure, maintain, and use
MongoDB does not provide a lot of the features of a traditional RDBMS
None of the mentioned
Point out the correct statement.
A database is a set of key-value pairs
A MongoDB deployment hosts a number of databases
A document holds a set of collections
All of the mentioned
Point out the wrong statement.
Documents have static schema in MongoDB
Eventually-consistent reads can be distributed over replicated servers
Indexes can include keys from embedded documents and arrays
None of the mentioned
Which of the following line skips the first 5 documents in the bios collection and returns all remaining documents?
db.bios.find().limit( 5 )
db.bios.find().skip( 1 )
db.bios.find().skip( 5 )
db.bios.find().sort( 5 )
________ store the relationships between data by including links or references from one document to another.
Capped
Embedded
External
References
In MongoDB, write operations are atomic at the __________ level.
collection
document
row
all of the mentioned
______________ documents capture relationships between data by storing related data in a single document structure.
Capped
Embedded
External
Internal
A ____________ data model with embedded data combines all related data for a represented entity in a single document.
normalized
denormalized
non relational
relational
___________ strategy is used to explicitly avoid document growth.
deallocation
allocation
pre-allocation
none of the mentioned
__________are used to retrieve data from the
database more quickly than otherwise
Implicit
Index
Roll Back
Auto Commit
