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

GMR Institute of Technology, Quality Management System

Internal Question Paper (GMRIT : QMS)

U.G. CSE & IT Degree Bachelor of Technology


Academic Year 2018 – 2019 Test II Sem. III
Course Title
Course Code 16CS304
Database Management Systems Scheme
Duration 90 Minutes Maximum Marks 40 (FOURTY)
Remember (%) 25 Understand (%) 15 Apply (%) 20 Analyze (%) 40

SECTION I (Short Answer Questions)


(Answer all the Questions)
5 x 2 = 10 Marks
No. Questions (1 to 5)
1 Define Functional Dependency.
Answer: Functional dependency is a relationship that exists when one attribute uniquely
determines another attribute.
If R is a relation with attributes X and Y, a functional dependency between the attributes is
represented as X->Y, which specifies Y is functionally dependent on X. Here X is a
determinant set and Y is a dependent attribute. Each value of X is associated with precisely one
Y value.
Functional dependency in a database serves as a constraint between two sets of attributes.
Defining functional dependency is an important part of relational database design and
contributes to aspect normalization.

2 Differentiate Partial and Full Function dependency.


Answer: A full functional dependency is a state of database normalization that equates to the
normalization standard of Second Normal Form (2NF). In brief, this means that it meets the
requirements of First Normal Form (1NF), and all non-key attributes arefully
functionally dependent on the primary key
A partial dependency means if the non-key attributes depend on the part of candidate key then
it is said to be partial dependency.
For example : Let there be a relation R ( Course, Sid , Sname , fid, schedule , room , marks )
Full Functional Dependencies : {Course , Sid) -> Sname , {Course , Sid} -> Marks, etc.
Partial Functional Dependencies : Course -> Schedule , Course -> Room

3 Differentiate shared and excusive lock.


Answer: If a lock is acquired on a data item to perform a read operation is shared lock.
Similarly, a lock is acquired on a data item to perform write operation is an exclusive lock.
4 Define Join dependency.
Answer: In the area of computer science known as dependency theory, a join dependency is a
constraint on the set of legal relations over a database scheme. A table T is subject to a
join dependency if T can always be recreated by joining multiple tables each having a subset of
the attributes of T. If one of the tables in the join has all the attributes of the table T, the join
dependency is called trivial.
5 Differentiate Heap File vs sorted file.

Form No. AC 27. 00.2018 | GMR Institute of Technology, Rajam, Andhra Pradesh. Note to the Students: The
question papers are set in accordance with OBE capturing various cognitive levels of RBT as well as expected
AC 27 COs. This direct assessment tool of Descriptive Examinations is deployed to test the Cognitive Level of
Students w.r.t. Lower Order Thinking Skills.
GMR Institute of Technology, Quality Management System
Internal Question Paper (GMRIT : QMS)

Answer:
Heap File Organization
Any record can be placed any where in the file where there is space for record. There is no
ordering of record. Generally there is a single file for each relation (table)
Sequential File Organization
Records are stored in sequential order, according to the value of a “search key” of each record.

SECTION II (Long Answer Questions)


(Answer all the Questions)
3 x 10 = 30 Marks
No. Questions (6 to 11)
What are the three data anomalies that are likely to occur as a result of data redundancy? Can
data redundancy be completely eliminated in database approach? Why or why not?
Answer:
Explanation with example of three data anomalies (7 marks)
 Redundancy is at the root of several problems associated with relational schemas:
 redundant storage,
 insert/delete/update anomalies
 Functional dependency constraints utilized to identify schemas with such problems and
to suggest refinements.
 Main refinement technique:
 decomposition
 Example: replacing ABCD with, say, AB and BCD,
 Consider the relation:
 Insert Anomaly:
6  For a new employee, you have to assign NULL to projects
 Cannot insert a project unless an employee is assigned to it.
 Consider the relation:


Delete Anomaly:
If we delete from EMP_DEPT an employee tuple that happens to represent the
last employee, the information containing that department is lost from the
database
 Consider the relation:
 Modify Anomaly:
 If we change the value of the manager of department 5, we must update the tuples of all
employees who work in the department.

Using Normalization we can eliminate redundancy with explanation. (3 marks)


Illustrate 3rd Normal form to normalize a relation
Answer:
 A relation schema R is in third normal form (3NF) if it is in 2NF and no non-
7 (a) prime attribute A in R is transitively dependent on the primary key
 For any non-trivial functional dependency, X → A, then either −X is a superkey
or,
 A is prime attribute.
Form No. AC 27. 00.2018 | GMR Institute of Technology, Rajam, Andhra Pradesh. Note to the Students: The
question papers are set in accordance with OBE capturing various cognitive levels of RBT as well as expected
AC 27 COs. This direct assessment tool of Descriptive Examinations is deployed to test the Cognitive Level of
Students w.r.t. Lower Order Thinking Skills.
GMR Institute of Technology, Quality Management System
Internal Question Paper (GMRIT : QMS)

 Examples:
 SSN -> DMGRSSN is a transitive FD
 Since SSN -> DNUMBER and DNUMBER -> DMGRSSN hold
 SSN -> ENAME is non-transitive
 Since there is no set of attributes X where SSN -> X and X -> ENAME

Illustrate 1NF and 2NF with suitable example.


Answer:
First Normal Form (2.5 marks)
Historically, it is designed to disallow
 composite attributes
 multivalued attributes
 Or the combination of both
 All the values need to be atomic

(b)

 To normalize into 1NF, we have the following 3 techniques:


 Remove the attribute Dlocations that violates 1NF and place it in a
separate relation
 Expand the key. In this case, the PK become the combination of
{Dnumber, Dlocation}
 If the max number of values is known, then we can replace the violate
attribute by the max number atomic attributes, such as, Dlocation1,
Dlocation2, Dlocation3.

Second Normal Form (2.5 marks)
 In this example, {Ssn, Pnummber} -> Hours is a fully dependency
 However, the dependency {Ssn}->Ename is partial

Form No. AC 27. 00.2018 | GMR Institute of Technology, Rajam, Andhra Pradesh. Note to the Students: The
question papers are set in accordance with OBE capturing various cognitive levels of RBT as well as expected
AC 27 COs. This direct assessment tool of Descriptive Examinations is deployed to test the Cognitive Level of
Students w.r.t. Lower Order Thinking Skills.
GMR Institute of Technology, Quality Management System
Internal Question Paper (GMRIT : QMS)

 A relation
schema R is in second normal form (2NF) if every non-prime attribute A in R is
fully functionally dependent on the primary key
 A functional dependency X->Y is a partial dependency if some attribute A
belong X can be removed from X and the dependency still holds
 If the primary key contains a single attribute, it is 2NF
 Normalization into 2NF:
 If a relation schema is not in 2NF, it can be normalized into a number of
2NF relations where nonprime attributes are associated with only with
the part of the primary key on which they are fully functionally
dependent

Analyze Conflict and View Serializability with suitable example


Answer:

Conflict Serializability (5 marks)


If a schedule S can be transformed into a schedule S´ by a series of swaps of non-conflicting
instructions, we say that S and S´ are conflict equivalent.
We say that a schedule S is conflict serializable if it is conflict equivalent to a serial schedule
Schedule 3 can be transformed into Schedule 6, a serial schedule where T2 follows T1, by series
of swaps of non-conflicting instructions. Therefore it is conflict serializable.

8
Example of a schedule that is not conflict serializable:

We are unable to swap instructions in the above schedule to obtain either the serial schedule <
T3, T4 >, or the serial schedule < T4, T3 >.

View Serializability (5 marks)


Sometimes it is possible to serialize schedules that are not conflict serializable
Form No. AC 27. 00.2018 | GMR Institute of Technology, Rajam, Andhra Pradesh. Note to the Students: The
question papers are set in accordance with OBE capturing various cognitive levels of RBT as well as expected
AC 27 COs. This direct assessment tool of Descriptive Examinations is deployed to test the Cognitive Level of
Students w.r.t. Lower Order Thinking Skills.
GMR Institute of Technology, Quality Management System
Internal Question Paper (GMRIT : QMS)

View serializability provides a weaker and still consistency preserving notion of serialization
Let S and S´ be two schedules with the same set of transactions. S and S´ are view equivalent if
the following three conditions are met, for each data item Q,
1. If in schedule S, transaction Ti reads the initial value of Q, then in schedule S’ also
transaction Ti must read the initial value of Q.
2. If in schedule S transaction Ti executes read(Q), and that value was produced by
transaction Tj (if any), then in schedule S’ also transaction Ti must read the value of Q
that was produced by the same write(Q) operation of transaction Tj .
3. The transaction (if any) that performs the final write(Q) operation in schedule S must
also perform the final write(Q) operation in schedule S’.

A schedule S is view serializable if it is view equivalent to a serial schedule.


Every conflict serializable schedule is also view serializable.
Below is a schedule which is view-serializable but not conflict serializable.

It is equivalent to either <T3,T4,T6> or <T4,T3,T6>


Every view serializable schedule that is not conflict serializable has blind writes.

Analyze the anomalies occurs due to Concurrent Execution of Transactions with suitable
examples
Answer:
Anomaly -1:(3 marks)
9 Lost Update: Explanation with proper example
Anomaly -2:(3 marks)
Dirty read: Explanation with proper example
Anomaly -3:(4 marks)
Incorrect summary: Explanation with proper example
Identify the difference between Write-Ahead Logging, Steal/No-Steal, Force/No-Force, and
checkpoints in the system.
Answer:
Write-Ahead logging: any change to DB element is first recorded in log. The log record is
written to stable storage before DB’s element change is written to disk. .(2 Marks)

Steal: if a frame is dirty and chosen for replacement, the page it contains is written to disk even
if the modifying transaction is still active.
No-Steal: If we place a no-steal policy then commit and abortion of transactions will work
10
properly. But consider, many a transactions executing simultaneously under the umbrella of no-
steal policy and there is a batch transaction which requires large number of pages to be loaded
one after another. As few frames will be allocated to it hence it has to manage within the
limited allocation. Another problem is, due to non-stealing as all pages of a transaction must be
in memory for a commit to happen, and there is no availability of such large numbers of frames.
This will result in locking of many transactions. (3 Marks)

Force: Forcing means that every time a transaction commits, all the affected pages will be
pushed to stable storage. This is inefficient, because each page may be written by many

Form No. AC 27. 00.2018 | GMR Institute of Technology, Rajam, Andhra Pradesh. Note to the Students: The
question papers are set in accordance with OBE capturing various cognitive levels of RBT as well as expected
AC 27 COs. This direct assessment tool of Descriptive Examinations is deployed to test the Cognitive Level of
Students w.r.t. Lower Order Thinking Skills.
GMR Institute of Technology, Quality Management System
Internal Question Paper (GMRIT : QMS)

transactions and will slow the system down.


No-Force: Pages in the buffer pool that are modified by a transaction are not forced to disk
when the transaction commits. (3 Marks)

Check points: A checkpoint is like a snapshot of the DBMS state, and by taking checkpoints
periodically, as we will see, the DBMS can reduce the amount of work to be done during restart
in the event of a subsequent crash. Checkpoint is a mechanism where all the previous logs are
removed from the system and stored permanently in a storage disk. Checkpoint declares a point
before which the DBMS was in consistent state, and all the transactions were committed.
(2 Marks)

Identify the Persistence issues of OODBMS.


Answer: Persistence is the storage of data from working memory so that it can be
restored when the application is run again
• In object-oriented systems, there are several ways in which objects can be made
persistent
• The choice of persistence method is an important part of the design of an application

1.Transient objects
11 (a)
To implement persistence in OODB: schemes
1. Check Pointing:
2. Serialization: The process of writing an object to disk, or loading it from disk.
Serializing usually just simply 'flattens' the object (and its children if they exist) into a
series of bytes that can be sent to a stream (network, disk, etc.)

3. Explicit paging

Form No. AC 27. 00.2018 | GMR Institute of Technology, Rajam, Andhra Pradesh. Note to the Students: The
question papers are set in accordance with OBE capturing various cognitive levels of RBT as well as expected
AC 27 COs. This direct assessment tool of Descriptive Examinations is deployed to test the Cognitive Level of
Students w.r.t. Lower Order Thinking Skills.
GMR Institute of Technology, Quality Management System
Internal Question Paper (GMRIT : QMS)

Identify the Advantages and Disadvantages of OODBMS.


Answer: Identify the Advantages and Disadvantages of OODBMS.(Any 3 -3 Marks)
Advantages of OODBMS:
• enriched modelling capabilities
• extensibility
• more expressive query language
• support for schema evolution
• support for long duration transactions
• applicability to advanced database applications
• improved performance
(b)
Disadvantages of OODBMS: (Any 2 - 2 Marks)
• lack of universal data model
• lack of experience
• lack of standards
• query optimization compromises encapsulation
• locking at object level may impact performance
• complexity
• lack of support for views
• lack of support for security

Course Coordinator / Instructor Head of the Department

Form No. AC 27. 00.2018 | GMR Institute of Technology, Rajam, Andhra Pradesh. Note to the Students: The
question papers are set in accordance with OBE capturing various cognitive levels of RBT as well as expected
AC 27 COs. This direct assessment tool of Descriptive Examinations is deployed to test the Cognitive Level of
Students w.r.t. Lower Order Thinking Skills.

You might also like