DBMS Unit - 5

Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

SET - A

Subject Name : 21CS1401-Database Management Systems Marks : 25

Each Question Carry ONE Mark

UNIT 5- IMPLEMENTATION TECHNIQUES AND NON-RELATIONAL


MODEL
I. Multiple Choice Questions:
1. Which RAID level provides striping without redundancy?
a) RAID 0
b) RAID 1
c) RAID 5
d) RAID 6

Answer: A

2. What does RAID stand for?


a) Random Array of Independent Disks
b) Redundant Array of Independent Disks
c) Reliable Array of Integrated Disks
d) Redundant Array of Integrated Disks

Answer: B

3. Which file organization is best for sequential access?


a) Heap file organization
b) Sequential file organization
c) Hash file organization
d) Indexed file organization

Answer: B

4. Which type of indexing is built on the ordered data files?


a) Dense Index
b) Sparse Index
c) Clustered Index
d) Non-clustered Index

Answer: C

5. In a B+ tree, where are the actual data records stored?


a) Internal nodes
b) Leaf nodes
c) Root node
d) Parent nodes

Answer: B

II. Fill in the Blanks:


1. RAID stands for Array of Independent Disks.
Answer: Redundant
2. The leaf nodes in a B+ tree store .
Answer: actual data records
3. indexing uses a pointer for each search key.
Answer: Dense
4. In MongoDB, the method is used to insert a new document into a collection.
Answer: insert()
5.A file organization allows both sequential and direct access.
Answer: Indexed
III. True or False
1. RAID 1 offers redundancy through data striping.
Answer: False
2. In a B+ tree, all data is stored in internal nodes.
Answer: False
3. MongoDB is a relational database management system.
Answer: False
4. The find() method in MongoDB retrieves documents based on a query.
Answer: True
5. Sharding in MongoDB is a method of distributing data across multiple servers.
Answer: True
IV. Match the Following

1. S.No. Column A Column B


1 RAID 5 a)No redundancy, just data striping
2 Sequential File b)Data and parity distributed across
disks
3 Indexed File c)All records linked sequentially
4 RAID 0 d)Contains indexes for fast access
5 B+Tree e)Leaf nodes contain all data
records
a, 1 - C, 2 - D, 3 - A, 4 – B 5-E

b, 1 - B, 2 - E, 3 - A, 4 – D 5-C

c, 1 - B, 2 - C, 3 - D, 4 – A 5 - E
d, 1 - D, 2 - C, 3 - B, 2 – A 5-E

2.
S.No. Column A Column B
1 Dense Index a)Index entries for every search key

2 Sparse Index b) Only some search keys have index entries

3 Primary Index c) Index on the primary key


4 Secondary Index d) Index on non-primary key columns

5 Clustered Index e) Data records stored in the same order as


the index entries

a, 1 - C, 2 - D, 3 - A, 4 – B 5-E

b, 1 - A, 2 - B, 3 - C, 4 – D 5-E
c, 1 - B, 2 - C, 3 - D, 4 – A 5 - E

d, 1 - D, 2 - C, 3 - B, 2 – A 5-E
3.
S.No. Column A Column B
1 Hash Function b) Two keys hash to the same index

2 Collision d) Uses linked lists to handle collisions

3 Open Addressing a) Converts input into a fixed-size string of


bytes
4 Separate Chaining e) Ratio of the number of elements to the
number of buckets
5 Load Factor c) Resolves collisions by finding another
open slot

a, 1 - B, 2 - C, 3 - D, 4 – A 5 - E

b, 1 - C, 2 - D, 3 - A, 4 – B 5-E

c, 1 - B, 2 - C, 3 - D, 4 – A 5 - E

d, 1 - A, 2 - B, 3 -C, 4 – D 5-E
4.
S.No. Column A Column B
1 B-Tree a) The node at the lowest level containing
actual data
2 B+Tree b) The node that contains pointers to other
nodes
3 Leaf Node c) The maximum number of children for a
node
4 Internal Node d) Internal nodes and leaf nodes both store
keys and data
5 Order of the Tree e) Leaf nodes contain data pointers, internal
nodes store keys only

a, 1 - C, 2 - D, 3 - A, 4 – B 5-E

b, 1 -D, 2 - E, 3 - A, 4 – B 5-C
c, 1 - B, 2 - C, 3 - D, 4 – A 5 - E

d, 1 - D, 2 - C, 3 - B, 2 – A 5-E

5.
S.No. Column A Column B
1 RAID 0 a) Striped without parity, no fault tolerance

2 RAID 1 b) Mirrored drives for redundancy

3 RAID 5 c) Striped with parity, allows for fault


tolerance
4 Sequential File d) Records are stored sequentially by a key
Organization field
5 Indexed File e) An index is created for each record,
Organization allowing fast search

V. Short Answers:

1. What is RAID and why is it used?


RAID is a data storage technology that combines multiple physical disk drives into one or
more logical units to ensure data redundancy and improve performance.
2. Describe the difference between a B-tree and a B+ tree.
In a B-tree, data pointers are stored in both internal and leaf nodes, making searches
slightly slower. In a B+ tree, all data records are stored in leaf nodes only, which makes it
more efficient for range queries and sequential access.
3. Explain the concept of sharding in MongoDB.
Sharding in MongoDB involves partitioning data across multiple machines to facilitate
horizontal scaling, enabling the database to manage larger datasets efficiently.
4. What are the advantages of using NoSQL databases?
NoSQL databases offer advantages like scalability, flexibility, and performance
optimization for large-scale data environments..
5. How does indexing improve database performance?
Indexing improves database performance by enabling faster data retrieval without scanning
the entire table, significantly reducing query processing time.
SET - B

Subject Name : 21CS1401-Database Management Systems Marks : 25

Each Question Carry ONE Mark


I. Multiple Choice Questions:

1. What is a primary advantage of a B-Tree over a binary search tree?


a)Faster search time
b) Better use of disk space
c) Improved sequential access
d) Simplified implementation

Answer: C

2. NoSQL databases are designed to handle:


a)Structured data
b) Unstructured data
c) Semi-structured data
d) All of the above

Answer: D

3. MongoDB is an example of which type of NoSQL database?


a)Key-Value store
b) Document store
c) Column-family store
d) Graph store

Answer: B

4. Which MongoDB operation is used to retrieve documents from a collection?


a)insert()
b) update()
c) find()
d) remove()

Answer: C

5. In MongoDB, what is the equivalent of a table in a relational database?


a)Collection
b) Document
c) Field
d) Index

Answer: A
II.Fill in the Blanks:
1. is the process of distributing data across multiple machines in MongoDB.

Answer: Sharding

2.In a B-tree, each node can have at most children if the order is 4.

Answer: 4

3.NoSQL databases are often classified as document, key-value, column-family, and


databases.

Answer: Graph

4. The command to delete a collection in MongoDB is .

Answer: drop()

5.Cassandra's data model is based on the concept of a family.

Answer: column

III.True or False:
1. A primary index can be created on non-primary attributes.
Answer: False
2. The default port for MongoDB is 27017.
Answer: True
3. NoSQL databases can handle unstructured data.
Answer: True
4. In a hash file organization, records are stored in a sequential manner.
Answer: False
5. B-trees are always balanced.
Answer: True

IV Match the following

1.
S.No. Column A Column B
1 Sequential File a) Records are placed in any available
Organization space; no ordering
2 Heap File Organization b) An index is created to speed up the
retrieval of records
3 Indexed File c) A hash function computes the address
Organization for each record
4 Clustered File d) Records with similar key values are
Organization stored together
5 Hash File Organization e) Records are stored and accessed in a
sequence based on a key field

a, 1 - E, 2 - A, 3 - B, 4 – D 5-C
b, 1 -D, 2 - E, 3 - A, 4 – B 5-C

c, 1 - B, 2 - C, 3 - D, 4 – A 5 - E

d, 1 - D, 2 - C, 3 - B, 2 – A 5-E

2.
S.No. Column A Column B
1 Document a) Collection of documents

2 Collection b) Stores data as JSON-like BSON format

3 find() c) Retrieves documents from a collection


4 MongoDB Atlas d) Managed cloud database service

5 Replica Set e) Group of MongoDB servers for redundancy

a, 1 - E, 2 - A, 3 - B, 4 – D 5-C

b, 1 -D, 2 - E, 3 - A, 4 – B 5-C

c, 1 - B, 2 - A, 3 - C, 4 – D 5 - E
d, 1 - D, 2 - C, 3 - B, 2 – A 5-E

3.
S.No. Column A Column B
1 Create a) Retrieve data from the database

2 Read b) Add new data to the database

3 Update c) Modify existing data in the database


4 Delete
d) Remove data from the database
5 insertOne() e) MongoDB method to add a single document
a, 1 - B, 2 - A, 3 - C, 4 – D 5-E

b, 1 -D, 2 - E, 3 - A, 4 – B 5-C

c, 1 - A 2 - D, 3 - C, 4 – E 5 - B

d, 1 - D, 2 - C, 3 - B, 4 – A 5-E

4.
S.No. Column A Column B
1 Leaf Nodes a) Efficient due to sequential linked leaf nodes

2 Internal Nodes b) Only contain index values, not actual data

3 Order of B+tree
c) Contains pointers to data records or actual
data
4 Range Queries d) Maximum number of children per node

5 Non-leaf Nodes e) Contains pointers to child nodes and key


values

a, 1 - B, 2 - A, 3 - C, 4 – D 5-E

b, 1 -D, 2 - E, 3 - A, 4 – B 5-C

c, 1 - A 2 - D, 3 - C, 4 – E 5 - B

d, 1 - C, 2 - E, 3 - D, 4– A 5-B

5.
S.No. Column A Column B
1 Bitmap Index a) Indexing technique where every unique
value has a bitmap
2 Full-Text Index
b) Data records are physically stored in the
same order as the index
3 Unique Index
c) Index based on multiple columns
4 Composite Index d) Ensures all values in the indexed column are
unique
5 Clustered Index
e) Optimized for search and retrieval of text
within a column
a, 1 - B, 2 - A, 3 - C, 4 – D 5-E

b, 1 -A, 2 - E, 3 - D, 4 – C 5-B
c, 1 - A 2 - D, 3 - C, 4 – E 5 - B

d, 1 - C, 2 - E, 3 - D, 4– A 5-B

V.Short Answers:

6. What is the primary purpose of the CRUD operations in databases?


CRUD operations (Create, Read, Update, Delete) are essential for interacting with
databases, allowing users to manage data effectively.
7. Describe the role of leaf nodes in a B+ tree.
In a B+ tree, leaf nodes store the actual data records or pointers to the data records, making
them crucial for data retrieval. These nodes are linked sequentially, facilitating efficient
range queries and ordered traversals.
8. What is a primary index and how is it different from a secondary index?
A primary index is an index on a set of columns that includes the primary key, ensuring
unique and sorted entries.
9. Explain the difference between a dense index and a sparse index.
A dense index has an index entry for every search key value, providing faster search times
but requiring more storage space.
10. What is the purpose of the ISODate type in MongoDB?
The ISODate type in MongoDB stores date and time in ISO 8601 format, ensuring
consistency in date-time data representation.
SET - C
Subject Name: 21CS1401-Database Management Systems Marks : 25

Each Question Carry ONE Mark


I.Multiple Choice Questions:
1. What does CRUD stand for?
a)Create, Read, Update, Delete
b) Create, Replace, Update, Delete
c) Create, Read, Upload, Delete
d) Create, Replace, Upload, Delete
Answer: A

2. What data type does MongoDB use to store dates?


a) DateTime
b) Date
c) Timestamp
d) ISODate

Answer: D

3. Which of the following is not a type of NoSQL database?


a) Document-based
b) Graph-based
c) Relational
d) Key-value

Answer: C

4. In Cassandra, what is a column family equivalent to in a relational database?


a) Table
b) Row
c) Column
d) Schema

Answer: A

5. What is the main advantage of using a NoSQL database over a traditional RDBMS?
a) Better consistency
b) Better scalability
c) More features
d) Easier management

Answer: B
II. Fill in the Blanks:

1. The default storage engine for MongoDB is .


Answer: WiredTiger
2. In a hash file organization, the location of a record is determined by a
function.
Answer: hash
3. B-trees maintain sorted order of records.
Answer: lexicographical
4. The command in MongoDB updates an existing document.
Answer: update()
5. is used to ensure data availability in MongoDB through data replication.
Answer: Replication

III. True or False:

1.MongoDB supports ACID transactions natively.


Answer: False
2.Cassandra uses a column-family data model.
Answer: True
3.CRUD operations include Create, Read, Update, and Delete.
Answer: True
4.In RAID 0, data is mirrored across disks.
Answer: False
5.The replication feature in MongoDB ensures data availability.
Answer: True

VI. Match the following:

1.
S.No. Column A Column B
1 Indexing a) Ensures high availability of data
2 Sharding b) Stores data as BSON format
3 BSON c) MongoDB method for data retrieval
4 Replica Set d) Horizontal scaling technique in MongoDB

5 CRUD Operations e) Optimizes query performance

a, 1 - B, 2 - A, 3 - C, 4 – D 5-E

b, 1 -E, 2 -D, 3 - B, 4 – A 5-C


c, 1 - A 2 - D, 3 - C, 4 – E 5 - B
d, 1 - C, 2 - E, 3 - D, 4– A 5-B
2.

S.No. Column A Column B


1 Node Splitting a) Ensures all leaf nodes are at the same level
2 Leaf Node b) Process of dividing a node when it exceeds
the maximum number of children
3 Degree of B-Tree c) Contains the actual data records

4 Internal Node d) Minimum number of children a node must


have
5 Balanced Tree e) Contains pointers to child nodes and keys

a, 1 -A, 2 - B, 3 - C, 4 – D 5-E

b, 1 -E, 2 -D, 3 - B, 4 – A 5-C

c, 1 - A 2 - D, 3 - C, 4 – E 5 - B

d, 1 - B, 2 - C, 3 - D, 4– E 5-A

3.
S.No. Column A Column B
1 RAID 0 a) Combines striping and mirroring for redundancy and
performance
2 RAID 1 b) Provides data redundancy using parity

3 RAID 5 c) Data is striped across disks without redundancy

4 RAID 6 d) Data is mirrored across two disks

5 RAID 10 e) Provides double parity for increased fault tolerance

a, 1 -C, 2 - D, 3 - B, 4 –E 5-A

b, 1 -E, 2 -D, 3 - B, 4 – A 5-C

c, 1 - A 2 - D, 3 - C, 4 – E 5 - B

d, 1 - B, 2 - C, 3 - D, 4– E 5-A
4.

S.No. Column A Column B


1 Embedded a) References to other documents by ID
Documents
2 References b) Data is stored in arrays within a document

3 JSON c) Stores related data within the same document

4 BSON d) Binary representation of JSON data

5 Array e) Text-based format for representing structured data

a, 1 -C, 2 - D, 3 - B, 4 –E 5-A

b, 1 -C, 2 -A, 3 - E, 4 – D 5-B


c, 1 - A 2 - D, 3 - C, 4 – E 5 - B

d, 1 - B, 2 - C, 3 - D, 4– E 5-A

5.
S.No. Column A Column B
1 Schema-less a) Used for distributed data storage
2 Sharding b) No fixed schema, flexible data models

3 Consistency c) Ensures that all replicas have the same data

4 Partition Tolerance d) Allows for horizontal scaling by splitting data


across servers
5 CAP Theorem
e) Describes trade-offs between consistency,
availability, and partition tolerance
a, 1 -C, 2 - D, 3 - B, 4 –E 5-A

b, 1 -C, 2 -A, 3 - E, 4 – D 5-B

c, 1 - A 2 - D, 3 - C, 4 – E 5 - B

d, 1 - B, 2 - D, 3 - C, 4– A 5-E
V. Short Answers:
1. What is the need for RAID?
An array of multiple disks accessed in parallel will give greater throughput than a single disk.
2. What are ordered indices?
This is type of indexing which is based on sorted ordering values. Various ordered indices are
primary indexing, secondary indexing.
3. What are the two types of ordered indices?
Two types of ordered indices are - Primary indexing and secondary indexing.
4. What are the causes of bucket overflow in a hash file organization?

Bucket overflow can occur for following reasons -Insufficient buckets and Skew:
5. List the mechanisms to avoid collision during hashing.
Collision Resolution techniques are: (1) Separate chaining Open addressing techniques
SET - D
Subject Name: 21CS1401-Database Management Systems Marks : 25

Each Question Carry ONE Mark


I.Multiple Choice Questions:
1. Which command is used to delete a document in MongoDB?
a) delete()
b) remove()
c) drop()
d) erase()

Answer:B

2. Which component of MongoDB provides horizontal scaling?


a) Sharding
b) Replication
c) Indexing
d) Aggregation
Answer:A

3. What is the default port for MongoDB?


a) 3306
b) 27017
c) 5432
d) 8080
Answer:B

4. In a B-tree, what is the minimum number of children a non-root node must have if the order
of the tree is 5?
a) 1
b) 2
c) 3
d) 4
Answer:B

5. What is the primary purpose of using indexing in databases?


a) Data redundancy
b) Data integrity
c) Speed up query processing
d) Backup data
Answer:C

II. Fill in the Blanks:


1. A index includes all the information of a primary index, but for non-primary
attributes.
Answer: Secondary
2. The method in MongoDB retrieves documents from a collection.
Answer: find()
3. In RAID 1, data is across multiple disks for redundancy.
Answer: mirrored
4. A NoSQL database provides a mechanism for retrieval and storage of data.
.
Answer: efficient
5. databases are particularly useful for large-scale data environments.
Answer: NoSQL

III. True or False


1. A clustered index stores data in the same order as the index.
Answer: True
2. The ISODate format in MongoDB stores date as a string.
Answer: False
3. CAP theorem states that a distributed system can achieve all three: consistency, availability,
and partition tolerance simultaneously.
Answer: False
4. Sparse indexes include a pointer for every search key in a file.
Answer: False
5. The B-tree structure ensures efficient sequential access of data.
Answer: True

IV. Match the following

1.
S.No. Column A Column B
1 Hash Function a) Resolves collisions by finding another open slot
2 Collision b) Maps keys to positions in a hash table

3 Open Addressing c) Linked lists used to handle collisions

4 Separate Chaining d) Ratio of number of elements to number of buckets

5 Load Factor e) When two keys hash to the same index

a, 1 -B, 2 -E, 3 - A, 4 –C 5-D

b, 1 -C, 2 -A, 3 - E, 4 – D 5-B

c, 1 - A 2 - D, 3 - C, 4 – E 5 - B

d, 1 - B, 2 - D, 3 - C, 4– A 5-E
2.

S.No. Column A Column B


1 RAID 5 a)No redundancy, just data striping
2 Sequential File b)Data and parity distributed across
disks
3 Indexed File c)All records linked sequentially
4 RAID 0 d)Contains indexes for fast access
5 B+Tree e)Leaf nodes contain all data
records
a, 1 - C, 2 - D, 3 - A, 4 – B
5-E

b, 1 - B, 2 - E, 3 - A, 4 – D 5-C

c, 1 - B, 2 - C, 3 - D, 4 – A 5 - E
d, 1 - D, 2 - C, 3 - B, 2 – A 5-E

2.
S.No. Column A Column B
1 Dense Index a)Index entries for every search key

2 Sparse Index b) Only some search keys have index entries

3 Primary Index c) Index on the primary key


4 Secondary Index d) Index on non-primary key columns

5 Clustered Index e) Data records stored in the same order as


the index entries

a, 1 - C, 2 - D, 3 - A, 4 – B 5-E

b, 1 - A, 2 - B, 3 - C, 4 – D 5-E
c, 1 - B, 2 - C, 3 - D, 4 – A 5 - E

d, 1 - D, 2 - C, 3 - B, 2 – A 5-E
3.

S.No. Column A Column B


1 Create a) Retrieve data from the database

2 Read b) Add new data to the database

3 Update c) Modify existing data in the database


4 Delete
d) Remove data from the database
5 insertOne() e) MongoDB method to add a single document

a, 1 - B, 2 - A, 3 - C, 4 – D 5-E

b, 1 -D, 2 - E, 3 - A, 4 – B 5-C

c, 1 - A 2 - D, 3 - C, 4 – E 5 - B
d, 1 - D, 2 - C, 3 - B, 4 – A 5-E

5.
S.No. Column A Column B
1 Bitmap Index a) Indexing technique where every unique
value has a bitmap
2 Full-Text Index
b) Data records are physically stored in the
same order as the index
3 Unique Index
c) Index based on multiple columns
4 Composite Index d) Ensures all values in the indexed column are
unique
5 Clustered Index
e) Optimized for search and retrieval of text
within a column

a, 1 - B, 2 - A, 3 - C, 4 – D 5-E

b, 1 -A, 2 - E, 3 - D, 4 – C 5-B
c, 1 - A 2 - D, 3 - C, 4 – E 5 - B

d, 1 - C, 2 - E, 3 - D, 4– A 5-B

V. Short Answers
1. What is a NoSQL database?

A NoSQL (Not Only SQL) database offers a method for storing and accessing data, diverging from
the tabular structures employed in relational databases.
2. What is sharding work in a database?

Sharding is a technique used in distributed databases to horizontally partition data across multiple
servers or nodes

3. What are ordered indices?


This is type of indexing which is based on sorted ordering values. Various ordered indices are
primary indexing, secondary indexing.

4. What is a primary index and how is it different from a secondary index?

A primary index is an index on a set of columns that includes the primary key, ensuring unique and
sorted entries.

5. What is RAID and why is it used?

RAID is a data storage technology that combines multiple physical disk drives into one or more
logical units to ensure data redundancy and improve performance.

You might also like