wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Quiz-1-Sec-e

Total questions: 80

Worksheet time: 43mins

Name
Class
Date
1.

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 } } )

a)

Updates 60 to 100

b)

Updates 100 to 111

c)

Updates 60,100 and 200 to 111

d)

Removes the three elements of the prices array and replaces it only a single element 111

2.

What kind of NoSQL database MongoDB is?

a)

Document Oriented

b)

Key Value

c)

Graph

d)

Column Oriented

3.

Which of the following is a valid MongoDB JSON document:

a)

{}

b)

{ "user_id"=1, "user_name"="Joe Sanders", "occupation"=["engineer","writer"] }

c)

{ "user_id":1; "user_name":"Joe Sanders"; "occupation":["engineer","writer"] }

d)

{ "user_id":1, "user_name":"Joe Sanders", "occupation":[ "occupation1":"engineer", "occupation2":"writer" ] }

4.

Which of the following commands create an unique index on author field of the posts collection?

a)

db.posts.createIndex({"author":1 }, {"unique": true});

b)

db.posts.createIndex({"author": unique });

c)

db.posts.createIndex({"author": {$unique:1} });

d)

db.posts.createIndexUnique({"author":1 });

5.

In a collection that contains 100 post documents, what does the following command do?

db.posts.find().skip(5).limit(5)

a)

Skip and limit nullify each other. Hence returning the first five documents.

b)

Skips the first five documents and returns the sixth document five times

c)

Skips the first five documents and returns the next five

d)

Limits the first five documents and then return them in reverse order

6.

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?

a)

db.posts.find({},{_id:0, post_text:1})

b)

db.posts.findOne({post_text:1})

c)

db.posts.finOne({},{post_text:1})

d)

db.posts.finOne({},{_id:0, post_text:1})

7.

A collection and a document in MongoDB is equivalent to which of the SQL concepts respectively?

a)

Table and Row

b)

Table and Column

c)

Column and Row

d)

Database and Table

8.

Which of the following MongoDB query is equivalent to the following SQL query:

UPDATE users SET status = "C" WHERE age > 25

a)

db.users.update( { age: { $gt: 25 } }, { status: "C" })

b)

db.users.update( { age: { $gt: 25 } }, { $set: { status: "C" } })

c)

db.users.update( { age: { $gt: 25 } }, { $set: { status: "C" } }, { multi: true })

d)

db.users.update( { age: { $gt: 25 } }, { status: "C" }, { multi: true })

9.

Which syntax returns the first matching result in a Mongo database?

a)

db.find()

b)

db.Find()

c)

db.findone()

d)

db.findOne()

10.

Which is the best syntax to add a new entry to a Mongo database?

a)

db.insert({"title":"Two Cities"})

b)

db.add("title":"Two Cities")

c)

db.insert({"title","Two Cities"})

d)

db.add("title","Two Cities")

11.

What is the name of the group of related data stored in a Mongo database?

a)

A cell.

b)

A document.

c)

A spreadsheet.

d)

A table.

12.

Which syntax is correct for declaring a Mongo collection named theFarm?

a)

farmdb = new Mongo.collection('theFarm');

b)

farmdb = new Mongo.Collection('theFarm');

c)

farmdb = new mongo.Collection('theFarm');

d)

farmdb = new mongo.collection('theFarm');

13.

Where should a newly created JavaScript file containing the definition of a Mongo collection be imported?

a)

In the client-side JavaScript code.

b)

In the server-side JavaScript code.

c)

In both the client-side and server-side JavaScript code.

d)

No import is necessary because Meteor detects it automatically.

14.

Which function has the correct syntax to return the number of records stored in a collection?

a)

db.find().count

b)

db.find().count()

c)

db.find.count()

d)

db.find.count

15.

What does the MongoDB find function return?

a)

A cursor.

b)

A pointer.

c)

A record.

d)

An array.

16.

Point out the correct statement

a)

MongoDB is classified as a NoSQL database

b)

MongoDB favors XML format more than JSON

c)

MongoDB is column oriented database store

d)

All of the mentioned

17.

Which of the following format is supported by MongoDB?

a)

SQL

b)

XML

c)

BSON

d)

All of the mentioned

18.

MongoDB has been adopted as ________ software by a number of major websites and services.

a)

Frontend

b)

Proprietary

c)

Backend

d)

All of the mentioned

19.

MongoDB is a _________ database that provides high performance, high availability, and easy scalability.

a)

Graph

b)

Key value

c)

Document

d)

All of the mentioned

20.

NoSQL databases is used mainly for handling large volumes of ______________ data.

a)

Unstructured

b)

Structured

c)

Semi-structured

d)

All of the mentioned

21.

Collection is a group of MongoDB ___________?

a)

Database

b)

Document

c)

Row

d)

Table

22.

Port number for Mongodb

a)

3000

b)

8080

c)

27017

d)

127

23.

How to get the list of databases in your system?

a)

display dbs

b)

db

c)

show db

d)

show dbs

24.

How to create a database in mongodb?

a)

create databaseName

b)

new databaseName

c)

use databaseName

d)

None of the above

25.

Which of the following method is used to query documents in collections?

a)

move

b)

shell

c)

find

d)

replace

26.

What is mongoose ?

a)

A middleware used to work with MongoDB

b)

code name of MongoDb in Express.

27.

Which of the following statements need not be a part of the mongoose database integration module ?

a)

require express

b)

require mongoose

c)

creating a schema

d)

creating a model

28.

Which HTTP method is advised to send sensitive information like password and OTP while sending it to the application server ?

a)

GET

b)

POST

c)

DELETE

29.

What is the equivalent command in MongoDB for the following SQL query?

SELECT * FROM posts WHERE author like "%john%"

a)

db.posts.find( { author: /john/ } )

b)

db.posts.find( { author: {$like: /john/} } )

c)

db.posts.find( { $like: {author: /john/} } )

d)

db.posts.find( { author: /^john^/ } )

30.

Initial release of MongoDB was in the year?

a)

2000

b)

2005

c)

2009

d)

2011

31.

MongoDB is a _________ database that provides high performance, high availability, and easy scalability.

a)

Graph

b)

Key-Value

c)

Document

d)

All the above

32.

BSON is a binary representation of ________ documents.

a)

JSON

b)

XML

c)

Script

d)

All the above

33.

____________ method renders the document in a JSON-like format.

a)

displayjson

b)

print

c)

printjson

d)

printdoc

34.

Which of the following method corresponds to Order by clause in SQL?

a)

sort()

b)

order()

c)

orderby()

d)

All the above

35.

The __________ method limits the number of documents in the result set.

a)

limit

b)

limitOf

c)

limitBy

d)

None of the Above

36.

Which of the following line skips the first 5 documents in the bios collection and returns all remaining documents?

a)

db.bios.find().limit( 5 )

b)

db.bios.find().skip( 1 )

c)

db.bios.find().skip( 5)

d)

db.bios.find().sort( 5 )

37.

Which of the following is not a NoSql database?

a)

Cassandra

b)

MongoDB

c)

MySql

d)

HBase

38.

What is the interactive shell for MongoDB called?

a)

Mongo

b)

dbmong

c)

mongosh

d)

mongodb

39.

What is the maximum size of a MongoDB document?

a)

2MB

b)

16MB

c)

12MB

d)

No limit.Depends on RAM

40.

mongo looks for a database server listening on port

a)

27017

b)

8080

c)

23

d)

443

41.

How many bits involve in _id?

a)

9

b)

10

c)

11

d)

12

42.

Which of the following is not part of _id?

a)

Timestamp

b)

machineID

c)

processID

d)

counter

e)

documentID

43.

What name is given to columns in MongoDB?

a)

Collections

b)

Fields

c)

Documents

d)

Database

44.

What name is given to Table in MongoDB?

a)

Collections

b)

Fields

c)

Documents

d)

Database

45.

db.dropDatabase() is the command to?

a)

Drop any one database randomly

b)

Error command had no DB name

c)

Drop database that is currently mounted

d)

No such command exist

46.

which of the following will display only students name and GPA?

a)

db.Students.find({},{"sName":1, "GPA":1})

b)

db.Students.find({},{"sName":1, "GPA":1, "_id":0})

c)

db.Students.find({},{"sName":1, "GPA":0})

d)

db.Students.find({"sName":1, "GPA":1, "_id":0})

47.

Which of the following will display details of sName "Sumit"?

a)

db.Students.find({sName: "Sumit"})

b)

db.Students.find({sName: "Sumit"},{"sName":1, "GPA":1, "_id":0})

c)

db.Students.find({sName: "Sumit"},{"sName":1, "GPA":0})

d)

db.Students.find({sName: Sumit})

48.

Which of the following will display the number of students having GPA greater than 3.7?

a)

db.Students.find({})

b)

db.Students.find({GPA:3.7})

c)

db.Students.find({GPA:{$gt:3.7}})

d)

db.Students.find({$gt:{GPA:3.7}})

49.

_id is a (a)   bytes hexadecimal number which assures the uniqueness of every document.

50.

The following key is used to denote uniqueness in the collection?

a)

id_

b)

_id

c)

id-

d)

id

51.

Please select the correct option

a)

Replica Set is related to high availability whereas Sharding is related to automatic vertical scaling

b)

Sharding is related to high availability whereas Replica Set is related to automatic horizontal scaling

c)

Replica Set is related to high availability whereas Sharding is related to automatic horizontal scaling

d)

I'm not a DBA, why do I need to know this?

52.

Horizontal Scaling...

a)

Involves dividing the system dataset and load over multiple servers, adding additional servers to increase capacity as required

b)

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

c)

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

d)

I don't know, but sharding is something cool for sure

53.

Please select the correct statement

a)

MongoDB distributes the read and write workload across the shards in the sharded cluster, allowing each shard to process a subset of cluster operations

b)

In production environments, individual shards should not be deployed as replica sets, because it might decrease the redundancy and availability

c)

MongoDB distributes the read and write workload across the members in the replica set, allowing each member to process a subset of cluster operations

d)

Are there really gems for the quiz winners?

54.

Please select the correct statement

a)

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

b)

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

c)

It is the final question, yaay!!

d)

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

55.

Name each operator in this image.

(don't hit enter!)

4 lines
56.

What is a Cluster?

4 lines
57.

Which of the following is not a part of Cassandra architecture?

a)

column

b)

memtable

c)

sstable

d)

cache

58.

caassandra was born at?

a)

facebook

b)

google

c)

yahoo

d)

none

59.

MongoDB supports query joins between collections.

a)

True

b)

false

60.

Point out the wrong statement :

a)

Non Relational databases require that schemas be defined before you can add data

b)

NoSQL databases are built to allow the insertion of data without a predefined schema

c)

NewSQL databases are built to allow the insertion of data without a predefined schema

d)

all

61.

the term nosql was introduced by______

a)

brewers

b)

doug cutting

c)

carlo strozzi

d)

none

62.

Which one of the following is equivalent in MongoDB select* from employee order by salary desc;?

a)

db.employee.find.sort({“salary”:1}]

b)

db.employee.sort ({“salary”:-1}]

c)

db.employee.find.sort ({“salary”:-1}

d)

db.employee.sort({“salary”:1}]

63.
Which Boolean operator will narrow your results
a)
AND
b)
OR
c)
NOT
d)
BUT
64.
Which Boolean operator will expand your results
a)
AND
b)
OR
c)
NOT
d)
BUT
65.
A football team keeps a database about its players. Which query would allow them to produce a query showing players who are strikers and who have scored 20 goals or more?
a)
Position = "Striker" OR Goals = 20
b)
Position = "Striker" AND Goals = 20
c)
Position = "Striker" or Goals >=20
d)
Position = "Striker" AND Goals >= 20
66.
8. Sorting from A-Z is also called a descending sort. 
a)
True 
b)
False 
67.
Wildcard that represents any collection of characters
a)
Asterisk
b)
Question Mark
c)
Query
d)
Equal Sign
68.
A teacher keeps pupil test results in a database.  Each pupil has sat multiple tests.  The teacher wants to run a query that shows each student and the average score they have achieved across the year.  What would be the correct query to use:
a)
Parameter Query
b)
GroupBy
c)
Wildcard
d)
Selection
69.
A bookshop owner is using the shop's database to help a customer.  The customer is looking for a particular author but cannot remember their full name.  The customer remembers that the surname of the author starts with the letters "Co".  What kind of query could the bookshop owner use to find this information?
a)
Parameter
b)
GroupBy
c)
Wildcard
d)
Selection
70.

mongo looks for a database server listening on port 27017 on the ________ interface.

a)

web

c)

web host

d)

all of the mentioned

71.

Point out the wrong statement.

a)

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

b)

MongoDB works hard to be very easy to install, configure, maintain, and use

c)

MongoDB does not provide a lot of the features of a traditional RDBMS

d)

None of the mentioned

72.

Point out the correct statement.

a)

A database is a set of key-value pairs

b)

A MongoDB deployment hosts a number of databases

c)

A document holds a set of collections

d)

All of the mentioned

73.

Point out the wrong statement.

a)

Documents have static schema in MongoDB

b)

Eventually-consistent reads can be distributed over replicated servers

c)

Indexes can include keys from embedded documents and arrays

d)

None of the mentioned

74.

Which of the following line skips the first 5 documents in the bios collection and returns all remaining documents?

a)

db.bios.find().limit( 5 )

b)

db.bios.find().skip( 1 )

c)

db.bios.find().skip( 5 )

d)

db.bios.find().sort( 5 )

75.

________ store the relationships between data by including links or references from one document to another.

a)

Capped

b)

Embedded

c)

External

d)

References

76.

In MongoDB, write operations are atomic at the __________ level.

a)

collection

b)

document

c)

row

d)

all of the mentioned

77.

______________ documents capture relationships between data by storing related data in a single document structure.

a)

Capped

b)

Embedded

c)

External

d)

Internal

78.

A ____________ data model with embedded data combines all related data for a represented entity in a single document.

a)

normalized

b)

denormalized

c)

non relational

d)

relational

79.

___________ strategy is used to explicitly avoid document growth.

a)

deallocation

b)

allocation

c)

pre-allocation

d)

none of the mentioned

80.

__________are used to retrieve data from the

database more quickly than otherwise

a)

Implicit

b)

Index

c)

Roll Back

d)

Auto Commit