0% found this document useful (0 votes)
22 views3 pages

DBMS CS

The document discusses different database concepts including DBMS models, ACID properties, normalization, primary and foreign keys, joins, stored procedures, indexes, transactions, locking, and sharding.

Uploaded by

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

DBMS CS

The document discusses different database concepts including DBMS models, ACID properties, normalization, primary and foreign keys, joins, stored procedures, indexes, transactions, locking, and sharding.

Uploaded by

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

1. What is a DBMS?

Answer: A DBMS is software that manages databases, providing an interface to store,


retrieve, and manipulate data efficiently and securely.

2. What are the different types of DBMS models?


Answer: The main types are:
Relational DBMS (RDBMS)
NoSQL DBMS (Document, Key-Value, Columnar, Graph)

3. Explain ACID properties in DBMS.


Answer: ACID stands for Atomicity, Consistency, Isolation, and Durability, which
ensure database transactions are reliable and maintain data integrity.

4. What is normalization in DBMS?


Answer: Normalization is the process of organizing data to eliminate redundancy and
improve data integrity in a relational database.

5. What is the difference between a primary key and a foreign key?


Answer: A primary key uniquely identifies a record in a table, while a foreign key
refers to the primary key of another table, establishing a relationship between the
two.

6. Explain the difference between DELETE and TRUNCATE in SQL.


Answer: DELETE removes rows from a table one by one with transaction logging, while
TRUNCATE removes all rows at once without transaction logging.

7. What is the difference between INNER JOIN and OUTER JOIN?


Answer: INNER JOIN returns only matching rows from both tables, while OUTER JOIN
(LEFT, RIGHT, FULL) returns matching rows as well as non-matching rows from one or
both tables.

8. What is a stored procedure?


Answer: A stored procedure is a precompiled set of SQL statements that can be
stored and executed on the database server to perform specific tasks.

9. Explain the difference between a database and a DBMS.


Answer: A database is a collection of related data, while a DBMS is software used
to manage, store, and retrieve data efficiently from the database.

10. What is the purpose of an index in a database?


Answer: An index improves the speed of data retrieval operations by creating a data
structure that allows the database to locate and access data quickly.

11. What is a deadlock, and how can it be avoided?


Answer: A deadlock occurs when two or more transactions are unable to proceed
because each is waiting for the other to release a lock. Deadlocks can be avoided
by using proper transaction management and lock acquisition strategies.

12. What is a trigger in DBMS?


Answer: A trigger is a set of actions that automatically execute in response to
specific database events, such as insert, update, or delete operations on a table.

13. Explain the concept of data integrity in a DBMS.


Answer: Data integrity ensures that data is accurate, consistent, and valid
throughout the database, preventing unauthorized or erroneous changes.

14. What is a self-join in SQL?


Answer: A self-join is a SQL query where a table is joined with itself to combine
related rows based on a common column.
15. What is the difference between a heap table and a clustered table?
Answer: A heap table does not have a clustered index, while a clustered table
stores data physically sorted based on the indexed column.

16. What are the advantages and disadvantages of denormalization?


Answer: Denormalization can improve read performance but may lead to data
redundancy and increased complexity in maintaining data consistency.

17. Explain the concept of a transaction in DBMS.


Answer: A transaction is a sequence of one or more database operations that are
treated as a single unit, ensuring data consistency and allowing rollback in case
of failures.

18. What is the purpose of the COMMIT statement in SQL?


Answer: The COMMIT statement is used to permanently save all changes made during a
transaction.

19. What is the difference between a clustered and non-clustered index?


Answer: A clustered index determines the physical order of data rows in a table,
whereas a non-clustered index creates a separate structure for quick data access.

20. What are the advantages of using a NoSQL database over an RDBMS?
Answer: NoSQL databases offer flexibility, scalability, and better performance for
unstructured or semi-structured data compared to traditional RDBMS.

21. Explain the CAP theorem in the context of distributed databases.


Answer: The CAP theorem states that it is impossible for a distributed database to
simultaneously achieve Consistency, Availability, and Partition tolerance. It can
satisfy at most two out of the three.

22. What are triggers in the context of database events?


Answer: Triggers are special stored procedures that are automatically executed in
response to specific data manipulation events, like INSERT, UPDATE, or DELETE
operations.

23. Explain the difference between optimistic and pessimistic locking.


Answer: Optimistic locking assumes no conflicts between transactions until the end,
checking for conflicts only during the commit. Pessimistic locking acquires locks
immediately, assuming conflicts might occur.

24. What is a materialized view in DBMS?


Answer: A materialized view is a database object that stores the result of a query,
allowing faster data retrieval since the results are precomputed and stored.

25. What is a B-tree index?


Answer: A B-tree index is a self-balancing tree data structure used to speed up
data retrieval by maintaining a sorted hierarchy of values.

26. Explain the concept of sharding in database systems.


Answer: Sharding involves splitting a large database into smaller, more manageable
pieces (shards) to distribute the data across multiple servers or nodes for
improved scalability and performance.

27. What is an Entity-Relationship Diagram (ERD)?


Answer: An ERD is a visual representation of the relationships among entities in a
database, showing how different tables are connected.

28. How can you optimize the performance of a SQL query?


Answer: Query performance can be improved by adding indexes, optimizing table
structures, and rewriting complex queries.

29. What is a transaction log in a database, and why is it essential?


Answer: The transaction log records all changes made to a database and is crucial
for recovery in case of system failures or crashes.

30. Explain the concept of referential integrity in a relational database.


Answer: Referential integrity ensures that relationships between tables are
maintained by enforcing valid foreign key constraints, preventing the creation of
orphaned records.

Bonus Questions:
Explain the purpose of the SQL JOIN clause in DBMS.
Answer: The JOIN clause in SQL is used to combine rows from two or more tables
based on a related column between them. It allows data from different tables to be
retrieved together to create more comprehensive result sets.

What are the advantages and disadvantages of using stored procedures in a DBMS?
Answer: Advantages of stored procedures include improved performance (as they are
precompiled), reduced network traffic (since the code resides on the server), and
enhanced security (as users only need execute permissions). However, disadvantages
include increased complexity and maintenance overhead, limited portability across
different database systems, and a potential lack of direct debugging capabilities.

What are the different types of locks in a DBMS, and how do they affect data
concurrency?
Answer: The main types of locks are:

Shared Lock (Read Lock): Allows multiple transactions to read data simultaneously
but not modify it.

Exclusive Lock (Write Lock): Only one transaction can acquire this lock, preventing
other transactions from reading or writing the locked data.

Update Lock: A hybrid lock that allows multiple transactions to read the data but
prevents concurrent updates.
Intent Lock: Indicates that a transaction intends to acquire a higher-level lock to
protect a range of data.

Locks play a vital role in managing data concurrency. Shared locks promote data
read consistency, allowing multiple transactions to read the same data
simultaneously. Exclusive locks ensure data integrity by preventing multiple
transactions from modifying the same data simultaneously. However, excessive or
poorly managed locks can lead to contention and performance issues, impacting the
overall database performance. Proper lock management and lock escalation techniques
are essential for efficient data concurrency control.

You might also like