CLG Question Bank
CLG 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.
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)
1. Entity Set:
UNIT -2
UNIT – 2
RELATIONAL MODEL
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
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.
Q.N
Questions KL CO
o
UNIT -3
1. 1What is the need for normalization. K1 CO3
EX: R(A,B,C,D)
4. 4Analyze the following relation and find out candidate key. K4 CO3
R(A,B,C,D)
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:
2. Deletion Anomalies:
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:
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}
12. Define how you do the lossless decomposition with suitable relation. K1 CO3
Lossless decomposition
TRANSACTIONS
Or
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.
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 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
UNIT – 5
IMPLEMENTATION TECHNIQUES
1. K1 CO5
List the different types of indexing or index structures in DBMS
2. List the different types of storage / memory. 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
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.
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
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.
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
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
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)
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.