0% found this document useful (0 votes)
20 views33 pages

CLG Question Bank

Uploaded by

hxrihxri2103
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views33 pages

CLG Question Bank

Uploaded by

hxrihxri2103
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

8115 - K.

RAMAKRISHNAN COLLEGE OF ENGINEERING


(AUTONOMOUS)
Department of Artificial Intelligence and Data Science
UAD1403- DATABASE DESIGN AND MANAGEMENT
QUESTION BANK FOR 5 UNITS (2 MARK QNS WITH ANS + 16 MARK QNS)

UNIT – 1 AND 2 QUESTION BANK

Q.N
Questions KL CO
o
UNIT -1
UNIT – 1

INTRODUCTION
Purpose of Database System – Views of data – data models, database
management system, three-schema architecture of DBMS, components of
DBMS. E/R Model - Conceptual data modeling - motivation, entities,
entity types, attributes, relationships, relationship types, E/R diagram
notation, examples.

1. 1What is database? K1 CO1


Contains collection of related tables, tables contains collection of related
records or tuples.

2. 2Analyze the disadvantages in File Processing System. K4 CO1

3. K1 CO1
List the different types of data models.
4. 4List any four applications of DBMS. K1 CO1
Listing (1 mark) + Description (1 Mark)

5. 5Define the terms Entity Set and Relationship Set. K1 CO1


In a relational model, an entity is represented as a row, tuple or a
record. For example, consider a group of students is there, each student
in the group is a separate entity.

1. Entity Set:

An entity set represents a collection of similar entities. An entity can be


any object, concept, or thing about which data can be stored in a
database. For example, in a university database, the entity set "Student"
might represent all individual students enrolled at the university. Each
entity in the entity set has attributes that describe its properties.
Attributes of the "Student" entity might include student ID, name,
address, etc.
2. Relationship Set:

A relationship set represents the association or connection between two


or more entity sets. It describes how entities from different entity sets are
related to each other. For example, in a university database, a
relationship set "Enrollment" might represent the relationship between
students and courses. This relationship set would indicate which students
are enrolled in which courses. A relationship set can have attributes of its
own, which describe properties specific to the relationship itself, such as
the grade earned by a student in a course.

6. 6 Define Database Management Systems. K1 CO1


Database Management System (DBMS) is a software for storing and
retrieving users' data while considering appropriate security measures.

Its used for


1. Data Management: A DBMS provides mechanisms for
organizing and structuring data in a way that facilitates efficient
storage, retrieval, and manipulation. It handles tasks such as
creating, updating, deleting, and querying data.

2. Storage Management: DBMS manages the physical storage of


data on disk or other storage devices. It optimizes storage
allocation and data structures to maximize performance and
minimize disk space usage.

3. Access Control and Security: DBMS ensures that only


authorized users have access to the database and its contents. It
enforces security measures such as user authentication,
authorization, encryption, and access control policies to protect
sensitive data from unauthorized access or modification.
4. Concurrency Control: In multi-user environments where
multiple users or applications access the database
simultaneously, DBMS ensures that transactions are executed in
a controlled manner to maintain data consistency and integrity. It
employs techniques such as locking, timestamping, and
transaction isolation to manage concurrency and prevent data
anomalies.

5. Data Integrity and Consistency: DBMS enforces data integrity


constraints to ensure that data remains accurate, valid, and
consistent over time. It supports mechanisms such as primary key
constraints, foreign key constraints, and domain constraints to
maintain data quality and prevent inconsistencies.

6. Backup and Recovery: DBMS provides mechanisms for


backing up data and recovering it in case of system failures,
errors, or disasters. It supports features like database backups,
transaction logging, point-in-time recovery, and recovery
management to minimize data loss and ensure data durability.
7. Query Language and Optimization: DBMS supports a query
language (e.g., SQL) that allows users to retrieve and manipulate
data using declarative commands. It also includes query
optimization techniques to analyze and optimize query execution
plans for efficient data retrieval.

7. 7 Why we are moving into DBMS from File System. K1 CO1


DBMS File Processing System
It’s a system software for creating It's a software that manages
and managing databases that data files in a computer
provides a systematic way to system.
create, retrieve, update and
manage data.
Data redundancy is lower Data redundancy is higher
Can achieve ACID property Can’t achieve ACID property
8. 8 Differentiate hierarchical data model from network data models. K2 CO1
9. 9 List the Different types of query processing languages K1 CO1

DML – Data Manipulation Language


DDL – Data Definition Language
DCL – Data Control Language
TCL – Transaction Control Language
10. 1 Define the attributes with its types K1 CO1
0

UNIT -2
UNIT – 2

RELATIONAL MODEL

Relational Data Model - Concept of relations, schema-instance


distinction, keys, referential integrity and foreign keys, relational algebra
operators, SQL - Introduction, data definition in SQL, table, key and
foreign key definitions, update behaviors. Querying in SQL, notion of
aggregation, aggregation functions group by and having clauses,
embedded SQL
1. 7Define SQL K1 CO2

SQL is a database computer language designed for the retrieval and


management of data in a relational database. SQL stands for
Structured Query Language.

2. Define embedded SQL. K1 CO2


Embedded SQL is a powerful method that allows the integration of
high−level programming languages with database management systems
(DBMS).

It acts as a bridge between applications and databases which helps in data


manipulation and communication.
Various database management systems offer embedded SQL, giving
developers the freedom to select the one that best serves their
requirements.

3. 9Differentiate DDL from DML K2 CO2

4. 1List any four aggregate functions of SQL with its description K1 CO2
0

5. K1 CO2
Define Relational algebra.
6. List the DDL commands with syntax for each. K1 CO2

7. List the different types of keys K1 CO2

1. Primary Key (PK):


• A primary key is a unique identifier for each tuple within
a relation.
• It ensures that each row in the table is uniquely identifiable.
• Primary keys cannot contain null values.
• Each table can have only one primary key.
• Examples include employee ID, student ID, or order
number.
2. Candidate Key:
• A candidate key is a set of attributes that uniquely
identifies tuples within a relation, similar to a primary key.
• Unlike a primary key, a relation can have multiple
candidate keys.
• The primary key is chosen from among the candidate keys.
• Candidate keys can include one or more attributes.
• For example, in a table of employees, both employee ID
and email address might be candidate keys.
3. Alternate Key:
• An alternate key is a candidate key that is not selected as
the primary key.
• Once a candidate key is chosen as the primary key, the
remaining candidate keys become alternate keys.
• Alternate keys are still unique identifiers for tuples but are
not designated as the primary means of identifying records.
• For example, in a table of employees where employee ID
is the primary key, email address becomes an alternate key.
4. Foreign Key (FK):
• A foreign key is an attribute or set of attributes in one
relation that matches the primary key in another relation.
• It establishes a relationship between two tables, enforcing
referential integrity.
• The values in the foreign key must match the values of the
primary key in the referenced relation or be null.
• Foreign keys are used to maintain consistency and integrity
across related tables.
• For example, in a table of orders, the customer ID might be
a foreign key referencing the primary key of the customers
table.
5. Super Key:
• A super key is a set of attributes that uniquely identifies
tuples within a relation.
• It may contain more attributes than necessary to uniquely
identify tuples.
• Super keys include candidate keys and any additional
attributes.
• For example, in a table of employees where employee ID
and email address are candidate keys, the combination of
employee ID, email address, and department might be a
super key.

8. Differentiate primary key from foreign key K2 CO2

Primary key Foreign key

Gives unique identity for the attribute in one relation that


records in a table matches the primary key in
another relation.

Can’t accept NULL values Can accept NULL values

As default primary key is Do not automatically create


clustered index, data in the DB index, clustered or non-
table is physically organized in clustered. We should create
the sequence of clustered index manually.
index.

Only one primary key in a More than one foreign key in a


table. table.

9. List any four aggregate functions of SQL with its description K1 CO2
Count():
• Count(*): Returns the total number of records .i.e 6.
• Count(salary): Return the number of Non-Null values over the
column salary. i.e 5.
• Count(Distinct Salary): Return the number of distinct Non-
Null values over the column salary .i.e 5.
Sum():
• sum(salary): Sum all Non-Null values of Column salary i.e.,
310
• sum(Distinct salary): Sum of all distinct Non-Null values i.e.,
250.
Avg():
• Avg(salary) = Sum(salary) / count(salary) = 310/5
• Avg(Distinct salary) = sum(Distinct salary) / Count(Distinct
Salary) = 250/4
Min():
• Min(salary): Minimum value in the salary column except
NULL i.e., 40.
Max():
• Max(salary): Maximum value in the salary i.e., 80.

10. List any four operators of relational algebra K1 CO2

1. Selection(σ) - It is used to select required tuples of the relations.


2. Projection(π) - project required column data from a relation.
3. Union(U)- Union operation in relational algebra is the same as
union operation in set theory
4. Set Difference(-) - Set Difference in relational algebra is the same
set difference operation as in set theory.
5. Set Intersection(∩)-Set Intersection in relational algebra is the
same set intersection operation in set theory.
6. Rename(ρ) - Rename is a unary operation used for renaming
attributes of a relation.
7. Cartesian Product(X) - Cross-product between two relations.
Let’s say A and B, so the cross product between A X B will result
in all the attributes of A followed by each attribute of B. Each
record of A will pair with every record of B.
UNIT – 3 AND 4 QUESTION BANK

Q.N
Questions KL CO
o
UNIT -3
1. 1What is the need for normalization. K1 CO3

It is important that a database is normalized to minimize redundancy


(duplicate data) and to ensure only related data is stored in each
table. It also prevents any issues stemming from database modifications
such as insertions, deletions, and updates
1. Data Integrity: Normalization helps maintain data integrity by
reducing or eliminating data anomalies such as insertion, update,
and deletion anomalies. By organizing data into separate
relations and eliminating redundant information, normalization
ensures that each piece of data is stored in only one place,
reducing the risk of inconsistencies or contradictions.

2. Efficient Storage: Normalization optimizes storage space by


minimizing data redundancy. Redundant storage of data
consumes unnecessary disk space and can lead to increased
storage costs. By storing each piece of data in only one place and
using relationships between tables, normalization reduces storage
requirements and improves disk utilization.

3. Data Consistency: Normalization promotes data consistency by


enforcing constraints and dependencies between attributes. By
organizing data into separate tables and establishing relationships
between them, normalization ensures that changes to data are
propagated correctly and consistently throughout the database.
4. Simplified Updates: Normalization simplifies the process of
updating data by reducing the number of places where data needs
to be updated. With normalized data, updates only need to be
made in one place, rather than in multiple places where
redundant copies of the data may exist. This reduces the
likelihood of update anomalies and ensures that changes are
applied uniformly across the database.

2. 2Define superkey. K2 CO3


• Attribute closure covers all the attributes of given relation is
consider as superkey.
• All the superkey’s are not considered as candidate key.

1. Uniqueness: The values of a superkey must be unique for each


tuple within the relation. This means that no two tuples in the
relation can have the same combination of values for the
attributes in the superkey.
2. Subset Property: Any subset of a superkey is also a superkey.
This means that if a combination of attributes uniquely identifies
each tuple, then any subset of those attributes will also uniquely
identify each tuple.
3. Candidate Key: A superkey that contains the minimum number
of attributes necessary to uniquely identify each tuple is called a
candidate key. In other words, a candidate key is a minimal
superkey.
4. Example: In a relation representing students, a superkey could
be a combination of attributes such as student ID and email
address. Together, these attributes uniquely identify each student.
Additionally, student ID alone or email address

3. 3What is functional dependency? K2 CO3

EX: R(A,B,C,D)

FD{A->B, B->C, C->D}

4. 4Analyze the following relation and find out candidate key. K4 CO3

R(A,B,C,D)

FD{A->B, B->C, C->D}


ANS : CK= A (not in dependent side)

5. Differentiate lossy vs lossless decomposition K2 CO3


Lossless decomposition Lossy decomposition

6. Consider the following relation: K2 CO3

EMP (ENO, NAME, DATE_OF_BIRTH, SEX, DATE_OF_JOINING,


BASIC_PAY, DEPT)
Describe an SQL query that will find and display the average
BASIC_PAY in each DEPT.

Ans :Select avg(basic_pay) from emp where dept=”IT”;


7. 5Define anomalies. K1 CO3
Anomalies in DBMS are caused when there is too much redundancy in
the database's information.

8. 6List the different types of anomalies K1 CO3

1. Insertion Anomalies:
• Insertion anomalies occur when it is not possible to add
data into the database without adding additional,
unnecessary data. There are three subtypes of insertion
anomalies:

a. Tuple Insertion Anomaly: Occurs when certain attributes cannot be


recorded until additional unrelated attributes are also recorded. For
example, in a table recording student grades, if a student has not taken
any courses, it may not be possible to insert a record for that student.

b. Key Insertion Anomaly: Occurs when insertion of data into a table is


not possible until a value for a candidate key attribute is known. For
example, in a table tracking purchases, if a customer has not made any
purchases, it may not be possible to insert a record for that customer.
c. Composite Key Insertion Anomaly: Occurs when insertion of data
into a table is not possible until a value for a composite key attribute is
known. For example, in a table representing a many-to-many
relationship, if one side of the relationship is unknown, it may not be
possible to insert a record for the other side.

2. Deletion Anomalies:

• Deletion anomalies occur when deletion of certain data


from the database leads to unintended loss of other data.
There are two subtypes of deletion anomalies:
a. Tuple Deletion Anomaly: Occurs when deletion of data results in the
loss of unrelated data. For example, in a table tracking courses and
instructors, if an instructor is deleted, the records of courses taught by
that instructor may also be deleted, even if those courses are still being
offered by other instructors.

b. Functional Dependency Deletion Anomaly: Occurs when deletion


of data results in the loss of functional dependencies. For example, in a
table tracking courses and instructors, if an instructor teaches multiple
courses and the instructor's details are deleted, the relationship between
the courses and the instructor may be lost.

3. Update Anomalies:
• Update anomalies occur when updating certain data in the
database leads to inconsistency or loss of integrity. There
are two subtypes of update anomalies:

a. Modification Anomaly: Occurs when updating data requires changes


to multiple records and failure to update all related records leads to
inconsistency. For example, in a table tracking student information and
course grades, if a student's name changes, all records associated with
that student need to be updated to maintain consistency.

b. Insertion Anomaly: Occurs when updating data requires the insertion


of additional data. For example, in a table tracking student information
and course grades, if a new student is added and that student has not yet
taken any courses, it may not be possible to insert a record for that
student until the student takes a course.

9. 7Analyze the following relation and find out candidate key. K2 CO3

R(A,B,C,D)
FD{A->B, C->D}

Ans : CK=AC

10. 8Describe how you relate functional dependency with super key K2 CO3
generation.
R(A,B,C,D)

FD{A->B, C->D}

Ans : CK=AC, SK’s = 22=4


11. Describe how you relate functional dependency with any of the key K2 CO3
generation.

12. Define how you do the lossless decomposition with suitable relation. K1 CO3

Lossless decomposition

13. 9Define partial dependency with example. K1 CO3


Partial dependency arises when a non-prime attribute is functionally
dependent on a portion of a candidate key.

In a relation R, attribute B is partially dependent on attribute A if:

• A → B (A functionally determines B), and


• B is not fully functionally dependent on A, meaning B is not
functionally dependent on any proper subset of A.

Here's an example to illustrate partial dependency:


Consider a relation representing student grades in a course:
In this relation, let's assume that (Student_ID, Course_ID) is the
candidate key, as it uniquely identifies each tuple. Now, consider the
attribute "Grade".

• Student_ID → Grade (Student_ID functionally determines


Grade), meaning each student's grade depends on their student
ID.

• Course_ID → Grade (Course_ID functionally determines Grade),


meaning each course's grade depends on the course ID.
However, there is a partial dependency here. Grade is partially
dependent on Student_ID but not on Course_ID.

14. List the properties of decomposition.


1. Lossless-join Property: The decomposition should ensure that
no information is lost when joining the decomposed relations
back together. This means that the original relation can be
reconstructed from the decomposed relations using natural join
operations without introducing any spurious tuples.

2. Dependency Preservation: The functional dependencies that


hold in the original relation should be preserved in the
decomposed relations. This ensures that the integrity constraints
and semantics of the data are maintained after decomposition.

3. Minimality: The decomposition should be minimal, meaning


that it should not contain unnecessary relations or attributes.
Redundancy should be minimized to optimize storage space and
query performance.
4. Dependency Preservation and Lossless-Join (DPLJ)
Decomposition: This property combines both lossless-join and
dependency preservation. It ensures that the decomposition
satisfies both properties simultaneously, guaranteeing that the
original data can be reconstructed accurately and that the
functional dependencies are preserved.

5. Dependency Diagrams: Dependency diagrams, such as the


dependency graph or minimal cover, are often used to analyze
and guide the decomposition process. These diagrams help
identify the functional dependencies within the relation and guide
the decomposition to achieve properties like lossless-join and
dependency preservation.
6. Boyce-Codd Normal Form (BCNF): Decomposition into
BCNF ensures that every determinant is a candidate key. BCNF
decomposition is a special case of DPLJ decomposition and is
often sought after in database design to minimize update
anomalies.

7. Third Normal Form (3NF): Decomposition into 3NF ensures


that every non-prime attribute is non-transitively dependent on
every candidate key. While 3NF decomposition may not always
achieve lossless-join, it's still a commonly used normal form that
reduces redundancy and ensures data integrity.

15. 1List the Advantages of normalization K1 CO3


0
• Reduces redundant data.
• Provides data consistency within the database.
• More flexible database design.
• Higher database security.
• Better and quicker execution.
• Greater overall database organization.
16. Differentiate trivial from non trivial functional dependency. K2 CO3
Trivial − If a functional dependency (FD) X → Y holds, where Y is a
subset of X, then it is called a trivial FD. Trivial FDs always hold.

Non-trivial − If an FD X → Y holds, where Y is not a subset of X, then


it is called a non-trivial FD.

17. Differentiate 3NF from BCNF. K2 CO3


UNIT – 4
UNIT – 4

TRANSACTIONS

Transaction processing and Error recovery - concepts of transaction


processing, ACID properties, concurrency control, locking based
protocols for CC, error recovery and logging, undo, redo, undo-redo
logging and recovery methods.
1. 6Define deadlock. K1 CO4

A deadlock is a condition where two or more transactions are


waiting indefinitely for one another to give up locks.

Or

2. 7List the SQL statements used for transaction control. K1 CO4

1. Commit - permanently save any transaction into the database


Syntax : COMMIT;

2. Rollback - restores the database to last committed state


Syntax : ROLLBACK TO savepoint_name;

3. Savepoint - temporarily save a transaction so that you can


rollback to that point whenever required.
Syntax : SAVEPOINT savepoint_name;

3. 8Define Consistency K1 CO4

Consistency in database systems refers to the requirement that any


given database transaction must change affected data only in
allowed ways.

Transactions maintain integrity restrictions by moving the database from


one valid state to another.
Give your Own Example for consistency (1 mark)
4. 9List the commonly used Concurrency Control techniques. K1 CO4

1. Lock-Based Protocols:
• Lock-based protocols use locks to control access to data
items in the database.
• Transactions must acquire appropriate locks (e.g., read or
write locks) before accessing a data item.
• Locks prevent other transactions from concurrently
accessing or modifying the same data item.
• Lock-based protocols ensure serializability by enforcing a
strict order of access to data items.
• Common lock-based protocols include two-phase locking
(2PL), strict two-phase locking (S2PL), and deadlock
detection mechanisms.
2. Timestamp-Based Protocols:
• Timestamp-based protocols assign unique timestamps to
each transaction and data item.
• Transactions are ordered based on their timestamps to
determine their serializability order.
• Transactions with earlier timestamps have higher priority
and are allowed to execute before transactions with later
timestamps.
• Timestamp-based protocols use techniques like
timestamp ordering or Thomas' write rule to ensure
serializability and prevent conflicts between transactions.
• These protocols are often used in systems with high
contention or distributed environments where lock
management overhead is high.
3. Validation-Based Protocols:
• Validation-based protocols use a combination of
optimistic concurrency control and validation techniques.
• Transactions are allowed to execute without acquiring
locks initially, and their changes are buffered in private
workspaces.
• After a transaction completes, it undergoes a validation
phase where the database system checks if its changes
conflict with those made by other transactions.
• If the changes pass validation (i.e., do not conflict with
other transactions), they are applied to the database.
• If conflicts are detected during validation, the transaction
is aborted and restarted.
• Validation-based protocols are suitable for environments
with low contention and are known for their scalability
and reduced contention overhead.
• Examples of validation-based protocols include optimistic
concurrency control (OCC) and multi-version
concurrency control (MVCC).

5. 1 K1 CO4
What are the different locks used in concurrency control ?
0
1. Shared Lock (S-Lock):
• A shared lock allows multiple transactions to read a shared
resource simultaneously.
• Transactions holding a shared lock can only read the
resource but cannot modify it.
• Shared locks are used to enforce the read consistency of
data items, allowing concurrent read operations without
conflicts.
2. Exclusive Lock (X-Lock):
• An exclusive lock allows only one transaction to have
exclusive access to a resource, preventing other
transactions from reading or modifying it concurrently.
• Transactions holding an exclusive lock can both read and
modify the resource.
• Exclusive locks are used to ensure that write operations are
serialized and that only one transaction can modify a
resource at a time.

3. The Two-Phase Locking (2PL) protocol is a concurrency control


method used in database management systems to ensure
serializability of transactions. It consists of two phases: the
growing phase and the shrinking phase.
i. Growing Phase:
• In the growing phase, a transaction can acquire locks but
cannot release any locks.
• Once a transaction acquires a lock on a data item (e.g.,
shared or exclusive lock), it can continue to acquire
additional locks on other data items.
• The transaction is allowed to grow in terms of acquiring
locks but cannot release any locks until it reaches a point
where it requests its last lock.
ii. Shrinking Phase:
• In the shrinking phase, a transaction can release locks but
cannot acquire any new locks.
• Once a transaction releases its last lock, it enters the
shrinking phase and begins releasing locks.
• After a transaction releases its last lock, it cannot acquire
any new locks, ensuring that it does not interfere with other
transactions executing concurrently.

6. Describe commit and rollback commands in SQL. K2 CO4

COMMIT ROLLBACK
COMMIT permanently saves ROLLBACK undo the changes
the changes made by the current made by the current transaction.
transaction. restores the database to last
committed state
Syntax:
Commit; Syntax:
Rollback;
7. Define Durability with respect to the data in database. K1 CO4

Durability in databases is the property that ensures transactions are saved


permanently and do not accidentally disappear or get erased, even during
a database crash. This is usually achieved by saving all transactions to a
non-volatile storage medium.

Durability guarantees that committed transactions are not lost and that
the database remains in a consistent state, regardless of system failures.
8. What is Concurrency Control? K1 CO4
Concurrency Control in DBMS is a procedure of managing simultaneous
transactions ensuring their atomicity, isolation, consistency, and
serializability.
Several problems that arise when numerous transactions execute
simultaneously in a random manner are referred to as concurrency
control problems.
9. Define checkpoint. K1 CO4
o The checkpoint is a type of mechanism where all the previous logs are
removed from
the system and permanently stored in the storage disk.
o The checkpoint is like a bookmark. While the execution of the
transaction, such
checkpoints are marked, and the transaction is executed then using the
steps of the transaction,
the log files will be created.
o When it reaches to the checkpoint, then the transaction will be updated
into the
database, and till that point, the entire log file will be removed from the
file. Then the log file is
updated with the new step of transaction till next checkpoint and so on.
o The checkpoint is used to declare a point before which the DBMS was
in the consistent state, and all transactions were committed.
10. List the types of recovery techniques in DBMS. K1 CO4
• Rollback/Undo Recovery Technique
-Backing out or undoing the effects of a transaction that has not been
completed successfully due to a system failure or error
-The system uses the log records to undo the changes made by the
failed transaction and restore the database to its previous state.
• Commit/Redo Recovery Technique
-reapplying the changes made by a transaction that has been
completed successfully to the database
-The system uses the log records to reapply the changes made by the
transaction and restore the database to its most recent consistent
state.
11. List the different backup techniques in DBMS. K1 CO4
• Full database Backup: In this full database including data and database,
Meta
information needed to restore the whole database, including full-text
catalogs are
backed up in a predefined time series.
• Differential Backup: It stores only the data changes that have occurred
since
the last full database backup. When some data has changed many times
since
the last full database backup, a differential backup stores the most recent
version
of the changed data. For this first, we need to restore a full database
backup.
• Transaction Log Backup: In this, all events that have occurred in the
database,
like a record of every single statement executed is backed up. It is the
backup of
transaction log entries and contains all transactions that had happened to
the
database. Through this, the database can be recovered to a specific point
in time.
It is even possible to perform a backup from a transaction log if the data
files are
destroyed and not even a single committed transaction is lost.
• Incremental Backup: Backups can be made in increments using log-
based
recovery. Just the changes made since the last backup are kept in the log
file,
rather than creating a complete backup of the database each time.
• Lowers the Risk of Data Corruption: By making sure that all
transactions are
correctly committed or canceled before they are written to the database,
logbased recovery lowers the risk of data corruption.
12. List the disadvantages of log based recovery method. K1 CO4
• Additional overhead: Maintaining the log file incurs an additional
overhead on
the database system, which can reduce the performance of the system.
• Complexity: Log-based recovery is a complex process that requires
careful
management and administration. If not managed properly, it can lead to
data
inconsistencies or loss.
• Storage space: The log file can consume a significant amount of storage
space, especially in a database with a large number of transactions.
• Time-Consuming: The process of replaying the transactions from the
log file
can be time-consuming, especially if there are a large number of
transactions to recover
13. Differentiate 2PL from Strict 2PL. K2 CO4

2PL STRICT 2PL


gradually releasing locks one by releases LOCKS at once strict 2PL
one is that strict 2PL releases the lock
immediately after the commit
command executes
For example, one user may need to EX:
read data from a record while
Busy databases deal with
another user simultaneously
attempts to change or update that numerous concurrent queries, but
data. This leads to “dirty reads,”
where some of the record is let’s consider two transactions
updated and some isn’t during the with strict locking. The first
read transaction.
transaction obtains its locks, and
during release of the locks, the
second transaction contains its
own locks. This cascading effect
ensures that any queries set to
read changed data won’t read data
until the initial transaction either
successfully completes (commits)
or rolls back.

The 2PL protocol is a standard to


If the first transaction is
lock a record, perform the query,
and then release the lock for the successful, it commits its actions
next transaction. When the first
and then immediately releases the
query starts, it acquires a lock,
locks the record, and then releases locks. Then, the second
the lock. When the transaction
obtains a lock, it can’t release it transaction can read the updated
until the transaction is finished. data. However, if the first
transaction fails and rolls back,
the second transaction must also
roll back to avoid reading data
that hasn’t been updated yet.

UNIT – 5

IMPLEMENTATION TECHNIQUES

Data Storage and Indexes - file organizations, primary, secondary index


structures, various index structures - hash-based, dynamic hashing
techniques, multi-level indexes, B+ trees.

1. K1 CO5
List the different types of indexing or index structures in DBMS
2. List the different types of storage / memory. K1 CO5

1. Primary Memory (RAM, Cache, Registers)


• Volatile – all deleted when power is OFF
• Temporary storage, its used only during execution of the program.
• CPU is accessing data from only primary memory.
2. Secondary Memory (hard disk, floppy disk, flash memory(used in
cameras)
• non volatile – retain values even power is OFF
• permanent storage so we can access data anytime
• magnetic disk & tape – hard disk, floppy disk etc.
3.Tertiary Memory (CD / DVD / magnetic tape)
• hold a large amount of data without being constantly connected to
the server or the peripherals.
• A device of this type is connected either to a server or to a device
where the database is stored from the outside.
3. List the memory hierarchy. K1 CO5
4. Define the structure of index in database. K1 CO5

5. List the advantages of multilevel indexing. K1 CO5


• faster data retrieval
• reduces disk access
• improves query performance
• Optimized Data Sorting
• Consistent Data Performance
6. List the disadvantages of indexing.
• Increased database maintenance overhead: Indexes must
be maintained as data is added, destroyed, or modified in the
table, which might raise database maintenance overhead.
• Indexing can reduce insert and update performance
• Choosing an index can be difficult
7. K4 CO5
Differentiate static hashing from dynamic hashing.
8. Differentiate sparse from dense indexing. K4 CO5

9. Define multilevel indexing. K1 CO5


10. Differentiate primary from secondary indexing K4 CO5
11. List the different types of hashing techniques K1 CO5

Static Hashing
In static hashing, when a search-key value is provided, the hash
function always computes the same address.
Dynamic Hashing
The drawback of static hashing is that it does not expand or shrink
dynamically as the size of the database grows or shrinks.
12. Define B+ Tree K1 CO5

B+ Tree is an extension of B Tree which allows efficient insertion,


deletion and search operations.

In B Tree, Keys and records both can be stored in the internal as well as
leaf nodes. Whereas, in B+ tree, records (data) can only be stored on the
leaf nodes while internal nodes can only store the key values.

The leaf nodes of a B+ tree are linked together in the form of a singly
linked lists to make the search queries more efficient.

B+ Tree are used to store the large amount of data which can not be stored
in the main memory. Due to the fact that, size of main memory is always
limited, the internal nodes (keys to access records) of the B+ tree are
stored in the main memory whereas, leaf nodes are stored in the secondary
memory.

13. Differentiate B Tree from B+ Tree K4 CO5


14. List the operations of B+ Tree K1 CO5
B+ Tree is an extension of B Tree which allows efficient insertion,
deletion and search operations.

In B Tree, Keys and records both can be stored in the internal as well
as leaf nodes. Whereas, in B+ tree, records (data) can only be stored
on the leaf nodes while internal nodes can only store the key values.
15. Differentiate clustering vs non clustering index K4 CO5

16. List the types of file organization. K1 CO5

ISAM- Indexed Sequential Access Method.


17. Differentiate Pile file method from sorted file method. K4 CO5
Pile file method :
we store the records in a sequence i.e. one after the other in the order
in which they are inserted into the tables.

Sorted file method:


As the name itself suggests whenever a new record has to be inserted,
it is always inserted in a sorted (ascending or descending) manner

18. List the advantages and disadvantages of sequential file organization. K1 CO5
Advantages of Sequential File Organization
• Fast and efficient method for huge amounts of data.
• Simple design.
• Files can be easily stored in magnetic tapes i.e. cheaper
storage mechanism.
Disadvantages of Sequential File Organization
• Time wastage as we cannot jump on a particular record that is
required, but we have to move in a sequential manner which
takes our time.
• The sorted file method is inefficient as it takes time and space
for sorting records.

19. List the advantages and disadvantages of Heap file organization. K1 CO5
Advantages of Heap File Organization
• Fetching and retrieving records is faster than sequential
records but only in the case of small databases.
• When there is a huge number of data that needs to be loaded
into the database at a time, then this method of file
Organization is best suited.
Disadvantages of Heap File Organization
• The problem of unused memory blocks.
• Inefficient for larger databases.

20. List the advantages and disadvantages of B+ Tree. K1 CO5


B+ Tree Advantages
• These are optimized for range queries and are therefore faster for
queries that require range searches.
• These have a lower overhead than B-trees, which makes them
more efficient for large databases.
• These perform well for secondary indexes as they store the data
only in leaf nodes.
• These have a simpler implementation than B-trees.
B+ Tree Disadvantages
• These require more disk access than B-trees for point queries,
which can impact performance.
• These require more overhead for inserts and deletes than B-trees.
• These can be more complex to implement and manage than other
index types.
21. Define Dense Index. K1 CO5
A dense index in a database management system (DBMS) is a type of
index structure that maps each key value in a data file to the location of
the corresponding record. In a dense index, an entry exists in the index for
every key value in the data file.

Here are some key characteristics of a dense index:

1. Entry for Every Record: Unlike sparse indexes, where entries


only exist for some key values, in a dense index, there is an entry
for every record in the data file. This means that the index file size
is usually the same as the size of the data file, or very close to it.
2. Ordered Entries: The entries in a dense index are typically sorted
based on the key values they represent. This allows for efficient
searching and retrieval operations using techniques like binary
search.
3. Direct Mapping: Each entry in the dense index typically contains
a key value and a pointer or address that points directly to the
location of the corresponding record in the data file. This enables
quick access to the desired record without the need for additional
lookups.
4. Supports Range Queries: Dense indexes are well-suited for
range queries, where you need to retrieve records within a
specified range of key values. Since the entries are ordered, it's
easy to locate and retrieve records within a particular range.
5. High Overhead: While dense indexes offer fast access to
individual records and support efficient range queries, they come
with a higher overhead in terms of storage space. Because there is
an entry for every record, the index file can be quite large,
especially for large data sets.

s
BIG QUESTIONS
UNIT -1
1. 16 K2 CO1
Explain in detail about different data models with diagram
2. Explain the notations of E-R Model. Draw the E-R Diagram for Payroll 16 K2 CO1
Processing System with explanation.
3. i) Explain in detail about Three-Schema Architecture with realtime 8 K2 CO1
example.

ii)

CUSTOMERS 8 K3 CO1

ID NAME AGE CITY SALARY

1 Ramesh 32 Ahmedabad 2000.00

2 Khilan 25 Delhi 1500.00

3 Kaushik 23 Kota 2000.00

4 Chaitali 25 Mumbai 6500.00

5 Hardik 27 Bhopal 8500.00

6 Komal 22 Hyderabad 4500.00

7 Muffy 24 Indore 10000.00

8 Kavin 25 Delhi 3500.00

i) Build an SQL query to create the above CUSTOMERS table.


ii) Write an SQL query to insert above values into the
CUSTOMERS table.
iii) Build an SQL query to group the CUSTOMERS table based
on AGE and counts the number of records in each group.
iv) Build an SQL query for grouping the above created
CUSTOMERS table by the CITY column and calculating the
average salary of the customer from each city
v) Build an SQL query for grouping the records of the
CUSTOMERS table based on the columns CITY and AGE.
Build an SQL query for grouping the customers by their age and
calculating the minimum salary for each group and filter the groups where
the age is greater than 24.
4. 8 K2 CO1
i) Discuss about the components of DBMS
8 K2 CO1
ii) Explain the purpose of database systems
5. Explain in detail about Entities, Attributes and Relationships with 16 K2 CO1
example for each.
6. i) Discuss the Views of Data. 8 K2 CO1
8 K2 CO1
ii) Discuss the conceptual data modeling.
BIG QUESTIONS (16 MARKS)
UNIT - 2
1. Diagrammatic representation of relational model for Student 16 K4 CO2
Management System with explanation.
2. 16 K2 CO2
Explain in detail about Relational Algebra with example for each.
3. Explain in detail about different types of aggregate functions along with 16 K2 CO2
groupby and having clause in SQL with suitable example for each.
4. Illustrate the SQL commands along with syntax for the following 16 K4 CO2
i) Create a table “Student” with attributes like studname, regno,
department, phy_mark, chem_mark,maths_mark.
ii) Insert Values into the table
iii) Add the new column Total
iv) Update Total by adding phy_mark, chem_mark,maths_mark.
v) Display the values of “Student” Table
5. Illustrate the SQL commands along with syntax for the following 16 K4 CO2
i) Create a table “Stock_Info” with attributes like productid,
productname, total_items, no_of_items_purchased,
price_for_eachitem
ii) Insert Values into the table
iii) Add the new column Balance_Item
iv) Update Balance_item by subtracting no_of_items_purchased
from total_items
v) Display the values of “Stock_Info” Table
6. Illustrate the SQL commands along with syntax for the following 16 K4 CO2
i) Create a table “Employee” with attributes like empname, empid,
designation, department, age, BP, DA, TA.
ii) Insert Values into the table
iii) Add the new column Netpay
iv) Update Netpay by adding BP, DA and TA
v) Display the values of “Employee” Table

BIG QUESTIONS
UNIT -3
1. Analyze the following relation 16 K4 CO3
CAR-SALE(CarNo, DateSold, SalesmanNo, Commission%, Discount-
amount)
Assume that a car may be sold by multiple salesmen, and hence(CarNo,
SalesmanNo) is the primary key

Additional dependencies are


DateSold→Discount-amount
SalesmanNo→Commission%

Based on the given primary key, is this relation in 1NF, 2NF or 3NF? Why
or why not? How would you successively normalize it completely?
2. Discuss about the functional dependency. List and discuss the different 16 K2 CO3
types of inference rules for functional dependencies. Give relevant
examples.
3. (i) Explain the distinctions among the terms primary key, candidate key, 16 K4 CO3
and super key. Give relevant examples.
(ii) Analyze how you calculate number of superkeys for the given
relation R={a1,a2,a3,a4…….an} when
Candidate key 1 : (a1,a2)
Candidate Key 2: (a3,a4)
Let R(A, B, C, D, E, F) be a relation scheme with the following functional
dependencies- Find candidate keys and number of super keys based
on the given functional dependency.

A→B
C→D
D→E
(iii) Analyze the following six relations for an Order-processing Database
Application in a Company:
CUSTOMER (CUSTNO, CNAME, CITY)
ORDER (ORDERNO, ODATE, CUSTNO, ORD_AMT)
ORDER_ITEM (ORDERNO, ITEMNO, QTY)
ITEM (ITEMNO, ITEM_NAME, UNIT_PRICE)
SHIPMENT (ORDERNO, ITEMNO, WAREHOUSENO,
SHIP_DATE)
WAREHOUSE (WAREHOUSENO, CITY)

Here, ORD_AMT refers to total amount of an order; ODATE is the date


the order was placed; SHIP_DATE is the date an order is shipped from
the warehouse. Assume that an order can be shipped from several
warehouses. Specify the foreign keys for this schema, stating any
assumptions you make.
4. 16 K2 CO3
Explain 2NF, 3NF and 4NF with an example.
5. i) Discuss Join Dependencies and Fifth Normal Form, and explain why 8 K2 CO3
5NF?
ii) Describe, How you Relate foreign key , alternate key and primary 8
key with suitable relational model.
6. i) Explain in detail about attribute closure with different example. 8 K2 CO3
ii) Discuss 1NF with suitable example. 8
7. Explain in detail about normalization with its types and suitable example 16 K2 CO3
for each.
8. Explain armstrong’s axioms for functional dependencies. 16 K2 CO3
BIG QUESTIONS (16 MARKS)
UNIT - 4
1. (i) Explain serial and non serial schedule with suitable example for each. 8 K2 CO4
(ii) Discuss the concept of serializability with suitable example. 8
2. (i) Explain in detail about transactions with commit and rollback 8 K2 CO4
operations. Give relevant example for each. 8
(ii) Discuss the states a transaction can be in with a neat sketch.
3. Discuss the ACID properties of a transaction. Give relevant example. 16 K2 CO4
4. 16 K3 CO4
Illustrate deadlock and conflict serializability with suitable example.
5. 16 K2 CO4
Explain in detail about view serializability with example.
6. 16 K2 CO4
Discuss about different types of failures with example for each.
7. Explain the problems with concurrent execution and describe how to 16 K2 CO4
control it.
8. Discuss about concurrency control protocols with suitable example for 16 K2 CO4
each.
9. Explain lock based concurrency control protocol. 16 K2 CO4
10. i) Explain time stamp CCP. 8 K2 CO4
ii) Describe validation based CCP. 8
11. Explain in detail about Undo and Redo operations with example. 16 K2 CO4

BIG QUESTIONS (16 MARKS)


UNIT - 5
1. 16 K2 CO5
Explain in detail about primary and secondary index structures.
2. 16 K2 CO5
Discuss different ways of file organization in DBMS
3. Determine the structure of B+ Tree and give the algorithm for search in 16 K3 CO5
the B+ tree with example.
4. Explain in detail about static and dynamic hashing with suitable example 16 K2 CO5
for each.
5. i) Predict the memory location and insert following elements using 10 K3 CO5
Dynamic / Extendible Hashing with bucket size / order is 3.
16,4,6,22,24,10,31,7,9,20,26
ii) Predict the memory location and insert following elements using Open 6 K3 CO5
Hashing with Linear Probing with Hash table size is 10.
11,2,14,16,12,22,23,26.
6. 16 K2 CO5
Explain in detail about multilevel indexing with suitable example.
7. Apply dynamic hashing in DBMS to store employee records. Initially, the 16 K3 CO5
hash table has a single bucket. Each record contains the employee's ID,
name, and department. Describe the step-by-step process of inserting a
new employee record into the hash table using dynamic hashing. Discuss
how the structure of the hash table evolves as new records are inserted and
explain any necessary split or merge operations.
8. 16 K2 CO5
Explain the concept of RAID with its different levels.
9. Construct a B+ tree to insert the following key elements ( order of the tree 16 K3 CO5
is 4 ) 1,4,7,10,17,21,31,25,19,20,28,42, after construction of the B+ Tree
delete the nodes 21,31,20,10,7,25,42 from the resulting B+ Tree.

10. Construct a B+ tree to insert the following key elements ( order of the tree 16 K3 CO5
is 3 ) 5, 3, 4, 9, 7, 15, 14, 21, 22, 23.
11. Describe in detail about how records are represented in a file and how to 16 K2 CO5
organize them in a file.

You might also like