0% found this document useful (0 votes)
21 views5 pages

NOSQL-OBJECTIVE QUESTION BANK -MID-1

The document provides a quiz on NoSQL databases, specifically focusing on MongoDB, covering various topics such as types of databases, operations, and commands. It includes multiple-choice questions with correct answers and explanations for each. Key concepts include the nature of NoSQL databases, CRUD operations, and MongoDB's flexible schema approach.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views5 pages

NOSQL-OBJECTIVE QUESTION BANK -MID-1

The document provides a quiz on NoSQL databases, specifically focusing on MongoDB, covering various topics such as types of databases, operations, and commands. It includes multiple-choice questions with correct answers and explanations for each. Key concepts include the nature of NoSQL databases, CRUD operations, and MongoDB's flexible schema approach.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

NOSQL

UNIT-1
BITBANK

1. Which of the following is not a NoSQL database?


a) SQL Server b) MongoDB c) Cassandra d) None of the mentioned
Answer: a
Explanation: Microsoft SQL Server is a relational database management system developed by
Microsoft.

2.Point out the correct statement.


a) Documents can contain many different key-value pairs, or key-array pairs, or even nested
documents
b) MongoDB has official drivers for a variety of popular programming languages and development
environments
c) When compared to relational databases, NoSQL databases are more scalable and provide superior
performance
d) All of the mentioned
Answer: d
Explanation: There are also a large number of unofficial or community-supported drivers for other
programming languages and frameworks.

3. Which of the following is a NoSQL Database Type?


a) SQL b) Document databases c) JSON d) All of the mentioned
Answer: b
Explanation: Document databases pair each key with a complex data structure known as a
document.

4. Which of the following is a wide-column store?


a) Cassandra b) Riak c) MongoDB d) Redis
Answer: a
Explanation: Wide-column stores such as Cassandra and HBase are optimized for queries over large
datasets, and store columns of data together, instead of rows.

5.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 of the mentioned
Answer: a
Explanation: There’s also no way, using a relational database, to effectively address data that’s
completely unstructured or unknown in advance.

6. “Sharding” a database across many server instances can be achieved with _______________
a) LAN b) SAN c) MAN d) All of the mentioned
Answer: b
Explanation: “Sharding” a database across many server instances can be achieved with SQL
databases, but usually is accomplished through SANs and other complex arrangements for making
hardware act as a single server.

7. HBase is a distributed ________ database built on top of the Hadoop file system.
a) Column-oriented b) Row-oriented

c) Tuple-oriented d) None of the mentioned


Answer: a
Explanation: HBase is a data model that is similar to Google’s big table designed to provide quick
random access to huge amounts of structured data

Answer: d
Explanation: Graph stores include Neo4J and HyperGraphDB

8. NoSQL databases is used mainly for handling large volumes of ______________ data.
a) unstructured b) structured c) semi-structured d) all of the mentioned
Answer: a
Explanation: MongoDB is an a typical choice for unstructured data storage

9.Which of the following are the simplest NoSQL databases?


a) Key-value b) Wide-column c) Document d) All of the mentioned
Answer: a
Explanation: Every single item in the database is stored as an attribute name (or “key”), together
with its value in Key-value stores.

10. ________ stores are used to store information about networks, such as social connections.
a) Key-value b) Wide-column c) Document d) Graph
Answer: d
Explanation: Graph stores include Neo4J and HyperGraphDB

11. NoSQL databases is used mainly for handling large volumes of ______________ data.
a) unstructured b) structured c) semi-structured d) all of the mentioned
Answer: a
Explanation: MongoDB is an a typical choice for unstructured data storage.

12. A query may include a ___________ that specifies the fields from the matching documents to
return.
a) selection b) projection c) union d) none of the mentioned
Answer: b
Explanation: Queries specify criteria, or conditions, that identify the documents that MongoDB
returns to the clients.

13. MongoDB stores all documents in _____________


a) tables b) collections c) rows d) all of the mentioned
Answer: b
Explanation: Collections are analogous to a table in relational databases.

14. In MongoDB _________ operations modify the data of a single collection.


a) CRUD b) GRID c) READ d) All of the mentioned
Answer: a
Explanation: Data modification refers to operations that create, update, or delete data.

15. Which of the following operation adds a new document to the users collection?
a) add b) insert c) truncate d) drop
Answer: b
Explanation: For the update and delete operations, you can specify the criteria to select the
documents to update or remove.

16. MongoDB process collection of documents using _________ operations.


a) Hbase b) Hive c) Map-reduce d) None of the mentioned
Answer: c
Explanation: In addition to the basic queries, MongoDB provides several data aggregation features

17. What type of database is MongoDB?

a)Relational b)Document-Oriented c)Graph d)Key-Value

Answer: b
Explanation: MongoDB is a document-oriented database, which means it stores data in JSON-like
documents with dynamic schemas

18. In MongoDB, what does the term 'collection' refer to?

a)A group of databases b)A single document c)A group of documents d)A type of index

Answer: c

Explanation: In MongoDB, a collection is analogous to a table in relational databases and refers to a


group of documents

19. What is the outcome of the command db.createCollection("myCollection") in MongoDB?

a)Creates a new document b)Deletes a collection

c)Creates a new collection d)Updates a collection

Answer: c

Explanation:The createCollection method in MongoDB is used to create a new collection named


"myCollection" in the database.

20. Which operating system is NOT supported by MongoDB?

a)Windows b)Linux c)macOS d)iOS

Answer: d

Explanation: MongoDB supports major operating systems like Windows, Linux, and macOS, but it
does not have support for iOS

21. What is the default port for MongoDB server?

a) 27015 b) 28017 c) 27017 d) 8080

Answer: c

Explanation: By default, MongoDB server listens on port 27017.

22. Which of the following is required to install MongoDB?

a) Java Runtime Environment b)Python c)Node.js d)None of these

Answer: d

Explanation: MongoDB does not require Java, Python, or Node.js for its installation.

23. In MongoDB, what is the role of the mongod process?

a) Manages the database b) Runs the shell interface

c) Manages client connections d)Handles replication

Answer: a

Explanation: The mongod process is the main daemon process for the MongoDB system and is
responsible for managing the database.

24. What is the primary function of the mongo shell?

a) Data backup b)Database management and querying

c) User authentication d)Server monitoring

Answer: b

Explanation: The mongo shell is an interactive JavaScript interface to MongoDB, used for database
management and querying.
25. What does 'CRUD' stand for in MongoDB?

a) Create, Read, Update, Delete b) Create, Retrieve, Upload, Delete

c) Connect, Read, Unload, Display d) Create, Read, Utilize, Deploy

Answer: a

Explanation: CRUD operations in MongoDB and other databases refer to the basic operations:
Create, Read, Update, and Delete.

26. Which method is used to insert a single document into a MongoDB collection?

a) db.collection.insertOne() b) db.collection.insert()

c) db.collection.addOne() d) db.collection.create()

Answer: a

Explanation: To insert a single document into a collection, the db.collection.insertOne() method is


used in MongoDB.

27. What does the find() method in MongoDB return?

a) A single document b)An array of documents c) A cursor d)A JSON object

Answer: c

Explanation: The find() method in MongoDB returns a cursor to the documents that match the query
criteria.

28. How does MongoDB treat fields that are not specified in the $set part of an update operation?

a) They are deleted b)They remain unchanged

c) They are set to null d)They are marked as undefined

Answer: b

Explanation: In MongoDB, fields not specified in the $set part of an update operation remain
unchanged.

29. What is the purpose of the $unset operator in an update operation in MongoDB?

a) To delete a field from a document b)To set a field to null

c) To hide a field in the output d)To create a new field

Answer: a

Explanation: The $unset operator is used to delete a field from a document in MongoDB.

30. What does the upsert option do in an update operation in MongoDB?

a) Updates an existing document, otherwise does nothing

b) Updates all matching documents

c) Inserts a new document if no match is found

d) Deletes the document if it exists

Answer: c

Explanation: The upsert option in an update operation will insert a new document if no existing
document matches the query criteria.

31. What does this command do?


db.products.find({price: {$gt: 100}})
a) Finds products with a price equal to 100 b) Finds products with a price less than 100

c) Finds products with a price greater than 100 d)Updates the price of products over 100

Answer: c

Explanation: This query finds all documents in the 'products' collection where the 'price' field is
greater than 100.

32. Which MongoDB command is used to add a new field to an existing document?

a) db.collection.update({}, {$set: {newField: value}}) b) db.collection.add({}, {newField: value})

c) db.collection.newField({newField: value}) d) db.collection.addField({newField: value})

Answer: a

Explanation: To add a new field to an existing document, the $set operator is used in an update
command.

33. What's wrong with this update command?


db.users.update({name: "John"}, {age: 30})

a) It replaces the entire document b)It's missing the $set operator

c) It updates all users named John d)There's no issue

Answer: a

Explanation: Without the $set operator, this command replaces the entire document instead of
updating the 'age' field.

34. Spot the error in this command:


db.collection.deleteOne({ _id: 123 })

a) Incorrect method name b)Incorrect field value

c)Missing quotation marks around the _id value d)No error

Answer: c

Explanation: The _id value is typically a string or ObjectId, so it should be in quotation marks or use
ObjectId().

35. Which of the following best describes MongoDB's approach to schemas?

a) Rigid and predefined b)Flexible and dynamic

c) Fixed and unchangeable d)None, as MongoDB does not use schemas

Answer: b

Explanation: MongoDB's schema approach is flexible and dynamic, allowing varying document
structures within the same collection.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy