Dbms 2mark
Dbms 2mark
Q.1 What is Database Management System? Why do we need a DBMS? AU: May-05, Dec- 08
Ans:
• A Database Management System (DBMS) is collection of interrelated data and various programs that are used to
handle the data.
• The primary goal of DBMS is to provide a way to store and retrieve the required information from the database in
convenient and efficient manner.
• In addition, the database systems must ensure the safety of information stored.
1) DBMS removes the data redundancy that means there is no duplication of data in database.
3) Data can be isolated in separate tables for convenient and efficient use.
Ans:Data abstraction means retrieving only required amount of information of the system and hiding background
details.
1. Physical Level
2. Logical Level
3. View Level
Q.6 Is it possible for several attributes to have same domain? Illustrate your answer with SLO suitable example.
AU: Dec- 04, 15
Ans:A domain is the set of legal values that can be assigned to an attribute. Each attribute in a database must have a
well-defined domain; we can't mix values from different domains in the same attribute. Hence it is not possible for
several attributes to have same domain.
For example - Student domain has attributes RollNo, Name, Address. Similarly Employee domain has EmpID,
Ename,Salary,Address. We can not define the same domain for defining several attributes.
Q.7 Write the characteristic that distinguish the database approach with File based approach. AU: May-15, Dec.-
16,19
OR What are main differences between file processing system and a DBMS ? AU: May-06, Dec.-06
Q.8 Discuss briefly three major disadvantages of keeping organizational information in a file processing system.
Ans:
• It is a collection of conceptual tools for describing data, relationships among data, bro semantics (meaning) of data
and constraints.
Ans:
• Data Definition Language (DDL) is a specialized language used to specify a mondatabase schema by a set of
definitions.
• It is a language which is used for creating and modifying the structures of tables, views, indexes and so on.
• Some of the common commands used in DDL are -CREATE, ALTER, DROP.
Ans: DCL stands for Data Control Language. It includes commands such as GRANT and REVOKE which mainly deals
with the rights, permissions and other controls of the database system.
Q.15 Why does SQL allow duplicate tuples in a table or in a query result?
Ans:
• Data can be the same. Two people may have the same name. Since SQL is a database where you store your data
and data can be duplicate.
• But we can apply primary key constraints, Unique constraints or Distinct keyword to identify the record uniquely
Ans:
• Keys are used to specify the tuples distinctly in the given relation.
• Various types of keys used in relational model are - Superkey, Candidate Keys, primary keys, foreign keys.
Ans:
• The primary key is a candidate key chosen by the database designer to identify the tuple in the relation uniquely.
• For example - Consider a Student database as Student (RollNo,Name,Address). The primary key for this database is
RollNo. The primary is underlined.
Q.18 Define foreign key. Give example.
Ans:
• Foreign key is a single attribute or collection of attributes in one table that refers to the primary key of other table.
• For example - Consider a Student database as Student (RollNo,Name,Address) and Course(CourseId, CourseName,
RollNo). Here RollNo is a foreign key
Q.19 What is the difference between primary key and foreign key?
Ans:
Ans:
• The referential integrity rule states that "whenever a foreign key value is used it must reference a valid, existing
primary key in the parent table".
• Example: Consider the situation where you have two tables : Employees and Managers. The Employees table has a
foreign key attribute entitled ManagedBy, which points to the record for each employee's manager in the Managers
table.
Ans: Domain integrity ensures that all the data items in a column fall within a defined set of valid values. Each
column in a table has a defined set of values, such as the set of all numbers for zip (five-digit), the set of all character
strings for name.
Q.22 What are different types of integrity constraints used in designing relational databases? AU: Dec.-07
Q.23 List the reasons why null value might be introduced into the database. AU: May-06
i) When field values of some tuples are unknown(For e.g. city name is not assigned and
Q.25 Describe briefly any two undesirable properties that a database design may have.
Ans: The two undesirable properties that a database design may have
(1)Repetition of data
Q.26 Specify with suitable examples, the different types of keys used in database management system.
1) Super Key(SK)
2) Candidate Key(CK)
3) Primary Key(PK)
4) Alternate Key
5) Foreign key
Ans: Data independence is an ability by which one can change the data at one level without affecting the data at
another level. Here level can be physical, conceptual or external.
By these data independence the time and cost acquired by changes in any one level can be reduced and abstract
view of data can be provided to the user.
• When information is inserted or deleted from the database then the database gets changed. The collection of
information at particular moment is called instances.
Q.30 Differentiate between Dynamic SQL and Static SQL. AU: Dec.-14,15,16,17, May-15
Ans:
Q.32 Expression in Relational algebra, the division operation(/) using the project, cartesian product and minus
operations. Give a simple example. AU: Dec.-19
Ans: Let, R(A, B) and S(B) be two relations. R÷ S is denoted as - ΠA(R) - ΠA (ΠA (R) × S - R)
Q.7 What are the problems caused by redundancy? AU: Dec.-16, May-18
Ans:Problems caused by Redundancy: Following problems can be caused by redundancy -
i) Redundant Storage: Some information is stored repeatedly.
ii) Update Anomalies: If one copy of such repeated data is updated then inconsistency is created unless all other
copies are similarly updated.
iii) Insertion Anomalies: Due to insertion of new record repeated information get added to the relation schema.
iv) Deletion Anomalies: Due to deletion of particular record some other important information associated with the
deleted record get deleted and thus we may lose Isbom some other important information from the schema.
Q.8 Define functional dependency. AU: Dec 04,05, May 05,14,15
Ans: Let P and Q be sets of columns, then : P functionally determines Q, written P→ Q if and only if any two rows
that are equal on (all the attributes in) P must be equal on (all the attributes in) Q.
In other words, the functional dependency holds if
T1.P = T2.P, then T1.Q=T2.Q
Where notation T1.P projects the tuple T1 onto the attribute in P.
Q.9 Why certain functional dependencies are called trivial functional dependencies? AU: May-06,12
Ans:
• A functional dependency FD: XY is called trivial if Y is a subset of X. This kind of dependency is called trivial because
it can be derived from common sense. If one "side" is a subset of the other, it's considered trivial. The left side is
considered the determinant and the right the dependent.
• For example - {A,B} -> B is a trivial functional dependency because B is a subset of A,B. Since (A,B) -> B includes B,
the value of B can be determined. It's a trivial functional dependency because determining B is satisfied by its
relationship to A,B
Q.10 Define normalization. AU: May-14
Ans: Normalization is the process of reorganizing data in a database so that it meets two basic requirements:
1) There is no redundancy of data (all data is stored in only one place), and
2) Data dependencies are logical (all related data items are stored together)
Q.11 State anomalies of 1NF. AU: Dec.-15
Ans: All the insertion, deletion and update anomalies are in 1NF relation.
Q.12 What is multivalued dependency? AU: Dec.-06
Ans: A table is said to have multi-valued dependency, if the following conditions are true,
1) For a dependency A → B, if for a single value of A, multiple values of B exists, then the table may have multi-values
dependency.
2) Also, a table should have at-least 3 columns for it to have a multi-valued dependency.
3) And, for a relation R(A,B,C), if there is a multi-valued dependency between, A and B, then B and C should be
independent of each other.
Q.13 Describe BCNF and describe a relation which is in BCNF.
Ans: Refer section 2.12.
Boyce and Codd Normal Form is a higher version of the Third Normal form. This form deals with certain type of
anomaly that is not handled by 3NF.
A 3NF table which does not have multiple overlapping candidate keys is said to be in BCNF.
Or in other words, For a table to be in BCNF, following conditions must be satisfied:
i) R must be in 3rd Normal Form
ii) For each functional dependency (X → Y), X should be a super Key. In simple words if Y is a prime attribute then X
can not be non prime attribute.
Q.14 Why 4NF in normal form is more desirable than BCNF?
Ans:
4NF is more desirable than BCNF because it reduces the repetition of information. If we consider a BCNF schema not
in 4NF we observe that decomposition into 4NF does not lose information provided that a lossless join
decomposition is used, yet A redundancy is reduced.
Q.15 Give an example of a relation schema R and set of dependencies such that R is in BCNF but not in 4NF. AU:
May-12
Ans: Consider relation R (A,B,C,D) with dependencies
AB→C
ABC→D
AC→B
Here the only key is AB. Thus each functional dependency has superkey on the left. But MVD has non-superky on its
left. So it is not 4NF.
Q.16 Show that if a relation is in BCNF, then it is also in 3NF. Ans:AU: Dec.-12
• Boyce and Codd Normal Form is a higher version of the Third Normal form.
• A 3NF table which does not have multiple overlapping candidate keys is said to ove be in BCNF. When the table is
in BCNF then it doesn't have partial functional dependency as well as transitive dependency.
• Hence it is true that if relation is in BCNF then it is also in 3NF.
Q.17 Why it is necessary to decompose a relation? AU: May-07
Ans:
• Decomposition is the process of breaking down one table into multiple tables.
• The decomposition is used for eliminating redundancy.
Q.18 Explain atleast two desirable properties of decomposition. AU: May-03,17,19, Dec.-05
Ans:There are two properties associated with decomposition and those are -
1) Loss-less Join or non Loss Decomposition: When all information found in the original database is preserved after
decomposition, we call it as loss less or nonloss decomposition.
2) Dependency Preservation: This is a property in which the constraints on the wied original table can be maintained
by simply enforcing some constraints on each of the smaller relations.
Q.19 Explain with simple example lossless join decomposition. AU: May-03
Ans: Refer section 2.10.1.
i) Union of attributes of R1 and R2 must be equal to attribute of R. Each attribute of R must be either in R1 or in R2.
Att(R1) U Att(R2) = Att(R)
ii) Intersection of attributes of R1 and R2 must not be NULL.
Att(R1) Att(R2) ≠ Φ
iii)Common attribute must be a key for at least one relation (R1 or R2)
Att(R1) Att(R2) -> Att(R1)
Att (R1) Att (R2) -> Att (R2)
Q.20 Define the terms entity set and relationship set. AU: May-19
Ans: Refer section 2.1.2.
Entity set: The entity set is a set of entities of the same types. For example - All students studying in class X of the
School. The entity set need not be disjoint. Each entity in entity set have the same set of attributes and the set of
attributes will distinguish it from other entity sets. No other entity set will have exactly the same set of attributes.
All the operations of transaction T1 on data items A and then B executes and then in transaction T2 all the operations
on data items A and B execute. The R stands for Read operation and W stands for write operation.
Q.13 When are two schedules conflict equivalent? AU: Dec.08
Ans.: Two schedules are conflict equivalent if :
• They contain the same set of the transaction.
• every pair of conflicting actions is ordered the same way.
For example -
Schedule S2 is a serial schedule because, in this, all operations of T1 are performed before starting any operation of
T2. Schedule S1 can be transformed into a serial schedule by swapping non-conflicting operations of S1.
Hence both of the above the schedules are conflict equivalent.
Q.14 Define two phase locking. AU: May-13
Ans.: The two phase locking is a protocol in which there are two phases:
i) Growing Phase (Locking Phase): It is a phase in which the transaction may obtain locks but does not release any
lock.
ii) Shrinking Phase (Unlocking Phase): It is a phase in which the transaction may release the locks but does not
obtain any new lock.
Q.15 What is the difference between shared lock and exclusive lock? AU: May-18
Ans.:
Q.16 What type of lock is needed for insert and delete operations. AU: May-17
Ans.: The exclusive lock is needed to insert and delete operations.
Q.17 What benefit does strict two-phase locking provide? What disadvantages result? AU: May-06,07, Dec.07
Ans.:
Benefits:
1. This ensure that any data written by an uncommitted transaction are locked in exclusive mode until the
transaction commits and preventing other transaction from reading that data.
2. This protocol solves dirty read problem.
Disadvantage:
1. Concurrency is reduced.
Q.18 What is rigorous two phase locking protocol ? AU: Dec.-13
Ans.: This is stricter two phase locking protocol. Here all locks are to be held until the transaction commits.
Q.19 Differentiate strict two phase locking and rigourous two phase locking protocol. AU: May-16
Ans. :
• In Strict two phase locking protocol all the exclusive mode locks be held until the transaction commits.
• The rigourous two phase locking protocol is stricter than strict two phase locking protocol. Here all locks are to be
held until the transaction commits
Q.20 Define deadlock. AU: May-08,09,14
Ans.: Deadlock is a situation in which when two or more transactions have got a lock and waiting for another locks
currently held by one of the other transactions.
Q.21 List four conditions for deadlock. AU: Dec-16
Ans.: 1. Mutual exclusion condition
2. Hold and wait condition
3. No preemption condition
4. Circular wait condition
Q.22 Why is recovery needed? AU: May-09
Ans. :
• A recovery scheme that can restore the database to the consistent state that existed before the failure.
• Due to recovery mechanism, there is high availability of database to its users.
Q.23 What are states of transaction? AU: May-19
Ans.: Various states of transaction are - (1) Active, (2) Partially Committed (3) Failed (4) Aborted (5) Committed.
Q.24 What is meant by log based recovery?
Ans.: Log is a most commonly used data structure for recording the modifications that can be made to actual
database.
Log based recovery is a technique in which a log of each transaction is maintained in some stable storage so that if
failure occurs then it can be recovered from there.
Q.25 List the responsibilities of a DBMS has whenever a transaction is submitted to the system for execution.
AU: Dec.-19
Ans.: The system is responsible for making sure that - (1) Either all the operations in the transaction are completed
successfully and effect is recorded permanently in the database. (2) The transaction, has no effect whatsoever on the
database or on the database or on any other transaction.
Q.26 Brief any two violations that may occur if a transaction executes a lower isolation level than serializable.
AU: Dec.-19
Ans.: (1) For non-repeatable Read the phantom read is allowed.
For read committed non-repeatable reads and phantom reads are allowed.
Two Marks Questions with Answers
Ans.: Hardware RAID: The hardware-based array manages the RAID subsystem independently from the host. It
presents a single disk per RAID array to the host. Software RAID: Software RAID implements the various RAID levels
in the kernel disk code. It offers the cheapest possible solution, as expensive disk controller cards.
Q.3 What are ordered indices? AU: June-09, Dec. -11,17, May-14
Ans.: This is type of indexing which is based on sorted ordering values. Various ordered indices are primary indexing,
secondary indexing.
Q.4 What are the two types of ordered indices? AU: Dec.-06
Ans.: Two types of ordered indices are - Primary indexing and secondary indexing. The primary indexing can be
further classified into dense indexing and sparse indexing and single level indexing and multilevel indexing.
Q.5 Give the comparison between ordered indices and hashing. AU: Dec-06
Ans.:
(2) The buckets containing records can be chained in sorted order in case of ordered indices.
(3) Hashing is generally better at retrieving records having a specified value of the key.
(4) Hash function assigns values randomly to buckets. Thus, there is no simple notion of "next bucket in sorted
order."
Q.6 What are the causes of bucket overflow in a hash file organization?
(1) Insufficient buckets: For the total number of buckets there are insufficient number of buckets to occupy.
(2) Skew: Some buckets are assigned more records than are others, so a bucket might overflow even while other
buckets still have space. This situation is known as bucket skew.
Q.7 What can be done to reduce the occurrences of bucket overflows in a hash file organization? AU: May-07,
June-09, Dec.-12
Ans.:
(1) A bucket is a unit of storage containing one or more records (a bucket is typically a disk block).
(2) The file blocks are divided into M equal-sized buckets, numbered bucket0, bucket... bucketM-1. Typically, a
bucket corresponds to one (or a fixed number of) disk block.
(3) In a hash file organization we obtain the bucket of a record directly from its search- key value using a hash
function, h (K).
(4) To reduce overflow records, a hash file is typically kept 70-80% full.
(5) The hash function h should distribute the records uniformly among the buckets; otherwise, search time will be
increased because many overflow records will exist.
Q.8 Distinguish between dense and sparse indices. AU: May-08, June-09
• This record contains search key value and a pointer to the actual record.
2) Sparse index:
• We start at that record pointed to by the index record, and proceed along the pointers in the file (that is,
sequentially) until we find the desired record
Q.9 When is it preferable to use a dense index rather than a sparse index? Explain your answer. AU: Dec. -11
Ans.: 1. It is preferable to use a dense index instead of a sparse index when the file is not sorted on the indexed field.
Q.10 How does B-tree differs from a B+ tree? Why is a B+ tree usually preferred as an access structure to a data
file? AU: Dec.-08
Q.11 What are the disadvantages of B tree over B+ tree? AU: Dec.-16
Ans.:
(1) Searching of a key value becomes difficult in B-tree as data can not be found in the leaf node.
(2) The leaf node can not store linked list and thus wastes the space.
Ans.: Two types of hashing techniques are - i) Static hashing ii) Dynamic hashing.
Q.13 List the mechanisms to avoid collision during hashing. AU: Dec.-16
(2) Open addressing techniques: (i) Linear probing (ii) Quadratic probing
Q.14 What is the basic difference between static hashing and dynamic hashing? AU: May-13, Dec.-14,15
Ans.: Query optimization is required for fast execution of long running complex
Q.16 Which cost component are used most commonly as the basis for cost function. AU: May-17, Dec.-19
Ans.: Disk access or secondary storage access is considered most commonly as a basis for cost function.
Ans.: To specify fully how to evaluate a query, we need not only to provide the relational-algebra expression, but
also to annotate it with instructions specifying how to evaluate each operation. This annotated structure is called
query execution plan.
Ans. Various file operations are - (1) Creation of file (2) Insertion of data (3) Deletion of data (4) Searching desired
data from the file. ba
• Horizontal fragmentation: In this approach, each tuple of r is assigned to one or more fragments. If relation R is
fragmented in r1 and r2 fragments, then to bring these fragments back to R we must use union operation. That
means R=r1ur2
• Vertical fragmentation: In this approach, the relation r is fragmented based on one or more columns. If relation R
is fragmented into r1 and r2 fragments using vertical fragmentation then to bring these fragments back to original
relation R we must use join operation. That means R= r1 r2
Q.4 What are the advantages of distributed databases?
Ans.:
(1) There is fast data processing as several sites participate in request processing.
(2) Reliability and availability of this system is high.
(3) It possess reduced operating cost.
(4) It is easier to expand the system by adding more sites.
(5) It has improved sharing ability and local autonomy.
Q.4 List out the reasons for development of distributed databases.
Ans.: Following are the reasons for development of distributed databases –
(1) To control the data present at geographically different sites.
(2) To obtain highly available and reliable data processing systems.
Q.5 Difference between homogeneous and heterogeneous schema.
Ans. :