0% found this document useful (0 votes)
9 views83 pages

DBMS_DPP

The document consists of multiple-choice questions (MCQs) and answers related to Database Management Systems, focusing on Transaction & Concurrency Control and the Entity-Relationship (ER) Model. It includes questions on serialization of transactions, conflict serializability, and attributes of ER models. The document also provides hints and solutions for the questions presented.

Uploaded by

om717102
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)
9 views83 pages

DBMS_DPP

The document consists of multiple-choice questions (MCQs) and answers related to Database Management Systems, focusing on Transaction & Concurrency Control and the Entity-Relationship (ER) Model. It includes questions on serialization of transactions, conflict serializability, and attributes of ER models. The document also provides hints and solutions for the questions presented.

Uploaded by

om717102
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/ 83

1

Branch : CSE & IT Batch : Hinglish


Database Management System
Transaction & Concurrency Control DPP 02

[MCQ] [MCQ]
1. Consider the following schedule S of transaction T1, T2 4. Consider the following transactions T1 and T2:
and T3. T1 T2
S: r1(x); r2(x); r3(y); w1(x); r2(z); r2(y); w2(y); w1(z); Read(A); Read(A);
Which one of the schedule below is the correct Update A = A + 100;
serialization of the above. Update A = A – 50;
(a) T2  T1  T3 Write(A);
(b) T3  T2  T1 Write(A);
(c) T3  T1  T2 The above transaction has _____.
(d) T2  T3  T1 (a) Lost update problem
(b) Dirty read problem
(c) Unrepeatable read problem
[MCQ]
(d) Incorrect summary problem
2. Consider the transactions T1, T2 and T3 and the
schedules S1 and S2 given below.
[MCQ]
T1: r1(A); r1(C); w1(A); w1(C)
5. Consider the following schedule.
T2: r2(B); r2(C); w2(C) Time T1 T2
T3: r3(B); r3(A); w3(B) t0 Read Item(A);
S1: r1(A); r3(B); r3(A); r2(B); r2(C); w3(B); w2(C); t1 Read Item(A);
r1(C); w1(A); w1(C) t2 A = A + X;
S2: r1(A); r3(B); r2(B); r3(A); r1(C); r2(C); w3(B); t3 Write Item(A);
w1(A); w2(C); w1(C) t4 Read Item(A);
Which one of the following statements about the
Which of the following concurrency problem exists in
schedule is TRUE?
the above given schedule?
(a) Only S1 is conflict serializable. (a) Dirty read (b) Unrepeatable read
(b) Only S2 is conflict serializable. (c) Lost update (d) Both a and b
(c) Both S1 and S2 are conflict serializable.
(d) Neither S1 nor S2 is conflict serializable. [MCQ]
6. ______Problem occurs when a transaction reads data
from a database, then another transaction reads the
[MCQ] same database data, and this particular data is deleted
3. Which of the following schedule is view serializable by an operation of the first transaction.
but not conflict serializable. (a) Dirty read
(a) r1(P); r2(P); w1(P); r2(Q) (b) Unrepeatable read problem
(b) r1(P); w1(P); r2(P); w2(Q) (c) Phantom read
(c) w1(P); w2(P); w1(P); w2(P); w1(P) (d) Lost update problem
(d) None of these.
2

[MCQ] (c) S may or may not be view serializable schedule.


7. Consider a schedule S: (d) None of these
r1(x), r2(y), w2(x), w3(z), r4(z), r3(x), w3(y), r4(x), w4(y)
[MSQ]
Choose the correct statements for the above schedule
S. 9. Choose the correct statements from the following.
(a) To test view serializability we make use of
(a) The schedule S is not serializable.
precedence graph
(b) The schedule S is conflict serializable with (b) To test conflict serializability we make use of
schedule S as T1T2T3T4. precedence graph.
(c) The schedule S is not view serializable. (c) If there exists no blind write and the schedule is
(d) None of the above. not conflict serializable then we can conclude that
it is not view serializable.
(d) All of the above.
[MCQ]
8. Consider the below schedule.
S: r1(A), r2(B), w2(A), r3(A), w1(B) w3(A)
choose the correct statement from the following.
(a) S is conflict serializable schedule.
(b) S is not conflict serializable schedule.
3

Answer Key
1. (b) 6. (c)
2. (a) 7. (b)
3. (c) 8. (b)
4. (a) 9. (b, c)
5. (b)
4

Hints & Solutions


1. (b) T1 T2
Conflict operation are W1(P)
R2(X); W1(X); R3(Y); W2(Y), R2(Z); W1(Z) W2(P)
W1(P)
W2(P)
W1(P)

From precedence graph, the correct serialization order We check for order of read in view serializability. In
is T3  T2 T1 order T2 T1, the schedule is view serializable.

4. (a)
2. (a)
The Transaction T1 first reads data A from the database
S1: r1(A); r3(B); r3(A); r2(B); r2(C); w3(B); w2(C); then transaction T2 reads the same data from the
r1(C); w1(A); w1(C) database. Then T1 Performs an operation to add 100 to
A. Then transaction T2 Performs an operation to
subtract 50 from the data read by T2. i.e., A. T1
performs a write operation to save the value of A
according to changes made to T1. Then T2 performs a
write operation to update the value of A again in the
As there is no cycle is precedence graph DB. This situation causes changes to A made by T1 to
be lost because T2 overwrites A again after T1 update
 S1 is conflict serializable. A. you could also say that the update of T1 is lost.
S2: r1(A); r3(B); r2(B); r3(A); r1(C); r2(C); w3(B); Hence a is correct option.
w1(A); w2(C); w1(C)
5. (b)
In above schedule, T1 reads value of A and then again
reads the value of A. The Ist value of A is different from
other value in 2nd read.
Hence this is called unrepeatable read.
There exists a cycle hence it is not conflict serializable.
Hence, S1 is conflict serializable but S2 is not conflict 6. (c)
serializable. The phantom read problem arises when a transaction
reads a variable once but when it tries to read the same
variable again which was already deleted by other
3. (c) transaction, this problem known as phantom read
A : False problem.

It is conflict serializable, hence it is also view


7. (b)
serializable.
B : False

It is conflict serializable, hence it is also view


serializable.
C : True

It is not conflict serializable, hence checking for view


serializable. for conflict serializability, we check precedence graph.
5

Conflict serial schedule  T1  T2  T3  T4 Cycle in the precedence graph, therefore not conflict
serializable.

9. (b, c)
For checking conflict serializability we make use of
precedence graph. For checking view serializability we
check for 3 conditions.
1. Initial read
2. Updated read
8. (b) 3. Final write
If a schedule is not conflict serializable and there exists
no blind write then we can conclude the schedule is not
view serializable too.

Precedence graph.

Any issue with DPP, please report by clicking here:- https://forms.gle/t2SzQVvQcs638c4r5


For more questions, kindly visit the library section: Link for web: https://smart.link/sdfez8ejd80if

PW Mobile APP: https://smart.link/7wwosivoicgd4


1

Branch : CSE & IT Batch : hinglish


Database Management System
ER Model DPP 01

[MCQ] [NAT]
1. Which of the following statements about ER model 4. Consider the following ER model:
is/are correct?
S1: Relationship sets can have attributes of their
own.
S2: Many to many relationships cannot be
represented in ER diagram.
S3: Multi value attributes and weak entity set
allowed in RDMS.
(a) S1 only (b) S1 and S3 only
(c) S2 and S3 only (d) S1, S2 and S3

[MCQ] Assume X is the minimum number of tables, Y is the


2. Consider the following ERD: total number of attributes in relational tables and Z is
the minimum number of foreign key, then find the
value of X + Y + Z?

[MCQ]
5. Consider the following ER diagram:
Which of the following is the minimum number of
relational table and foreign key required for above
ERD?
(a) 3, 2 (b) 1, 1
(c) 2, 1 (d) None of thee

[MCQ]
3. Consider the following ER model:

How many total attributes required for the minimized


relations of the above ER diagram?
Which of the following is the minimum number of
(a) 14
relational tables and minimum number of foreign key
required for conversion into relational table? (b) 15
(a) 6, 4 (b) 4, 5 (c) 18
(c) 5, 4 (d) 4, 6 (d) None of these
2

[NAT] [MCQ]
6. Consider the following ER diagram 7. Consider the following ER model:

If ‘x’ entries in E1 and ‘y’ entries in E2.


How many entries in relation set (R)?
(a) Exactly y
(b) At most x
Total number of RDBMS table in the above diagram?
(c) Exactly x
(d) at least x and at most m
3

Answer Key
1. (a) 5. (c)
2. (c) 6. (6)
3. (b) 7. (c)
4. (17)
4

Hints & Solutions


1. (a) 3. (b)
Statement S1 is correct. Minimum number of relations tables:
1. E1 R2 (A D B C)
In this table A is P.K and D is F.K referring “E2R4”

2. E2 R4 (D E D1)
In this table D is P.K and D1 taken from self-
referring relation set “R4” and D1 is F.K referring
D in the same table.
In the above ER diagram “Start-Date” is attribute of
relationship set “Manages”. It can be associate to either 3. R1 (A D)
employee or department entity. In this table “AD” is PK and A and D is FK
Statement S2 is incorrect. referring “E1 R2” and “E2 R4”.

4. E3 R3 (D F G H)
In this table “DF” is strong key that is PK and ‘D’
ER diagram represents many students can enroll many is F.K referring table “E2R4”.
courses. Hence, for the given ER diagram we need
Statement S3 is incorrect. minimum 4 relational table and 5 foreign keys.
According to R DBMS guidelines every attributes in
relational table must atomic and table must have atleast
one candidate key (1NF) hence, multivalued attribute
and weak entity sets are not allowed in R DBMS.
It only allowed in ER diagram

2. (c) 4. (17)
I. Minimum number of relational tables: Find the minimum number of relation table:
When the relation between entity set is “many to I. The entity between E1 and E2 have many to many
many” and any one side total participation then mappings and both side total participation so, E1,
relationship merge towards total participation. R1 and E2 will be merged into single relation.
E1 R1 E2 (A B C D E F)
In this table A and D both are candidate key of
relation E1 R1 E2.
II. Between E2 and E3, we have one to one mapping
and both side partial participation. Hence,
relationship R2 can be merge either towards E2 or
E1 (A B C) E2R (A D E F) E3.
Hence, the minimum number of relations are 2.  R2 E3 (G H D)
II. Minimum number of foreign keys: In this table G and D is candidate key and D is FK
referring to table E1 R1 E2.
III. Between E1 and R3, we have many to many
mapping and both side partial participation.
Hence, R3 will have separate table.
Hence, we need minimum 1 foreign key to  R3 (A G)
represent above ERD into relational table
5

In this table “AG” is candidate key and A and G 6. (6)


are FK referring “E1 R1 E2” and “E3 R2”
Hence, X value will be 3
Y value will be 11
Z value will be 3
 X + Y + Z = 3 + 11 + 3 = 17

5. (c)
E1 (A BC) 

R 4 (A K)  E1R 4 E 4 (A BC K L)
E 4 (K L)  Total number of tables = 6
R1 (AD)  R1 (AD)
7. (c)
E2(D E) R3(D F) E3(F G) E5(K F)}
E2 R3 E3 R5 (D E F K G)


R 2 (D1D 2 ) R 2 (D1D 2 )

R 6 (FH) 
 E5 R 6 (FHIJ)
E5 (HIJ) 
Every object of E1 must be related with exactly one
entry of E2.
Hence, option C is correct.

Any issue with DPP, please report by clicking here:- https://forms.gle/t2SzQVvQcs638c4r5


For more questions, kindly visit the library section: Link for web: https://smart.link/sdfez8ejd80if

PW Mobile APP: https://smart.link/7wwosivoicgd4


1

Branch : CSE & IT Batch : Hinglish


Database Management System
ER Model DPP 02

[MCQ] [MSQ]
1. Consider the following relation 3. Consider the relations-
Supervision(EmployeeID, Name, Two relations are given as R1(PaperCode,
SupervisorID)pertaining to a company’s database: NumberofCandidates) and R2(RollNo, Papercode).
EmployeeID Name SupervisorID Assume that each roll no must have only one
1 A 4 papercode but one paper can be chosen by many
2 A 3 candidates. Which of the following is/are
3 B 1 INCORRECT?
4 C 5 (a) Papercode can either act as a primary key and a
5 D 2 foreign key in R2.
6 E 5 (b) Papercode acts as a foreign key in R2.
7 B 3
(c) Papercode satisfies UNIQUE and NOT NULL
8 A 1
constraint R2.
The key SupervisorID acts as a Foreign key in the (d) Papercode allows NULL values in R2.
relation Supervision.
The following operations are performed on the
[NAT]
relation:
4. Consider the following SQL Query:
I: Insert a new employee having
Create table department
EmployeeID==‘9’and Name = A and
SupervisorID as ‘1’; {

II: Set SupervisorID as ‘NULL’ where a integer;


EmployeeID==2 OR EmployeeID==4; b integer;
III: Set SupervisorID as ‘0’ where EmployeeID==1; primary key (a);
Which of the above operation(s) is/are ALLOWED? foreign key (b) reference department ON

(a) I only (b) I and II only DELETE CASCADE

(c) III only (d) I and III only };


The Tuples (a, b) currently in the table department are:
[MCQ] (0, 2) (1, 2) (2, 1) (3, 0) (5, 0) (7, 3) (4, 2) (6, 1)
2. Consider the following statements: Consider the following query
P: At most one foreign key is possible for a relational Delete from department where a = 0
schema. The number of Tuples that must be additionally deleted
Q: A foreign key declaration can always be replaced to preserve referential integrity is _______.
by an equivalent check assertion in SQL.
Which of the following is/are INCORRECT? [NAT]
(a) P only (b) Q only 5. Consider the following relation Supervision
(EmployeeID, Name, SupervisorID) pertaining to a
(c) Both P and Q (d) Neither P nor Q
company’s database:
2

EmployeeID Name SupervisorID Parts


1 A 4 pno pname part_spec
2 A 6 Table Wood
P1
3 B 2
P2 Chair Wood
4 C 5
P3 Table Steel
5 D 2
6 E 3 P4 Almirah Steel
7 B 4 P5 Almirah Wood
8 A 1

The key SupervisorID acts as a Foreign key in the All the items supplied by M/s Balaji Furniture are
relation Supervision. The schema follows “On Delete banned. Moreover, the company no longer sells steel
Cascade” constraint. The employee having items. The schema follows “On Delete Cascade”
EmployeeID ‘5’ is deleted from the relation constraint. Delete all the records from Catalogue where
Supervision. The number of tuples remaining in the sno = S2 OR pno = P3 OR pno = P4. The number of
relation are _______. tuples deleted from the Catalogue relation is
____________.

[NAT] [MCQ]
6. Consider the following relational schemas: 7. Consider the following statements:
Catalogue P: Insertion of tuples into referenced relation may
sno pno cost cause foreign key violation.
S1 P1 150 Q: Insertion of tuples into referencing relation may
S1 P2 50 cause foreign key violation.
S1 P3 100 Which of the following is/are CORRECT?
S2 P4 200 (a) P only (b) Q only
S2 P5 250 (c) Both P and Q (d) Neither P nor Q
S3 P1 250
[MCQ]
S3 P2 150
8. Consider the following statements:
S3 P5 300
P: Updation of tuples into referenced relation may
S3 P4 250 cause foreign key violation.
Q: Updation of tuples into referencing relation may
Suppliers cause foreign key violation.
sno sname location
Which of the following is/are INCORRECT?
S1 M/s Royal furniture Delhi
(a) P only (b) Q only
S2 M/s Balaji furniture Bangalore
M/s Premium furniture Chennai (c) Both P and Q (d) Neither P nor Q
S3
3

Answer Key
1. (b) 5. (3)
2. (c) 6. (4)
3. (a, c, d) 7. (d)
4. (3) 8. (d)
4

Hints & Solutions


1. (b) After the Execution of Query (A = 0 Delete) with on
Since SupervisorID act as a foreign key, the values Delete Cascade (3, 0) (5, 0) (7, 3) will be
entered in SupervisorID must be a proper subset of the additionally deleted. So 3 Tuple additonally deleted.
values in the candidate key EmployeeID.
I: ALLOWED. SupervisorID as ‘1’. 1 belongs to 5. (3)
EmployeeID.
II: ALLOWED. Foreign key allows NULL values. EmployeeID Name SupervisorID
III: NOT ALLOWED. SupervisorID as ‘0’. 0 does 1 A 4
not belong to EmployeeID. 2 A 6
3 B 2
2. (c) 4 C 5
5 D 2
P: INCORRECT. 0 or more foreign keys are
6 E 3
possible for a relational schema.
7 B 4
Q: INCORRECT. A foreign key declaration cannot 8 A 1
be replaced by an equivalent check assertion in
SQL. Check constraint checks if the value
satisfies a given range or not. Foreign keys may 6. (4)
have cascade delete which may not be satisfied Delete all the records from Catalogue where sno = S2
by check assertion. OR pno = P3 OR pno = P4

3. (a, c, d) 7. (b)
(a) INCORRECT: Papercode can act as a foreign key P: INCORRECT. Referenced relation is an
in R2. independent relation. Insertion of tuples into
(b) CORRECT: Papercode can act as a foreign key in referenced relation can never cause foreign key
R2 . violation.
(c) INCORRECT. Since, one paper can be chosen Q: CORRECT. Insertion of tuples into referencing
by many candidates, Papercode CANNOT relation may cause foreign key violation if the
satisfy UNIQUE constraint.
entered value is not a subset of the candidate key
(d) INCORRECT. Each roll no can opt for only one
papercode, so Papercode cannot allow NULL in referenced relation.
values in R2.
8. (d)
P: CORRECT. Updation of tuples into referenced
4. (3)
relation may cause foreign key violation. If the
(0, 2)(1, 2)(2, 1)(3, 0)(5, 0)(7, 3)(4, 2)(6, 1)
candidate key in R1 is updated, then it must be
ensured that either all its instances in R2 is updated
or deleted.
Q: CORRECT. Updation of tuples into referencing
relation may cause foreign key violation if the
entered value is not a subset of the candidate key
in referenced relation.

Any issue with DPP, please report by clicking here:- https://forms.gle/t2SzQVvQcs638c4r5


For more questions, kindly visit the library section: Link for web: https://smart.link/sdfez8ejd80if

PW Mobile APP: https://smart.link/7wwosivoicgd4


1

Branch : CSE & IT Batch : Hinglish

i i n DPP 01

[MSQ] phone → {phone}


1. According to RDBMS rules, choose the correct mail → {Rid, course}
statement from the following. name → {phone, mail, course}
(a) A relation in RDBMS can have multiple attributes
The number of non-trivial FD’s in the given FD set
(b) A relation in RDBMS is a set of rows and columns
is/are?
(c) A tuple in a relation can have multiple values for
an attribute. [MCQ]
(d) All of the above
5. Consider the following set of FD’s:
{V → W, W → XZ, X → YZ} for relation
[NAT]
R(V, W, X, Y, Z)
2. Consider the student relation shown below with
Then the attribute closure of YZ+ contains how many
schema stud (Sname, S age, S mail, S marks),
elements?
Stud
(a) 0 (b) 1
Sname Sage Smail Smarks
(c) 2 (d) 3
Rohit 28 [email protected] 68
Kanika 25 [email protected] 75
[MCQ]
Pankaj 25 [email protected] 75
6. For the given FD set: {P → QT, Q → SU, V → U} of
Rohit 28 [email protected] 88
a relation R (P, Q, T, S, U, V). Find the set of attributes
Anjali 26 [email protected] 75
that is Super key but not a Candidate key?
(a) PTQ (b) PV
For the above given instance how many 2-set of
(c) PQV (d) QV
attributes can determine a row uniquely?
[MCQ]
[MSQ]
7. In a schema with attribute X, Y, Z, W, V, the
3. Consider a relation schema R(A, B, C, D, E, F, H) with
following set of functional dependencies are given:
the given Functional dependency set:
{Y → X, Y → Z, ZW → V, X → W, V → X}.
{A → BC, C → AD, DE → F, C → F}
Which of the following FD is not implied by the
The attribute closure that contains all the attributes of
above set?
the relation R is?
(a) YX → ZW
(a) AE+
(b) XV → YZ
(b) CE+
(c) AEH+ (c) ZW → V
(d) All of the above (d) XV → XW

[NAT] [MSQ]
4. Consider the below relation schema Stud (Rid, name, 8. Choose the correct statement from the following.
course, mail, phone) with FD set as: (a) The cardinality is defined as the number of
Rid → {Rid} attributes in a relation.
Rid → {name, mail} (b) Degree of the relation is the number of tuples in
the relation.
course → {course, phone}
2

(c) Relation instance is the set of tuples of a relation (d) All of the above
at a particular instance of time.

Answer Key
1. (a, b) 5. (c)
2. (1) 6. (c)
3. (c) 7. (b)
4. (3) 8. (c)
3

Hints & Solutions


1. (a, b) 5. (c)
A relation in RDBMS can have multiple The attribute closure of YZ+ = {Y, Z} no other attribute
attributes/fields/Columns but every tuple should be can be determined by YZ+. Therefore only 2 elements
unique. Thus, according to RDBMS guidelines, A
that is Y and Z are in the YZ+ closure.
tuple in a relation cannot have multiple values for an
attribute.
A relation is a table and a table is a set of rows and 6. (c)
columns. The key for the given FD set.
{P → QT, Q → SU, V → U}
2. (1) PV+ = {P, Q, T, V, U, S}
We can clearly observe that none of the attribute can
PVQ+ = {P, Q, T, V, U, S}
determine a tuple uniquely (Single attribute), if we
check for 2-attribute set then only (Sname, Smarks) PTQ+ = {P, T, Q, S, U}
can determine a row uniquely for the instance. So the QV+ = {Q, V, S, U}
answer is 1. we have PV+ as the candidate key and also it is the
super key. PVQ+ is the super key but it is not a
3. (c) Candidate Key (not minimal set)
The attribute closure AE+ = {A, B, C, D, E, F}. NOTE: A candidate key is minimal set of attributes that
The attribute closure CE+ = {C, E, A, B, D, F}.
determine relational table uniquely. Also, every
But the attribute H is missing from the closure.
The attribute closure AEH+ = {A, B, C, D, E, F, H}. candidate key is a Super key but every Super key need
Therefore, C is the correct answer. not be Candidate.
7. (b)
4. (3) YX+ = {Y, X, Z, W, V}
Trivial FD’s: 2 ie Rid → Rid and phone → phone. XV+ = {X, V, W}
Non-trivial FD’s: 3 i.e. Rid → {name, mail}, ZW+ = {Z, W, V, X}
mail → {Rid, course) and name → {phone, mail, XV+ = {X, V, W}
course}.
8. (c)
Semi-non trivial FD’s: 1 i.e. course → {course,
• Cardinality is defined as the number of tuples in a
phone}.
relation.
• Degree is defined as the number of attributes in a
relation.
• Relation instance is the set of tuples of a relation at
a particular instance of time.

Any issue with DPP, please report by clicking here:- https://forms.gle/t2SzQVvQcs638c4r5


For more questions, kindly visit the library section: Link for web: https://smart.link/sdfez8ejd80if

PW Mobile APP: https://smart.link/7wwosivoicgd4


1

Branch : CSE & IT Batch : Hinglish

FD's & Normalization DPP 02

[MSQ] [MCQ]
1. Choose the correct statement from the following: 5. Choose the incorrect statement from the following
(a) There can be many primary keys for a relation. (a) All super keys cannot be primary key.
(b) There can be many alternate keys for a relation. (b) We choose the minimal candidate key to be a
(c) All the candidate keys are also super keys. primary key.
(d) All the super keys are also the candidate keys. (c) The number of super keys are equal to the number
of primary keys for a relation.
[NAT] (d) None of the above.
2. Consider the below instance of relation:
Employee: [NAT]
Emp_rating Emp_name Emp_mail Emp_sal 6. Suppose a relation R has 9 attributes, then the
1 Rohit p@pw 40000 maximum possible number of candidate keys are?
2 Kanika c@pw 60000
1 Rohit Null 50000 [MSQ]
3 Pankaj g@pw 60000 7. For all given set of FD’s find the primary key from
The maximum possible number of alternate keys for the options below, for relation R (A, B, C, D, E, F)
the above relational instance is/are _____. {A → D, C → BDE, B → F, B → C}
(a) AC could be the primary key.
[MCQ] (b) There are two candidate keys AC and AB.
3. Consider the set of functional dependencies for a (c) BC is the primary key.
relation R(D, N, C, S) (d) No primary key exists for the relation.
{D→N, D→C, D→S, C→S}
Then choose the correct statement regarding the above [MCQ]
set. 8. Consider a relation R (A B C D E F), on this relation
(a) {D} is the superkey for the relation. how many maximum number of candidate keys are
(b) {DN} is the candidate key for the relation. possible?
(c) {DC} is the candidate key for the relation. (a) 8 (b) 12
(d) {CN} is the superkey for the relation. (c) 16 (d) 20

[NAT]
4. Consider the given FD set for relation
R (X, Y, Z, W, U, V)
{X → Y, YZ → W, U → Z, W → X}
Then the number of prime attributes for the relation
are?
3

Answer Key
1. (b, c) 5. (c)
2. (3) 6. (126)
3. (a) 7. (a, b)
4. (5) 8. (d)
4

Hints & Solutions


1. (b, c) Non-prime attribute is {z}.
I. There exists exactly at most one primary key for
any relational table while there can be multiple 5. (c)
alternate keys for a relation.
All super keys cannot be primary key. For a relation the
II. All the candidate keys are super keys, but it is not
compulsory that all super key are candidate number of super keys are more than number of primary
keys. keys.
NOTE: A candidate key is minimal set of attributes
that determine relational table uniquely. Also, every 6. (126)
candidate key is a Super key but every Super key For a relation with n attributes, the maximum number
need not be Candidate.
of candidate keys will be nC n
 2 
2. (3)
An alternate key is one that is not the primary key. It
n = 9, therefore 9C  9   9C 4
allows null values. So, the alternate/candidate key for  2 
given relation is/are: {Emp_mail} {Emp_rating,
Emp_sal}, and {Emp_name, Emp_sal}   8  7  6  5! 9  3 7  6
  = 42  3 = 126
4!  5! 4  3 2
3. (a)
{D → N, D → C, D → S, C → S}
the candidate keys of the relation are: 7. (a, b)
D+ = {D, N, C, S}  There can be at most one primary key for a relation.
C+ = {C, S}  There exists two candidate keys i.e. AC and AB out of
S+ = {S}  these two only one is selected to be the primary key.
N+ = {N} . So, option (a) and (b) is correct choice.
{D} is the candidate key as well as the super key.
{DN} and {DC} are the super keys not the candidate
key. 8. (d)
{CN} is not any key. n=6
 Maximum candidate keys = nC  n 
4. (5)  2 
In order to find the prime attributes, we first find the
6  5  4  3!
candidate keys for the relation as prime attributes are 6
C  6   6C 3  = 20
 2  3! 3  2  1
part of Candidate Key.
The candidate keys are: XUV, YUV, WUV
So the prime attributes are {X, Y, W, U, V}

Any issue with DPP, please report by clicking here:- https://forms.gle/t2SzQVvQcs638c4r5


For more questions, kindly visit the library section: Link for web: https://smart.link/sdfez8ejd80if

PW Mobile APP: https://smart.link/7wwosivoicgd4


1

Branch : CSE & IT Batch : Hinglish


DBMS
FD’s & Normalization DPP 03

[MCQ] B→D
1. Consider the relation R (P, Q, R, S, T) and the set of E→A
function dependencies F = {P →Q, QR →T, TS→P}. Which of the following functional dependencies is
Which of the following is not the candidate key of R? implied by the above set?
(a) RST (b) PRS (a) CD→AC (b) BC→CD
(c) QRS (d) PQR (c) AC→BC (d) BD→CD

[NAT] [MCQ]
2. Assume a relation R (P, Q, R, S, T) with the set of 6. Assume the relation R that has eight attributes
functional dependencies {P→Q, Q→R, R→Q and ABCDEFGH. Let A = {CH→G, A→BC, B→CFH,
Q→T}. how many candidate keys are possible in R? E→A, F→EG} is a set of functional dependencies
(FD). How many candidates key does the relation R
[MCQ] have?
3. Consider the following statements: (a) 2 (b) 3
S1: A key in DBMS is an attribute (or) a set of (c) 4 (d) 5
attributes that help to uniquely identify a tuple (or
row) in a relation (or table). [MCQ]
S2: There should be only one candidate key in 7. Assume the relation schema R(P, Q, R, S, T, U, V, W,
relation, which is chosen as the primary key. X, Y, Z) and the set of functional dependencies on R:
(a) Only S1 is true. F = {PQ→R, Q→UV, PT→WX, W→Y, X→Z}.
(b) Only S2 is true. Which of the following can be candidate key for R?
(c) Both S1 and S2 are true. (a) PQU (b) PQT
(d) Neither S1 nor S2 is true. (b) PQTR (d) PQTWX

[MSQ] [MCQ]
4. Choose the correct statements from the following: 8. Consider the following statements:
(a) The minimal set of attributes that can uniquely S1: Primary key has no duplicate values it has only
identify tuple is known as a candidate key. unique values.
(b) A super key is a group of single or multiple keys S2: Primary key are not necessary to be a single
that identifies rows in a table. It supports NULL column more than one column can also be a
values. primary key for table.
(c) Primary key is not a unique key. (a) Only S1 is true.
(d) None of the above. (b) Only S2 is true.
(c) Both S1 & S2 are true.
[MSQ] (d) Neither S1 nor S2 are true.
5. Consider a schema with attributes A, B, C, D & E
following set of functional dependencies are given,
A→B
A→C
CD→E
2

[MSQ]
9. Choose the correct statements about candidate key.
(a) Candidate key is a super key with maximum
attributes.
(b) It must contain unique values.
(c) A table can have multiple CK’s but only one
primary key.
(d) It is a super key with no repeated data which is
called a candidate key.
3

Answer Key
1. (d) 6. (c)
2. (1) 7. (b)
3. (a) 8. (c)
4. (a, b) 9. (b, c, d)
5. (a, b, c)
4

Hints & Solutions


1. (d) (b) Closure of BC = ABCDE, therefore BC→CD can
RS is not present in RHS of all the FDS therefore RS be derived from the given set of FD’s.
must be the part of candidate key. So, using option
(c) Closure of AC = ABCDE, therefore AC→ BC can
elimination, option (d) is eliminated because PQR does
not contain RS therefore it cannot be a candidate key, be derived from the given set of FD’s
hence option “d” is the answer. (d) Closure of BD = BD, therefore BD→CD can’t be
derived from the given set of FD’s.
2. (1)
P→Q 6. (c)
Q→R NOTE: If closure of any attribute includes all the
R→Q attributes of a table then it is a superkey and minimal
Q→T
superkey is called a candidate key, find closure of each
So {PS}+ = {P Q R S T} so PS is candidate key.
Only PS is candidate key, hence 1 is the answer. attribute set. D cannot be derived using the left side of
FD. hence, D will definitely be part of the candidate
3. (a) key.
S1: True: A key in DBMS is an attribute (or) a set of AD+ = ABCDEFGH
attributes that help to uniquely identify a tuple (or BD+ = ABCDEFGH
row) in a relation (or table).
S2: False: There can be more than one candidate key CD+ = CD
in relation out of which one can be chosen as D+ = D
primary key. ED+ = ABCDEFGH
FD+ = ABCDEFGH
4. (a, b)
GD+ = GD
(a) Candidate key: It is a minimal set of attributes that
HD+ = HD
can uniquely identify a tuple is known as
Thus, there are 4 candidates keys AD, BD, ED and FD.
candidate key.

7. (b)
Example: Passport_No, Employee_ID, Roll_No
Simply find the closure of all the options given, as we
(b) Super key: super key is an attribute (or set of
can see PQT cannot be derived from any of the above
attributes) that is used to uniquely identify all
FDS which states that P, Q & T must be present in the
attributes in a relation.
key. Hence, we need to verify only b, c & d by taking
Note: The difference between superkey and a closure set PQT+ derives all attributes in relation R. so
primary key is as follows: it is candidate key.
(i) Super key’s attributes can contain NULL. NOTE: option (c) & (d) are the super keys, since
(ii) Primary key is a minimal super key hence all adding zero or more attributes to C.K generates super
super keys can’t be primary key. key.

(c) primary key is a unique key. 8. (c)


• Primary key has no duplicate values it has only
5. (a, b, c) unique values. Hence S1 is true.
Find the closure set of left side of each FD of every • Primary key is not necessarily to be a single
option given. If the closure set of left side contains the column more than one column can also be a
right side of the FD, then the particular FD is implied primary key for the table. Hence S2 is true.
by the given set.
(a) Closure of CD = ABCDE, Therefore CD→AC 9. (b, c, d)
can be derived from the given set of FD’s. (a) candidate key is super key with minimal attributes.
5

Any issue with DPP, please report by clicking here:- https://forms.gle/t2SzQVvQcs638c4r5


For more questions, kindly visit the library section: Link for web: https://smart.link/sdfez8ejd80if

PW Mobile APP: https://smart.link/7wwosivoicgd4


1

Branch : CSE & IT Batch : Hinglish

Database Management System


FD's & Normalization DPP 04

[MCQ]
1. Consider the following two sets of functional [NAT]
dependencies 5. Let a relation R have attributes {P, Q, R, S, T} and
X = {P→Q, Q→R, R→P, P→R, R→Q, Q→P} “PQR” is the candidate key, then how many super keys
Y = {P→Q, Q→R, R→P} are possible ________?
Which of the following is true?
(a) X  Y (b) Y  X [MCQ]
(c) X  Y (c) X  Y 6. Consider the following FD sets:
S1 = {P→R, PR→S, T→PS, T→U}
[NAT] S2 = {P→S, QR→PS, R→Q, T→P, T→S, T→U}
2. Consider a relation with schema R(P, Q, R, S, T) and S3 = {P→S, R→P, R→Q, T→PU}
FD set (PQ→R, R→S, S→P). How many super keys Which of the following sets is equivalent?
in relation R contains?____. (a) S1  S2 (b) S2  S3
(c) S1  S3 (d) S1  S2  S3
[NAT]
3. Consider a relation R(P, Q, R, S, T) with the set of [NAT]
functional dependencies {P→QR, RS→T, Q→S, and 7. Consider a relation R = {P, Q, R, S, T, U, V, W} with
T→P}. How many super keys are possible in R? the functional dependency sets S = {PR→V, S→TV,
_____. QR→S, RV→QS, PRS→Q, RT→PV}
The minimum numbers of simple functional
[MCQ] dependency in the minimal cover of F is _________?
4. Consider the relation schema R(P, Q, R, S, T, U, V, W,
X, Y) and the set of functional dependencies on R are: [NAT]
F = {PQ→R, Q→TU, PS→VW, V→X, W→Y}. 8. Consider a relation R(P, Q, R, S, T) with the following
Which of the following can be the candidate key for R? functional dependencies: PQR→ST and S→PQ, then
(a) PQT (b) PQS the number of super keys in R is_______?
(c) PQSR (d) PQSVW
2

Answer Key
1. (c) 5. (4)
2. (7) 6. (b)
3. (27) 7. (6)
4. (b) 8. (10)
3

Hints & Solutions


1. (c) Point to be noted that, option (c) & (d) are the super
To check, find minimal canonical cover of both the FD keys, since adding zero or more attributes to candidate
sets. FD set Y is already a minimal cover. In X, P→Q, key generates super key.
Q→R, So P→R is redundant FD (through transitivity),
and also Q→R, R→P, So Q→P is also redundant FD. 5. (4)
so, we can remove it from F, then after removing it will PQR is candidate key, remaining attributes → S, T with
be X  Y.
S, T four possibilities hence 4 super keys are possible.

2. (7)
6. (b)
Candidate keys: PQT, QST, QRT
Super keys: Candidate key for S1 = T, closure of T+ = {P, Q, R, S,
PQT: PQT, PQRT, PQST, PQRST T, U}
QST: QST, PQST, QRST, PQRST Candidate key for S2 = RT closure of RT+ = {P, Q, R,
QRT: QRT, PQRT, QRST, PQRST S, T, U}
Total distinct super keys are PQT, QST, QRT, PQRT, Candidate key for S3 = RT closure of RT+ = {P, Q, R,
PQST, QRST, PQRST. Therefore, correct answer is 7.
S, T, U}
So, S2 as S3 are equivalent.
3. (27)
P→QR
7. (6)
RS→T
A FD A→B is a simple FD if B is a single attribute:
Q→S
Step 1:
T→P
Simplify all the given FD’s
Candidate key {P, RS, QR, T}
PR→V
{P}+ = {P Q R S T}
{T}+ = {P Q R S T} S→T
{RS}+ = {P Q R S T} S→V
{QR}+ = {Q R S T P} QR→S
So total super key on R for 5 attributes is 25 – 1 = 31 RV→S
Q, R, S and QS are not super keys RV→Q
31 – 4 = 27 PRS→Q
Hence there are 27 super keys.
RT→P
RT→V
4. (b)
Step 2:
firstly, find the closure of all the options given above.
As we can see that P, Q, and S cannot be derived from Find out extraneous attributes present in FD.
any of the above functional dependencies given which PRS → Q: (PR)+ → PRVQ, So we get Q, S is
states that P, Q and S should be present in the key. extraneous and can be safely removed, rewriting the
Therefore, we need to check only the closure set of new FD as PR→Q.
option b, c and d which contains these three. Since PR→V: P+→P, so can’t get V; R is not extraneous,
PQS+ derives all the attributes in the relation R, So R+→ R, so, count set V; P is not extraneous. Hence,
clearly, it’s a candidate key. keep this FD as it is.
4

QR→S: Q+→Q, so can’t get S R is not extraneous Step 4:


R+→R, so can’t set S, Q is not extraneous keep this FD 1) S→T
as it is. 2) S→V
RV → Q: R+→ R, so can’t get Q; V is not extraneous 3) QR→S
V → V, so, can’t get Q; R is not extraneous keep this
+
4) RV→Q
FD as it is.
5) PR→Q
RV→S; R+→R, so can’t get S; V is not extraneous
6) RT→P
V+→V so can’t get S; R is not extraneous so keep this
The minimum number of simple FDs in the minimal
FD as it is.
cover of F is 6.
If we continue the step 2, we will not find any
extraneous attribute on LHS of any FD. So, we are done
with step 2. 8. (10)
Consider a relation R have attributes {x1, x2, x3....xn}
and the candidates’ keys are “x1x2”, “x1x3” then
Step 3:
possible number of super keys = super keys of (x1, x2)
Find Redundant FD’s + super keys of (x1, x3) – super keys of (x1, x2, x3)
(PR)+ → PRQSTV; so, we got V from other FDs  2(n - 2) + 2(n - 2) – 2(n -3)
remove the entire FD from list. The candidate keys of relation are PQR and SR.
(RV)+ →RVSTPQ; So, we get Q from other FD’s The number of super keys of (PQR) = 2(5-3) = 4
remove the entire FD from the list. The number of super keys of (RS) = 2(5 - 2) = 8
(RT)+ →RTVS; so, we did not get P from other FDs, The number of super keys of (PQRS) = 2(5 - 4) = 2
so keep this FD in the lists. Then possible number of super keys = 4 + 8 – 2 = 10
ie, PQR, PQRS, PQRT, PQRST, RS, PRS, QRS, RST,
(RT)+ →RTPQSV; so we got V from other FDs, hence,
PRST, QRST.
remove this FD from the list.

Any issue with DPP, please report by clicking here:- https://forms.gle/t2SzQVvQcs638c4r5


For more questions, kindly visit the library section: Link for web: https://smart.link/sdfez8ejd80if

PW Mobile APP: https://smart.link/7wwosivoicgd4


1

Branch : CSE & IT Batch : Hinglish

Database Management System


FD's & Normalization DPP 05

[MCQ] Which of the following is True?


1. Assume a relation R = (P Q R S T U) and functional (a) 1 is lossy but 2 is lossless
dependencies: F = {PQ  RU, RT  Q, U  S}, (b) 1 is lossless but 2 is lossy
consider the following two statements: (c) Both 1 and 2 are lossless
S1: The decomposition of R into PQRT and PQSTU (d) Both 1 and 2 are lossy
is a dependency preserving decomposition.
S2: The decomposition of R into PQRT and PQSTU [MCQ]
is a lossless decomposition. 4. Consider a relation R(P, Q, R, S, T, U, V, W) be a
Which of the statement is/are TRUE? relation schema, in which of the following FD sets are
(a) Only S1 is true. known to hold = {P  Q, P  R, P  S, PT  W,
(b) Only S2 is true. T  S, T  U}. Suppose we decompose the relation
(c) Both S1 and S2 are true. into two relations, R1(PQRS), and R2(STUVW). The
(d) Both S1 and S2 are false. above decomposition is
(a) lossless join and dependency preserving.
[MCQ]
(b) lossless join but not dependency preserving.
2. Consider the following two decomposition of R(P Q R
(c) dependency preserving but not lossless join.
S T U) with the set of dependencies
(d) neither dependency preserving nor lossless join.
F = {PQ  R, PR  Q, PS  T, Q  S, QR  P,
T  U}.
[MCQ]
S1: R1(PQ), R2(QR), R3(PQST), R4(TU) 5. Let R(P, Q, R, S, T, U) be a relational schema, in which
S2: R1(PQR), R2(PRST), R3(PSU) of the following FD’ sets are known to hold {PQ  R,
Which of the statements is are dependency preserving PR  Q, PS  T, QR  R, Q  U}
and lossless-join decomposition of R? Suppose we decompose the relation R into four
(a) S1 Only (b) S2 Only relations R1(PQ), R2(QR), R3(PQST) and R4(TU).
(c) Both S1 and S2 (d) None of these Then the above decomposition is:
(a) dependency preserving and lossless join.
[MCQ] (b) lossless join but not dependency preserving.
3. Consider a relation STUDENT (Name, Subject, (c) dependency preserving but not lossless join.
Location, Marks).
(d) neither dependency nor lossless join.
Name Subject Location Marks
Madhav Operating System Noida 96 [MCQ]
Madhav DBMS Noida 100 6. Consider the following statements
S1: The decomposition R1, R2 ….. Rn for a relation
Student is decomposed into following schema R are said to be lossless if their natural
1. STU Sub 1 (Name, Subject, Location) and STU Sub 2 join results in the original relation R.
(Name, Location, Marks). S2: The decomposition R1, R2 ….. Rn for a relation
2. STU Sub 1 (Name, Location) and STU Sub 2 schema R are said to be lossy if their natural join
(Subject, Marks). results into addition of extraneous tuples with the
original relation R.
2

(a) Only S1 is true (c) TUV  W (d) U  VW


(b) Only S2 is true
(c) Both S1 and S2 are true [MCQ]
(d) Neither S1 nor S2 are true 8. Which are the major and important properties of FD’s?
(a) There should be one to one relationship between
[MCQ] attributes in FDs.
7. Consider the relation R(P, Q, R, S, T, U, V, W) with (b) FDs must be defined in schema.
the following set of functional dependencies: (c) FDs should be non-trivial.
F = {P  QRS, P  T, TUV  W and U  VW} (d) All of the above
Which one of the FD in the F is redundant?
(a) P  QRS (b) PS  T
3

Answer Key
1. (c) 5. (d)
2. (d) 6. (c)
3. (d) 7. (c)
4. (d) 8. (d)
4

Hints & Solutions


1. (c) decomposed relation and then perform joining
S1: True – PQ  R and RT  Q are preserved in operation again if there is extra tuples then that
PQSTU. decomposition is lossy.
S2: True – PQRT  PQSTU = PQT and PQT 
PQRT which is the candidate key of PQR T STUSub1
relation. Name Subject Location
Madhav OS Noida
2. (d) Madhav DBMS Noida
S1 :
P Q R S T U STUSub2
R1   Name Location Marks
R2   Madhav Noida 96
Madhav Noida 100
R3      
R4  
STUSub1 ⋈ STUSub1
This is lossless join decomposition Name Subject Location Marks
Now checking for dependency preserving Madhav OS Noida 96
Madhav DBMS Noida 100
PQ  R, only trivial FD’s hold in R, (PQ) and R2
Madhav OS Noida 96
(Q, R) and FD holds in R3 (PQST) = {T  U}. Let it
Madhav DBMS Noida 100
be F1 and FD holds in R4 (TU) = {T  U}. Let it be
F2 .
Lossy because we have extra tuples in the relation.
Now F+ = (F1  F2) +

(PQ)+ = PQR but (F1  F2)+ will not contain R. So this 4. (d)
is not dependency preserving. {P  Q, P  R, P  S, PT  W, T  S, T  U}
S2 : P Q R S T U V W
P Q R S T U R1    
R1    R2     

R2      
PT  W is not preserved
R3      Therefore, its neither dependency preserving not
R4     lossless

This is lossless join decomposition 5. (d)


Now checking for dependency preserving check for P Q R S T U
FD Q  S R1  
R2  
F+ = (Q)+ = {Q, S} this will no be preserved in any
R3    
relation as (F1  F2)+ will not contain U.
R4  

3. (d)
Neither lossless nor dependency preserving
A decomposition is lossy if after joining, relation
 (d) is correct option.
contains extra tuple, divide the table according to
5

6. (c) (c) {US}+ = VW, so remaining T and V from FD So


S1 (True): The decomposition R1, R2 …. Rn for a resultant FD is U  W
relation schema R are said to be lossless if their natural (d) U  VW = {U  V, U  W}
join results the original relation R. So, U  W is redundant because it can be derived
S2 (True): The decomposition R1, R2 …. Rn for a from FD U  VW.
relation schema R are said to be lossy if their natural
join results into addition of extraneous tuples with the 8. (d)
original relation R.
(a) There should be one to one relationship between
attribute in FD’s.
7. (c) (b) FD’s must be defined in schema
(a) P  QRS {P  Q, P  R, P  S} (c) FD’s should be non-trivial
(b) PS  T, now closure of P has S so S is extraneous Hence, option (d) is correct.
attribute. So remove S then resultant FD is P  T

Any issue with DPP, please report by clicking here:- https://forms.gle/t2SzQVvQcs638c4r5


For more questions, kindly visit the library section: Link for web: https://smart.link/sdfez8ejd80if

PW Mobile APP: https://smart.link/7wwosivoicgd4


1

Branch : CSE & IT Batch : Hinglish


Database Management System
FD's & Normalization DPP 06

[MCQ] [MSQ]
1. Assume a relation R(P, Q, R, S, T) with the following 5. Consider the following relation R(P, Q, R, S) and
functional dependencies functional dependencies F that hold over the relation
{PQ → RST, P → R, Q → S}. which of the following F = {P → QS, RS → Q, R → S, Q → PS}. The relation
decomposition of R satisfies BCNF? R is in which of the following normal form?
(a) R1 (P, R), R2(Q, S), R3(P, Q, R, S, T) (a) 1NF (b) 2NF
(b) R1(P, R), R2(Q, S), R3(P, Q, R, T) (c) 3NF (d) BCNF
(c) R1(P, R), R2(Q, S), R3(P, Q, S, T)
(c) R1(P, R), R2(Q, S), R3(P, Q, T) [MCQ]
6. Consider a relation which contains two different true
[MCQ] multivalued dependencies then which of the following
2. Assume a relation R = (P, Q, R, S) and a set F of normal form is violated automatically.
functional dependencies: (a) 2NF (b) 3NF
F = {PR → S, S → P, S → Q, S → R}, Highest normal (c) BCNF (d) 4 NF
form satisfied by the relation R is?
(a) 2NF (b) 3NF [MCQ]
(c) BCNF (d) 1NF 7. Assume a relation R(P, Q, R, S, T, U) with the
following dependencies
[MCQ] 1. PQ → RS 2. T → R 3. Q → TU
3. Assume the relation R(P, Q, R, S, T) with candidate Given the functional dependencies as shown above
key PQ is in atleast 3NF. which of the following which among the options shows the decomposition of
functional dependencies given in option are invalid? relation R is normalized to 3NF?
(a) R1(P, Q, R, S, T, U) R2(T, R) R3(Q, T, U)
(a) PQ → R (b) ST → Q
(c) PQ → S (d) RS → T (b) R1(P, Q, R, S) R2(R, T) R3(T, U, Q)
(c) R1(P, Q, R, S) R2(R, T) R3(Q, T, U)
[MSQ]
(d) R1(P, Q, S), R2(T, R) R3(Q, T, U)
4. State which of the following statements is/are true?
(a) Normal forms are used to eliminate or reduce
redundancy in database tables. [MCQ]
(b) A relation is in first normal form if every attribute 8. Given the relation ‘R’ with attributes PQRST with set
in that relation is singled valued attribute or No of functional dependencies {P → P Q R S T, Q → R}
Multivalued Attribute. which of the following is / are true?
(c) A relation is in 2NF if every candidate key is (a) R1(PRST) R2(QR) are both in BCNF and
simple candidate key. preserves lossless join.
(d) A relation R is in BCNF, if R is in 3rd normal form (b) R1(PQST), R2(QR) are both in BCNF and
and for every functional dependency, LHS is preserves lossless join
super key. A relation is in BCNF iff in eveiy non- (c) R1(PST), R2(QR) are both in BCNF and preserves
trivial functional dependency P -> Q, where P is a lossless join.
super key. (d) None of the above.
2

Answer Key
1. (d) 5. (a, b)
2. (c) 6. (d)
3. (d) 7. (d)
4. (a, b, c, d) 8. (b)
3

Hints & Solutions


1. (d) LHS is super key. A relation is in BCNF iff in
If decomposition is lossless and every individual every non-trivial functional dependency
relation satisfy BCNF, then decomposition satisfy P → Q, where P is a super key.
BCNF.
(a) The Decomposition R1(P, R), R2(Q, S), R3(P, Q, 5. (a, b)
R, S, T) is lossless, but individual relation R3 does The candidate key of relation is R, therefore relation
not satisfy BCNF because of FD P → R and does not contain violation of 2NF.
Q → S. Hence, highest normal form is satisfied by the relation
(b) The Decomposition R1(P, R), R2(Q, S), R3(P, Q, is 2NF, so it is also satisfies 1NF.
R, T) is lossless, but individual relation R3 does
not satisfy BCNF because of FD P → R. 6. (d)
(c) The Decomposition R1(P, R), R2(Q, S), R3(P, Q, If there consist a true / real multivalued dependencies
S, T) is lossless, but individual relation R3 does in a relation then that relation automatically violates
not satisfy BCNF because of FD Q → S. 4NF.(we need not check MVD’s in 1NF, 2NF, 3NF and
(d) The Decomposition R1(P, R), R2(Q, S), R3(P, Q, T) BCNF)
is lossless, and individual relation R3 also satisfy
BCNF. Therefore, this decomposition is in BCNF. 7. (d)
NOTE: If a relation has only two attributes then it is in For the given FD set, the minimal cover will be:
BCNF. Therefore R1 and R2 is in BCNF in all the PQ → R
options given above. PQ → S
T→R
2. (c) Q→T
PR and S are the super key of the relating. LHS of each
Q→U
FD is super key therefore highest normal form satisfied
by R is BCNF. Minimal cover:
PQ → S
3. (d) T→R
Given, PQ is a composite candidate key. hence prime Q→T
attributes are P and Q. A relation is said to be in 3NF, Q→U
if it is in 2NF and if there exists FD α → β, then either
Candidate key = {P, Q}
α is a super key or β is prime attribute. In functional
PQ → S Satisfy 3NF
dependency RS → T, neither α is super key nor β is
prime attribute. Hence this functional dependency is T → R does not satisfy 3NF
invalid. Q → T does not satisfy 3NF
Q → U does not satisfy 3NF
4. (a, b, c, d)
a: true: Normal forms are used to eliminate or reduce  Those which have same left-hand side will make
redundancy in database tables. relation.
R1(P, Q, S) R2(T, R), R3(Q, T, U)
b: true: A relation is in first normal form if every
attribute in that relation is singled valued 8. (b)
attribute. For BCNF decomposition, the relation is created for
c: true: A relation is in 2NF if every candidate key is those FD which violates BCNF property. So relation
a simple candidate key. is made for QR and remove R from relation and create
two relation R1(PQST), R2(QR) and this
d: true: A relation R is in BCNF, if R is in 3rd normal decomposition is lossless.
form and for every functional dependency,
4

Any issue with DPP, please report by clicking here:- https://forms.gle/t2SzQVvQcs638c4r5


For more questions, kindly visit the library section: Link for web: https://smart.link/sdfez8ejd80if

PW Mobile APP: https://smart.link/7wwosivoicgd4


1

Branch : CSE & IT Batch : Hinglish


Database Management system
FD's & Normalization DPP 07

[MCQ]
1. Consider the following two relational schemas [MCQ]
Schema 1: R (P, Q, R, S) 4. Consider the following statements
Schema 2: R1(P, Q, R) R2(Q, S) and the following S1: If the proper subset of candidate key determines
statements. non-prime attribute, then it is violation case of
S1: If the only functional dependencies that hold on 2NF.
the relation in the schema 1 are P → Q, R → S, S2: If P→Q and Q→R are two FD’s then P→Q is
then relation R is in BCNF. known as transitive dependency
S2: If the only FD that hold on the relation in the Which of the statements are/is true?
schema 2 are P→Q, P→R, Q→P, P→S then the (a) Only S1 (b) Only S2
relation R1 and R2 are in BCNF. (c) Both S1 and S2 (c) Neither S1 nor S2
Which of the following statements are true?
(a) Only S1 is true [MCQ]
(b) Only S2 is true. 5. Consider the following statements about Boyce – Codd
(c) Both S1 & S2 are true Normal Form (BCNF)
(d) Neither S1 nor S2 are true S1: The determinant for each functional dependency
must be a super key.
[MCQ] S2: Transitive dependencies does not result in
2. Assume that a relation is in 3NF under which of the abnormalities in a relation in BCNF.
following conditions R can violate BCNF? (a) Only S1 is true
(a) The table consists two candidate keys that share a (b) Only S2 is true
common attribute. (c) Both S1 and S2 are true
(b) The table consists of two non-overlapping (d) Neither S1 nor S2 is true
candidate keys.
(c) The table has a unique candidate key consisting of [MCQ]
one attribute. 6. Consider a table/Relation R has one candidate key, then
(d) The table consists of two candidate keys each which of the following is always true?
consisting of one attribute. (a) If R is in 2NF, then it is also in 3NF
(b) If R is in 3NF, then it is also in BCNF
[MCQ] (c) If R is in 2NF, but it is not in 3NF
3. Consider a relation R(P, Q, R, S, T, U, V, W) with the (d) None of the above.
following functional dependencies:
{RW→V, P→QR, Q→RUW, T→P, U→TV}, then the [MSQ]
relation R is in _______. 7. Let’s suppose, dependencies have to be preserved and
(a) 1NF (b) 2NF BCNF decomposition is not possible. Which of the
(c) 3NF (d) BCNF following normal forms can be still achievable (while
preserving dependencies)?
(a) 1NF (b) 2NF
(c) 3NF (d) 4NF
2

[MCQ]
8. Consider a relation R(P, Q, R, S, T) with the set of FD’s
{PQR→ ST and T → QRS} which of the following
statements is true?
(a) R is not in 2NF
(b) R is in 2NF but not in 3NF
(c) R is in 3NF but not in BCNF
(d) R is in BCNF
3

Answer Key
1. (b) 5. (c)
2. (a) 6. (b)
3. (a) 7. (a, b, c)
4. (a) 8. (a)
4

Hints & Solutions


1. (b) S1(True):
S1(False): A determinant must be either a candidate key or a super
The candidate key of schema 1 is PR, therefore both key for each functional dependency.
FD violates the BCNF property, so schema 1 is not in S2(True):
BCNF. In 3NF we remove transitive dependency, and every
S2(True): BCNF is in 3NF.
The candidate key of R1 is P, Q and R2 is Q in schema2,
6. (b)
therefore, relation R1 & R2 are in BCNF
If there is only one candidate key and relation is 3NF,
that means all functional dependency determinants is
2. (a) Candidate key thus relation is in BCNF, Hence, option
Let us take an relation R(P, Q, R, S) with FD Set = (b) is true.
P{P→QR, QR→PS, S→Q}. The table has two
candidate keys that share a common attributes QR and
7. (a, b, c)
RS. Therefore, relation is in 3NF, but not in BCNF, as
FD S→Q violates BCNF. Hence it is in 3NF but not in 1NF, 2NF and 3NF are always achievable even while
BCNF. there is a need of preserving dependencies. Since 4NF
implies BCNF, 4NF is not achievable in this case.
3. (a)
8. (a)
RW→V
PQR→ST
P→Q
T→QRS
P→R (PQR)+ = {P, Q, R, S, T}
Q→R (PT)+ = {P, Q, R, S, T}
Q→U Candidate key = {PQR, PT}
Q→W PQR→ST
T→P PQR is candidate key therefore PQR→ST
U→T Satisfy BCNF
U→V T→QRS
As we can see in the 3rd FD P→R, P is prime attribute T→Q
and Q is non-prime attribute, therefore this relation T→R
does not satisfy 2NF and higher normal form. So, the T→S
highest normal form satisfied by the above relation is Violate 2NF.
1NF. So not in 2NF

4. (a)
P→Q and Q→R are two FD’s then P→R is known as
transitive dependency, hence S2 is false.

5. (c)

Any issue with DPP, please report by clicking here:- https://forms.gle/t2SzQVvQcs638c4r5


For more questions, kindly visit the library section: Link for web: https://smart.link/sdfez8ejd80if

PW Mobile APP: https://smart.link/7wwosivoicgd4


1

Branch : CSE & IT Batch : Hinglish


Database Management System
File Org & Indexing DPP 01

[MCQ] (b) P2 only


1. Assume a relational database system that holds (c) P3 only
relation: C(colleges) with the following (d) P1, P2 and P3
characteristics
• Records are stored as fixed length, fixed format [MCQ]
records, length is 256 bytes.
4. Consider the following specification of system-
• There are 16384 records.
Disk block size = 2048 bytes
• Records contains key attribute CollegeNumber
(C.N), length 22 bytes and other fields. Block pointer size = 16 bytes
Record pointer size = 20 bytes long
• Unspanned organization is used to store the
information or record. file contains 30,000 records.
Let’s suppose we want to build a sparse primary index Each record of the file has the following fields:
on C.N then how many numbers of 4096-byte blocks Fields Size (in Bytes)
are needed to store the primary index when block EmpName 5
pointer size is 10 bytes ______?
EmpNum 10
(a) 7 (b) 8 DeptNum 9
(c) 9 (d) 10 Addr 20
PhNum 9
[NAT] DOB 1
2. Assume a relational database system that holds Sex 1
relation: Product (P) with the following characteristics Job 3
• Records are stored as fixed length, fixed format Sal 5
records, with the length of 256 bytes.
An extra/additional byte is used per record to represent
• There are 262144 records. end of the record.
• Records contain attribute P.I (The identifier of the What is the block factor of the database file assuming
product involved), with the length 24 bytes, and an unspanned file organization?
attribute P.C (the cost of product), with the length (a) 16 (b) 32
32 bytes and other fields. (c) 48 (d) 64
• Unspanned organization is used to store the record.
Assume that we want to build a dense secondary index [MSQ]
on P.C, then how many numbers of 4096-byte blocks 5. Which one of the following statements is/are True
needed to store the dense secondary index. When regarding indexing?
record pointer size is 32 bytes? _______. (a) A database file can contain multiple clustered
indexes.
[MCQ] (b) A database file can consist of only one clustered
3. Consider a SQL statement SELECT P1, P2, P3 from Q index with multiple secondary indexes.
WHERE P2 = ‘Pavan’ is frequently executed, which (c) A database file can consist of multiple primary
column(s) should be considered for indexing based indexes.
only on the statement itself? (d) A database file can consist of both primary and
clustered index.
(a) P1 only
2

[NAT] [MCQ]
6. Consider a database of fixed-length records stored as 7. Consider the following statements-
an ordered file. The database has 25,000 records with S1: If the records of a relation X are physically
each records being 100 bytes, of which the non-key ordered over a non-key field P and an index is
attribute on which clustering index is formed occupies build over the key-field of relation X, then the
10 bytes. The data file is completely block aligned. index is necessarily a secondary index over key
Suppose, block size, of the file system is 512 bytes attribute.
and a pointer to the block occupy 5 bytes. You may S2: More than one secondary indexes are possible.
assume that a binary search on an index file of b
block may take log2b accesses in worst case. Which of the given statement(s) is/are CORRECT?
Given that a cluster consumes 2 blocks, the number of (a) S1 only
block accesses required to identify the desired data in (b) S2 only
the worst case is ______. (c) Both S1 and S2
(d) Neither S1 nor S2
3

Answer Key
1. (b) 5. (b)
2. (4096) 6. (9)
3. (b) 7. (c)
4. (b)
4

Hints & Solutions


1. (b) 5. (b)
In the primary index, number of entries in the index (a) False: A database file can contain one clustered
block equals to number of blocks of relation. index because the database is sorted on one field
Number of database records in a single block B = only.
4096/256 = 16 (b) True: A database file can consist of one
Number of blocks of relation C = 16384/16 = 1024 clustered index and multiple secondary index.
Size of indexes = size of key field (c) False: The index on a unique field on which
+ size of block pointer database is sorted is primary index and there can
be only one primary index.
= 22 + 10 = 32 bytes
(d) False: A database file can consist of either a
Number of indexes records present in single block =
4096/32 = 128 primary or clustered index but not both.

 Total number of blocks required to store primary


index = 1024/128 = 8. 6. (9)
 512 
Block factor of database file = 
2. (4096)  100 
In dense secondary index, number of entries in the = 5 records/block
index blocks equals to number of records of relation. Number of blocks required to store 25,000 records
• Number of records in the relation P = 262144  25000 
=  
Size of index = size of key field  5 
+ size of record pointer = 5000 blocks
Each cluster consumer 2 blocks
= 32 + 32 = 64 bytes
5000
• Number of index entry in single block Number of entries in index file = = 2500
2
= 4096/64 = 64  512 
Block factor of index file =  = 34 entries/block
So, the total number of blocks required to store  15 
primary index = 262144/64 = 4096.
 2500 
Number of blocks in index file =  = 74
 34 
3. (b) The number of block accesses in worst case
The column on which condition gets applied should be = log 2 74  + 1 + 1
considered for indexing.
  
P2 is the answer. st nd
for index Accessing 1 Accessing 2
file search block of cluster block of cluster

4. (b) = 7 + 1 + 1 = 9 blocks access required


Blocking factor (i.e number of records per block)
Block size 7. (c)
=
record size S1: Records are ordered over non-key field. It is
Record size of file = Sum of all field + additional bytes unordered over key field.
= 63 + 1 = 64 Hence, secondary index if formed over unordered
2048 key-field. Hence, its CORRECT.
 Number of records per block = = 32
64 S2: CORRECT. More than one secondary index is
possible.
5

Any issue with DPP, please report by clicking here:- https://forms.gle/t2SzQVvQcs638c4r5


For more questions, kindly visit the library section: Link for web: https://smart.link/sdfez8ejd80if

PW Mobile APP: https://smart.link/7wwosivoicgd4


1

Branch : CSE & IT Batch : Hinglish


Database Management System
File Org & Indexing DPP 02

[NAT] record length R = 200 bytes. Now assume that the


1. Consider the following specification of system with ordering key field of the file is V= 18 bytes long, a
disk block size 2048 bytes, block pointer size 14 bytes, block pointer P = 12 bytes long, and we have construed
record pointer size 18 bytes long and file size 60,000 a primary index for the file. Let p and q be the number
records. Each record of file is 256 bytes long and of blocks required to access a record in case of without
record of the size is sorted on the key field. If the index and with primary index using binary search
primary index (sparse) is built on the key field (ESN) respectively, Then the values of p + q is .
which is 18 bytes long. What is the Index blocking (a) 18 (b) 19
factors (That is number of indexes per block) (c) 20 (d) 21
Assuming unspanned file organization _________.
[MCQ]
[NAT] 6. Consider an unordered file of 106 records with records
2. Common data for next two Questions: size of 200 bytes stored on blocks of 8KB with a
Consider a disk blocking size B = 1024 bytes. A block spanned records organization. We will assume that no
pointer (BP) = 12 bytes long and a record pointer (RP) system related information is stored within a block,
= 7 bytes long. A file has r = 60,000 patient records of then how many blocks would it be need to store this
fixed length. The size of record is 230 bytes. Suppose file?
the file is not ordered by the key field PSN (18 bytes) (a) 24400 (b) 24405
and we want to construct a secondary index on key (c) 24410 (d) 24415
attributes (PSN).
[MCQ]
The number of first level index entries are x and
7. Consider the following statements:
number of second level index entries are y then find the
S1: For any given data file, it is possible to create two
value of x + y?
different sparse first level indexes on various keys.
S2: For any given data file, it is possible to create two
[MCQ]
different denes first level indexes on various keys.
3. The number of first level index blocks are x and Select the correct statements.
number of second level index blocks are y then (a) Only S1 correct
x +y ? (b) Only S2 correct
(a) 1600 (b) 1500 (c) Both S1 and S2 is correct
(c) 45 (d) 1545 (d) Neither is S1 nor S2 is correct.
[NAT]
[MCQ]
4. Consider a file of r = 40,000 records, each record is
R = 100 bytes long and its key field is of size v = 20 8. Which of the following is NOT a benefit of using
bytes. The file is ordered on a key field, and the file Indexes in a database?
organization is unspanned. The file is stored in a file (a) Improved query performance
system with block size B = 2000 bytes, and size of (b) reduced disk I/O
block pointer is 20 bytes. If the primary index is built (c) Increased storage space
on the key field of the file and multilevel index scheme (d) Faster data retrieval
is used to store the primary index, then the total number
of blocks required by the multilevel index is . [MCQ]
9. Which of the following best describes an index in a
[MCQ] database.
5. Assume that we have an ordered file with r = 60,000 (a) A column that stores unique identifiers for each
records stored on a disk with block size B = 2048 bytes. row in a table.
File record are of fixed size & are unspanned with
2

(b) A data structure that allows for fast searching and (d) None of the above.
retrieval of data, based on certain criteria.
(c) A set of constraints that enforce rules for data
integrity
3

Answer Key
1. (64) 6. (d)
2. (61500) 7. (b)
3. (d) 8. (c)
4. (41) 9. (b)
5. (21)
4

Hints & Solutions


1. (64) Number of 1st Level index blocks b1 =  r1 / bfri 
 2048   2, 000 
Number of indexes per blocks =   = 64 = 
14 + 18   = 40
 50 
Number of 2nd level index entries r2 = number of 1st
2. (61500) level block b1 = 40 entries.
Number of first level index entries r1 = Number of files Number of 2nd level index b2 =  r2 / bfri  =  40 / 50 = 1
records r = 60,000.
Since the 2nd level has only 1 block, it is the top index
So, x will be 60000.
level. Hence, the index has 2 levels.
Now, block factor of the first level index =
The total Number of blocks required by the multilevel
 1024 
18 + 7  = 40 index entries per block. index (bi) = b1 + b2 = 40 + 1 = 41 blocks.
 
 Number of index block at first level (that is entries
 60000 
for second level = y) =   = 1500 blocks
 40  5. (d)
 x + y = 60000 + 1500 = 61500 The blocking factor for the file will be bfr = ( B / R )
=  2048 / 200  = 10 records per block.
3. (d)
Now, block factor of the first level index = The number of blocks needed for the file is b =
 1024  ( r / bfr )  = ( 60,000 / 10 ) = 6000 blocks.
18 + 7  = 40 index entries per block.
  A binary search on the data file would need
 Number of index block at first level (that is entries approximately log 2 b  = log 2 6000  = 13 block
 60000  accesses.
for second level = x) =   = 1500 blocks
 40  The size of each index entry is Ri = (18 + 12) = 30
Now, block factor of the second level index = bytes.
 1024  So, the blocking factors for the index is bfri =
18 + 12  = 34 index entries per block.
  ( B / R i ) 
 Number of index block at second level (that is
 2048  
1500  =    = 68 entries per block
entries for second level = y) =   = 45 blocks  30  
 34 
The total number of index entries ri is equal to number
 x + y = 1500 + 45 = 1545
of blocks in the data file, which is 6000 blocks.
Hence, the number of index blocks is bi = ( ri / bfri )
4. (41)
File blocking factor bfr = ( B / R ) = 
 000 
 = 89 blocks.
 68 
=  2000 / 100 
To perform a binary search on the index file it would it
= 20 records per block
need ( log 2 / bi ) = log 2 (89 ) = 7 blocks access.
Number of blocks needed for file =  r / bfr 
To search for a record using the index, we need one
 40, 000 
=   = 2000 database blocks additional block access to data file which makes total
 20  of(q) 7 + 1 = 8 = blocks access, an improvement over
Index records size Ri = (V + P) = (20 + 20) = 40 bytes binary search on data file which required 13 block
Index blocking factors bfri =  B / R i  = access.
 2000   p + q = 13 + 8 = 21
 40  = 50 index records per block
 
Number for first level index entries (ri) will be equal to
number of file blocks b = 2000 entries
5

6. (d) S2:(True): Any number of dense indexes is possible to


Blocks size = 8 KB construct. In the dense indexing we have index entries
Records size = 200 bytes for each file records.
8192
The number of records in a block = = 40.96 8. (c)
200
records (Spanned Organization). The correct answer is ‘c’.
As it is spanned hence it takes whole as 40.96 ‘Increase storage space’. This is because adding
1 block contains 40.96 records. indexes to a database can actually increase the amount
 106  of storage space required as the index data structure
 The number of file blocks =   = 24415 blocks. needs to be stored alongside the data. The other answer
 40.96  choices are all benefits of using indexes.
9. (b)
7. (b) Indexing in a database is a data structure that allows for
S1: (false): It is not possible because the requirement of fast searching and retrieval of data based on certain
sparse indexing is that the database must be stored and criteria.
as we know that database is sorted only on one column.

Any issue with DPP, please report by clicking here:- https://forms.gle/t2SzQVvQcs638c4r5


For more questions, kindly visit the library section: Link for web: https://smart.link/sdfez8ejd80if

PW Mobile APP: https://smart.link/7wwosivoicgd4


1

Branch : CSE & IT Batch : Hinglish


Database Management System
File Org & Indexing DPP 03

[MCQ] [NAT]
1. The order of a leaf node in a B+ tree is the maximum 6. The order of a node in B tree is the maximum number
number of (value, data record pointer) pairs it can hold. of block pointers it can hold. Given that the block size
Given that the block size is 1K bytes, data record
is 2K bytes, data record pointer is 8 bytes long, the
pointer is 8 bytes long, the value field is 10 bytes long
and a block pointer is 6 bytes, then what is the order of search key is 9 bytes long and a block pointer is 5 bytes
the leaf node? long. The best possible order of B tree node is .
(a) 53 (b) 54
(c) 55 (d) 56 [NAT]
7. The order of a leaf node (P) in a B+ tree is the maximum
[NAT]
number of (value, data record pointer) pairs it can hold.
2. The order of a node in B+ tree is defined as the number
of pointers it can hold. What is the maximum number Given that P=36, data record pointer is 8 bytes long,
of keys that a B+ tree of order 4 and height 4 can have the search field is 6 bytes long and a block pointer is 8
? __________ bytes long. The permissible block size is .
(Assume that the height of a root node is 1)
[NAT]
[MCQ]
3. Given a block can hold either 3 records or 10 key 8. (Assume that the level of root node is1)
pointers. A database contains P records, then how The order of different nodes in B+ tree/B tree are given
many blocks do we need to hold the data file and the as-
dense index? 2 to P block pointers in root node.
P P P
(a) (b)
30 3  2  to P block pointers in internal node.
 
13P P
(c) (d) P
30 10  2  –1 to (P–1) keys in leaf node.
 

[NAT] Let a and b be


4. The order of an internal node in B+ tree index is the The minimum number of keys in
maximum number of children it can have. Assume that B tree and B+ tree node of order
a child pointer takes 6 bytes, the search field value P = 5 and level = 5. The value of (a + b) is .
takes 34 bytes and the blocks size is 2048 bytes. The
order of the internal node is ________. [NAT]
[NAT] 9. (Assume that the level of root node is1)
5. Assume a disk with block size B = 1024 Bytes, A block The order of different nodes in B+ tree/B tree are given
pointer is PB = 12 bytes long and a record pointer is PR as-
= 18 bytes long. A file has 1,00,000 patients records of 2 to P block pointers in root node.
size 100 bytes. Suppose the file is ordered by the key P
field PID and we want to construct a secondary (dense)  2  to P block pointer is internal node.
 
index on non-key field DeptID (14 bytes), then
minimum of how many blocks are required to store P
 2  –1 to (P–1) keys in leaf node.
index file assuming an unspanned organisation?  
(a) 3000 (b) 3100 Let a and b be the maximum number of keys in B tree
(c) 3125 (d) None of the above and B+ tree node of order P = 5 and level = 5. The value
of (a +b) is .
2

[NAT] [MSQ]
10. Consider the keys (1– 5000) are going to be interested 12. Which of the following is/are true reading B+ tree?
(a) Records can be fetched in equal number of disk
into a B+ tree. Assume, all the order are available
access.
before insertion. The orders P for B+ tree node is (b) Height of the tree remains balanced and less as
defined as- compared to B tree.
2 to P pointer for root (c) Keys are used for indexing
P (d) Faster search queries as the data is stored only on
 2  to P pointer for another node. the leaf nodes.
 
The maximum possible levels in a B+ tree index for P [NAT]
= 9 is _________. 13. Consider the keys (1– 5000) are going to be interested
(Assume that level of the root node is 1) into a B+ tree. Assume, all the order are available
before insertion. The orders P for B+ tree node is
[MCQ] defined as-
11. Consider the following statements: 2 to P pointer for root
S1: In a B+ tree, data pointers are stored only at the leaf
nodes of the tree. P
 2  to P pointer for another node.
S2: The leaf node has an entry for every value of the  
search field, along with the data pointer to the The minimum possible levels in a B+ tree index for P =
record. 9 is _________.
Choose the correct statements. (Assume that level of the root node is 1)
(a) Only S1 is true
(b) Only S2 is true
(c) Both S1 and S2 are true
(d) Neither S1 nor S2 is true
3

Answer Key
1. (d) 8. (269)
2. (255) 9. (5624)
3. (c) 10. (6)
4. (52) 11. (c)
5. (c) 12. (a, b, c, d)
6. (93) 13. (4)
7. (512)
4

Hints & Solutions


1. (d) 5. (c)
Disk block Blocking factor, bfr = 1024 / 100
= 10 records per block
Number of blocks needs for file = r/bfr 
Given data, = 100000/10 = 10000
Disk block size = 1K byte = 210 bytes = 1024 bytes Index records size Ri= (Non – Key DeptID + PR))
Block pointer (B) = 6 bytes = 14 + 18 = 32 bytes
Key field (K) = 10 bytes Index blocking factors bfri = B / R i  = 1024 / 32
Record/ data pointer (R) = 8 bytes
= 32
Order of leaf node= P st
Number of 1 level index entries r1 = number of –
B + (P)(K + R) < D records in the file = 100000 entries.
6 + (P)(10 + 8) < 1024 Number of first level index blocks b1 =  r1 /bfri 
18 P < 1024 – 6
= 100000/32 = 3125 blocks
1018 
P=  
 18  6. (93)
 P = 56 Order P: maximum blocks pointers per node.
Maximum number of (value, data record pointer) Block size > P × (Block size pointer) + (P –1) × (size
of keys + size of record pointers)
Pairs = 56
Block size > P ×5 + (P – 1) × (9 + 8)
The order of the leaf node is 56. 2048 > 5P + 17P – 17
22P ≤ 2065
2. (255)  2065 
A B+ tree of order n and height h can have at most nh – P=   = 93
 22 
1 keys. Therefore, maximum number of keys-
= 44 –1 = 255. 7. (512)
Order P: maximum number of (value, data record
3. (c) pointer) pairs
For storing the records, numbers of blocks required = Block size > P × (keys size + Record pointer size) + 1×
P (Block pointer size)
and for storing the keys in dense index number of Block size > P × (6 + 8) + 1 × (8)
3
Block size > 14 * 36 + 8
P Block Size = 512 bytes
blocks required = .
10
P P 13 P 8. (269)
So, total blocks required are + =
3 10 30
Level Minimum Minimum Minimum
4. (52) Number of number of number of
Size of child pointer = 6 bytes Nodes Blocks pointer keys
Size of search field value = 34 bytes 1 1 2 1
Block size = 2048. 2 2 5 2×2
Order of internal node = P 2 × = 6
2
( Number of blocks pointer in any node)
3 6 6 × 3 = 18 6×2
(P –1)34 + P × 6 < 2048
4 18 18 × 3 = 54 18 × 2
34P + 6P < 2048 + 34
40P < 2082 5 54 54 × 3 = 162 54 × 2
2082 a = minimum number of keys in B tree → 161
P< For a B+ tree, keys are present in last level only b = 108
40
= 52.05 52  a + b = 161 + 108 = 269
5

9. (5624) 11. (c)


S1(True): In a B+ tree, data pointers are stored only at
Level Max. No. Max. No. Max. No. of the leaf nodes of the tree.
of nodes of Blocks keys S2(True): the leaf nodes have an entry for every value
pointer of the search field, along with the data pointer to the
1 1 5 4 record.
2 5 5×5 5×4
3 25 25 × 5 25 × 4 12. (a, b, c, d)
4 125 125 × 5 125 × 4 True: Records can be fetched in equal number of
5 625 625 × 5 625 × 4 accesses
a = maximum number of keys in B tree → 3124 True: Height of the tree remains balanced and less as
For a B+ tree, keys are present in last level only b = compared to B tree.
2500. True: We can access the data stored in a B+ tree
sequentially as well.
10. (6) True: Faster search queries as the data is stored only
For maximum possible levels, minimum number of on the leaf node.
keys should be present in an index node.
13. (4)
 5000 
Number of nodes in the last level =   = 1250 For minimum possible levels, maximum number of
 4 
keys should be present in index node.
 9 
[Minimum    − 1 keys for other node]  5000 
 2  =   = 625
 8 
 625 
=   = 70
 9 
 70 
=   = 8 Minimum number of level = 4
9
8
=   = 1 node
9

Any issue with DPP, please report by clicking here:- https://forms.gle/t2SzQVvQcs638c4r5


For more questions, kindly visit the library section: Link for web: https://smart.link/sdfez8ejd80if

PW Mobile APP: https://smart.link/7wwosivoicgd4


1

Branch : CSE & IT Batch : Hinglish


Database Management System
Query Language
DPP 01

[MCQ] [MSQ]
1. Consider the following statements: 4. Consider the following relations:
Enroll (Sid, Papercode), Paper(Papercode, Desc)

S1: List N (List N–1……(List 1(R)) Which of the following relational algebra displays the
 List 1 (List 2……(List N (R)) sid’s who only enrolled for Papercode having
descriptions (Desc) as “CS”?
( ) ( (
S2: cn cn–1 ..... ( c1 ( R ) )  c1 c2 .... CN ( C ) )) (a) sid (Enroll ⋈ Paper)
Desc = CS
Which of the following statement(s) is/are correct?
(a) S1 only (b) sid (Enroll) – sid ((Enroll ⋈  (Paper))
Desc = CS
(b) S2 only
(c) Both S1 and S2 only (c) sid (Enroll) – sid( (Enroll ⋈  (Paper))
Desc < > CS
(d) Neither S1 nor S2
(d) None
[NAT]
[MCQ]
2. Consider the following relations- 5. Consider a relations work (EmpiD, Project ID)
Enroll (CandidateID, Papercode) with 5000 tuples and The suitable relational algebra expression that projects
the employee ids who work exactly in one project is-
Count(Papercode, Number_of_appearing_candidates)

(a) Empid (Work) –  Empid(Work ⋈ E, P (work))
with 29 tuples. Empid = E

Assume, one candidate can enroll for multiple Project Id = P

Papercode. Let p and q be the maximum and minimum (b) Empid (Work ⋈ E, P (work))
Empid = E
number of records in Count ⋈ Enroll then the value of 
Project ID  P
p + q is .

(c) Empid (work) –Empid (work ⋈ E, P (work))


[MCQ] Empid = E

3. Let R1 and R2 be two relations which are union Project ID P

compatible with the same set of attributes.


(d) None
S1: R1  R2 = T1 ⋈T2
[MCQ]
S2: R1  R2 = T1 ⋈T2
6. Consider two relations R and S with x and y number of
Which of the above statement(s) are INCORRECT? distinct record. Let p and q be the minimum and
(a) S1 only maximum number of records in the resultant R/S, then-
x
(b) S2 only (a) p = 0, q = x + 1 (b) p = 0, q =  
 y
(c) Both S1 and S2 only
(d) Neither S1 nor S2
2

x
(c) p = x, q = y (d) p = x, q =  
 y [MSQ]
9. Consider the relation-
[MCQ] Works (Eid Pid) project (Pid, Name)
The relational algebra expression that displays the Eids
7. Let R1 and R2 be two relations with n and m tuples. who work in every project Name = ‘M .
S1: The maximum number of records in R1– R2 is n. (a) Eid, Pid (works)/ Pid (Name = M (Project))
S2: The minimum number of records in R1 R2 is max (b)
(n, m)
(a) S1 only 
( Work )  pid   ( Project )  − Eid Pid ( works )
(b) S2 only Eid ( Work ) −   Eid  Name = m 
Eid  
(c) Both S1 and S2  
(d) Neither S1 nor S2 (c)

[MCQ] 
( Work )  pid   ( Project )  –Eid Pid ( works )
Eid ( Work ) −  Eid  Name < > m 
8. Consider the following RA expression-  
 
P: sid (student) –sid (student ⋈  I, G, M (Student)) (d) None
Marks < M
 Gender = G
On a relation student (sid, Gender, Marks) and I = sid, [MCQ]
G = Gender, M = Marks. 10. Consider the two relations R1 and R2 such that they
The above R.A displays? have no attributes in common then-
(a) The sid of the student who obtained the maximum S1: R1 ⋈ R2 = R1 × R2
marks.
S2: R1 ⋈ R2 = 
(b) The sids of the male and female students who
obtained the maximum marks in their respective Which of the given statement(s) is/are correct?
gender. (a) S1 only
(c) The sids of male student who scored higher than (b) S2 only
(c) Both S1 and S2
all the female students
(d) None (d) Neither S1 nor S2
3

Answer Key
1. (b) 6. (b)
2. (10000) 7. (c)
3. (b) 8. (b)
4. (a, c) 9. (a, b)
5. (c) 10. (a)
4

Hints & Solutions


1. (b) = All emp IDs – Empid (Work ⋈ E, P (work))
Selection is commutative whereas projection is not
Empid = E
commutative. 
Consider the following relation R (A, B, C) Project ID  P
3 2 0
1 2 5 6. (b)
I. Statement S1: Incorrect 2 3 4 The minimum number of records in R/S is 0.
B ( B,C ( R ) ) B,C ( B ( R ) ) The maximum number of records in R/S is at most x,
B C if y = 0
2  2
0  x
B  B,C 2 → Not Possible But it will be   if y > 0.
2 5  y
  3 
3 4
II. Statement S2: Correct 7. (c)
B = 2 ( c > 0 ( R )) = 1 2 5 S1: R1 with n tuples
R2 with m tuples
c > 0 ( B = 2 ( R )) = 1 2 5
When m = 0, then R1 – R2 = n
So, Statement S1 is true.
2. (10000) S2: Let x be the tuple set of R, and y be the tuple set of
 Papercode is candidate key in Count with 29
R2
records and a foreign key in Enroll. Papercode can also
If x  y  , then min m number of tuples in
not Contain NULL values in Enroll as it is the
R1 R2 is max (n, m). Hence, statement S2 is also
candidate.
true.
Maximum number of records in Count ⋈ Enroll
(P) = maximum (5000, 29) = 5000
8. (b)
Now as we know that FK always store subset value
of its parent key attribute. R : sid (Student ⋈ I,G,M (Student))
Minimum number of records Counts ⋈ Enroll Marks < m

(q) = maximum (5000, 29) = 5000
Gender = G
 p + q = 5000 + 5000 = 10000
The R will results: The sids of student of the same
gender who scored less marks than the same student of
3. (b)
R1 and R2 are union compatible means they have the the same gender
same number of attributes and the domains of the sid (Student) – R  The sids of the students who scored
attributes also the same. maximum marks in a particular gender category.
 Hence, b is correct.
4. (a, c)
Side who enrolled for only ‘CS’ Papercode-
9. (a, b)
= All sids – Sid who enrolled for some non CS Courses/
Relative Eid who works in every project having name
Papers
= sid (Enroll) –sid (Enroll ⋈  (Paper)) = ‘M’ is equivalent to division operation in relational
algebra.
Desc < >cs
So, (a) is correct.
 Option a and c is correct.

5. (c)
Retrieve employee ID’s work exactly in one project
= All emp IDs – Emp IDs who work in at least two
projects etc.
5

(b) A 1
A 1 
A B 2
 3 
A 2
B 1  
Eid P– EidPid ( Works ) =  − C 3
B 3 
Q C 2
C 1  
  C 1
C 3  
P: Eid ( works )  Pid   ( Project )  A 3 
 Name = M 
A B 1
 B 1 Gives Eid who dose not  =    = B
Eid B 3
  3
 C   
A 
A
Eid (Works) – Q =  B  –  B  =   Eids who
 C   B
P: A 1
A 3 works in all ‘M’ projects
B 1
B 3 10. (a)
If the relations R1 and R2 have no attributes in common,
C 1
the result of natural join is equal to the cross product of
C 3 R1 and R2.
The condition of equijoin is not inaccessibility between
two same attributes. So, S1 is CORRECT.

Any issue with DPP, please report by clicking here:- https://forms.gle/t2SzQVvQcs638c4r5


For more questions, kindly visit the library section: Link for web: https://smart.link/sdfez8ejd80if

PW Mobile APP: https://smart.link/7wwosivoicgd4


1

Branch : CSE & IT Batch : Hinglish


Database Management System
Query Language DPP 02

[MCQ] [MSQ]
1. Consider the following keywords. 3. Consider the following product relation
A. SELECT Products (PID,PName, Cost)
B. TOP
Assume that PID is a primary key of relation. Which
C. DISTINCT
SELECT statement should we used to limit the display
D. FROM
of product information to the product having price/cost
E. WHERE
F. GROUP BY less than 50?
G. HAVING H. ORDER BY (a) SELECT PID, PName FROM Products WHERE
The above keywords are used in the given SQL query Cost < 50;
below. (b) SELECT PID, PName FROM Products WHERE
SLECT TOP NumberOfRows DISTINCT Col1, Col2 Cost< = 50;
FROM TableNameX, TableNameY
(c) SELECT PID, PName FROM Products WHERE
GROUP BY ColumnName
PID IN (SELECT PID FROM Products WHERE
HAVING expression
Cost <50);
ORDER BY ColumnName;
Which of the following is the correct query execution (d) SELECT PID, PName FROM Products GROUP
order according to SQL Standard? BY PID Having Cost < 50;
(a) D E F G A H B C
(b) D E F G A C H B [MCQ]
(c) D E F G A B C H 4. The Employees table contains these columns
(d) A D E F G H C B empID NUMBERS (4)
LastName VARCHAR (25)
[MSQ]
JobID VARCHAR (10)
2. Consider the following employee table
Suppose that, you want to search for string that contains
Employees (EMPID, EmpName, Sal, DeptID,
ManagerID) assume that EMPID is primary key of ‘Negi’ in the LastName column which SQL statement
relation. which of the following SELECT statements will be used?
is/are invalid? (a) SELECT empID, LastName, JobID FROM
(a) SELECT ManagerID, DeptID FROM employees; employees WHERE LastName LIKE ‘%Negi’;
(b) SELECT ManagerID, DISTINCT DeptID FROM (b) SELECT empID, lastName, JobID FROM
employees;
employees WHERE LastName = ‘Negi_%’;
(c) SELECT DISTINCT ManagerID, DISTINCT
(c) SELECT empID, lastName, JobID FROM
DeptID FROM employees;
employees WHERE LastName LIKE ‘Negi’;
(d) SELECT DISTINCT ManagerID, DeptID FROM
employees; (d) None of these
2

[NAT] [MCQ]
5. Consider a relation A(P,Q) currently has tuples {(1, 2), 8. Consider the following statements.
(1, 3), (3, 4) } and relation B(Q, R) currently has {(2, S1: A DELETE statement can remove rows based on
5), (4, 6), (7, 8)}. Then the number of tuples in the a single condition on a table
result of the SQL query: SELECT * FROM A S2: An INSERT statement can add a single row based
NATURAL OUTER JOIN B; is ? on multiple condition on a table.
Choose the correct statements
[MSQ] (a) Only S1 is true
6. Which of the following statement is/are true about (b) Only S2 is true
constraints? (c) Both S1 and S2 are true
(a) The constraints is applied only to INSERT (d) Both S1 and S2 are false
operation into table. [MSQ]
(b) A foreign key can’t contain NULL values. 9. Which of the below statement are true regarding the
(c) A column with the unique constraint can store WHERE and HAVING clause in a SQL statement?
(a) WHERE and HAVHIG clause can’t be used
NULLS.
together in SQL Statement.
(d) We can have more than one column in a table as a (b) The HAVING clause condition can have
part of primary key. aggregate function.
(c) The WHERE clause is used to exclude rows
[MCQ] before the grouping of data.
(d) The HAVING clause is used to exclude one or
7. Consider the following statements
more aggregated results after grouping data.
S 1: An INSERT statement can add multiple rows per
execution to a table. [MCQ]
S 2: An UPDATE Statement can modify multiple rows 10. Given the database schema A(P,Q,R) which of the
based on multiple condition on a table. following SQL query can be used to test whether the
Choose the correct statements. functional dependency PR holds on relation A?
(a) Only S1 is true (a) Select P from A group by P having count (distinct
R) >1
(b) Only S2 is true
(b) Selects P from A group by A having count
(c) Both S1 is S2 are true
(distinct R) >1
(d) Both S1 and S2 are false (c) Select R from A group by P having count (distinct
R) >1
(d) None of the above
3

Answer Key
1. (b) 6. (c, d)
2. (b, c) 7. (c)
3. (a, c) 8. (c)
4. (c) 9. (b, c, d)
5. (4) 10. (a)
4

Hints & Solutions


1. (b) Option (b):
The correct query execution order. The following SQL selects all Lastname starting with
FROM  D "Negi".
WHERE  E Option (c):
GROUP BY  F The following SQL selects all Lastname contains with
HAVING  G "Negi".
SELECT  A Or
The equivalent SQL query:
DISTINCT  C
SELECT empID, lastName, JobID FROM employees
ORDER BY  H
WHERE LastName LIKE ‘%Negi%’;
TOP  B
So, correct order of execution is DEFGACHB i.e…
5. (4)
option (b).
A B A⋈B
2. (b, c) P Q Q R P Q R
Option b & c are having invalid SELECT statement, 1 2 2 5 1 2 5
1 3 4 6 3 4 6
because we cannot apply DISTINCT keyword on 3 4 7 8 1 3 -
attribute basis, DISTINCT keyword chooses a distinct - 7 8
row. Therefore the number of tuples in the results are 4.

3. (a & c) 6. (c, d)
Option (a) is correct because this SQL statement (a) False; we can also apply for an update operation
displays the product information of product with cost into table.
less than 50. (b) False; A foreign key can contain NULL values as
Option (b) is incorrect because it will return product well
(c) True; A column with the UNIQUE constraint can
information of product with cost equal to 50.
store NULL values but not duplicate value.
Option (c) is correct SQL statement because in this we
(d) True; a primary key can also be a composite key.
used nested SQL query.
First, we find PID of product whose cost is less than 50,
7. (c)
and then we compare PID with the result of inner
S1: True; An INSERT statement can add multiple,
query.
rows per execution to a table by using the
Option (d) is incorrect SQL statement because it cannot following SQL query.
select non aggregate column PName in SELECT INSERT INTO table 2 (col1, col2, col3, ….)
clause. SELECT col1, col2, col3,…
S2: True; An UPDATE statement can modify
4. (c) multiple rows based on multiple conditions on
The LIKE command is used in a WHERE clause to table.
search for a specified pattern in a column.
You can use two wildcards with LIKE: 8. (c)
• % Represents zero, one, or multiple characters S1: True; DELETE statement can remove rows based
• _ -Represents a single character no/single/multiple condition on a table.
Option (a) S2: True; An insert statement can add a single row
The following SQL selects all Lastname ending with based on multiple conditions on a table.
"Negi".
5

9. (b, c, d) (c) True; WHERE clause is used to exclude rows


(a) False; A query can have both WHERE and before the grouping of data.
HAVING clauses.
(b) True; The HAVING clause condition can have (d) True; The HAVING clause is used to exclude
aggregate function. aggregated results after grouping data.

10. (a)
If the query in option a returns non null output, then the
dependency does not hold. Hence (a) option is correct.

Any issue with DPP, please report by clicking here:- https://forms.gle/t2SzQVvQcs638c4r5


For more questions, kindly visit the library section: Link for web: https://smart.link/sdfez8ejd80if

PW Mobile APP: https://smart.link/7wwosivoicgd4


1

Branch : CSE & IT Batch : Hinglish


Database Management System
Query Language DPP 03

[MCQ] List-I List-II


1. Consider the following relational algebra query on 1. a1  a2 (a) {<p, q, r > |< p, q, r > a1v <p, q, r > 
relations A (p, q, r) and B (q, r): a2}
p(A) – p((p (A) × q,r (B) –p,q,r (A)) 2. a1  a2 (b) {<p, q, r> |<p, q, r >a1  < p, q, r > 
The above query is equivalent to? a2}
(a) A  B 3. a1 – a2 (c) {<p, q, r > | < p,q,r, > |  a1  <p, q ,r >
(b) A  B  a2}
(c) A – B
(d) A ÷ B (a) 1– (a), 2 – (b), 3 – (c)
(b) 1– (b), 2 – (c), 3 – (a)
[MCQ] (c) 1– (a), 2 – (c), 3 – (b)
2. Consider the following SQL query. (d) 1– (b), 2 – (a), 3 – (c)
SELECT DISITNCT P1, P2, P3…. Pn
[NAT]
FROM R1, R2, R3….. Rm
5. Consider the table which contains the data shown
WHERE Q below.
Which of the following relational algebra query is Sailors (SailID, SailName, Rating, Age)
equivalent to above SQL query? Reserves (SailID, BoatID, Date)
(a) P1, P2, P3…. Pn(Q (R1 ⋈ R2 ⋈ R3⋈……⋈ Rm)) Boats (BoatID, BoatName, Color)
(b) P1, P2, P3…. Pn((R1× R2 × R3×…… ×Rm) Sailors
SailID SailName Rating Age
(c) P1, P2, P3…. Pn(Q (R1 ⋈ R2 ⋈ R3⋈……⋈ Rm))
1 Ram 5 35
(d) P1, P2, P3…. Pn(Q (R1× R2 × R3×…… ×Rm)) 2 Shaym 9 22
3 Ramesh 10 19
[MCQ] 4 Suresh 3 NULL
3. Consider the following equivalencies between 5 Akhil NULL 35
expressions of relational algebra, each involving Reserves
relations A (P, Q) and B (R, S). Assume that there is SailID BoatID Date
no foreign key, A attribute to table can be NULL, all 1 4 2017-03-15
attributes are of integer types which of the following 1 5 2017-04-15
equivalencies is/are TRUE? 3 2 2014-04-15
(a)  P, Q (A×B) = A 4 4 2018-01-01
(b) A – T (P, Q) (B) = T (P, Q) (B – ( T (R, S) (A))) 5 1 2017-12-25
(c)  P, Q, S (A ⋈Q=R B) = A ⋈ (T(Q, S) (B)) Boats
(d) None of the above BoatID BoatName Color
1 Lake Red
[MCQ] 2 Fish Yellow
4. Let A = (P, Q, R) and a1 and a2 both be relations on 3 Clipper Green
schema A. Give on expression in the domain relation 4 Yatch Green
calculus List- I, match the List-I expression to its 5 Fish Yellow
equivalent relational algebra query in List-II.
6 Clipper red
2

[MSQ]
and the following relational algebra query. 9. Consider the following Database
BoatID (Age = 35  rating ≥ 5 (sailors) ⋈ Reserves) Tool (TooID, Brand, Price)
BoatID (Rating < 5 (Sailors)⋈Reserves) Jobsite (Location, compensation, Task)
The number of rows returned by the above query ToolBox(ToolBoxID, location)→location is a foreign
is . key to jobsite.
Holds(ToolBoxID, ToolID) →ToolBoxID is a foreign
[MCQ] key to ToolBox. ToolID is a foreign key to Tool.
6. Consider the relation schemas w(P, Q, R), x (S, P, T) And consider the following SQL query.
y(P, Q, R, S, T) and z (R, S, T). A query that uses SELECT DISTINCT T. ToolID
additional operators of relational algebra: FROM Tool T, Holds H, ToolBox B, Jobsite J
((w × x)  y) ÷ z.
WHERE T. ToolID = H.ToolId AND H.ToolBoxID =
What will be the result set if we write this query using
only the basic operators of relational algebra? B. ToolBoxID AND B. location = J. location AND J.
(a) Result set of the basic operator’s query will be Task = ‘welding’
greater than the result set of given query. Which of the following would be an equivalent
(b) Result set will only consist of attributes P and Q. relational algebra query?
(c) Some of the operations in query cannot be (a) ToolID (Tool ⋈ Holds ⋈ ToolBox ⋈ task =
performed due to incompatible relation schemas
‘welding’(jobsite))
(d) Query cannot be written by only using basic
operations. (b) ToolID (task = ‘welding’ (Tool ⋈ (Holds ⋈ Tool Box)
⋈ Jobsite)
[MSQ] (c)  task = ‘welding’ (ToolID (Tool) ⋈ Holds ⋈ Tool Box
7. Consider the following relational table A ⋈ Jobsite)
A (d) None of the above
P Q R S T
p1 q1 r1 s1 t1 [MSQ]
p2 q2 r2 s2 t2 10. Consider the following two relations A (P, Q) and
Also, consider the decomposition of the relation A into B (R, S). Which of the following statement is/are
relations A1 = (P, Q, R) and A2 = (R, S, T) which of the
TRUE?
following is/are correct based on the above relations.
(a) A1 (A) ⋈ A2 (A) =A (a) The cardinality of (A⋈P = R B) is always larger
(b) A1 (A) ⋈ A2 (A)  A than or equal to the size of (A⋈P = R and Q=S B).
(c) PQ →T is true in the table A1 (A) ⋈ A2 (A) (b) The cardinality of (A⋈P = R and Q  S B) is always
(d) None of the above larger than or equal to the size of (A⋈P = R and Q = S
B).
[MSQ] (c) These two-expression (P = 5 (A⋈Q=RB)) and (P =
8. Which of the following relational algebra expression
5 (A) ⋈Q=R B) are always equivalent.
is/are always holds correct?
(d) These two expressions (A × B) – (A ⋈ Q = R B) and
(a) (X ⋈ Y) ⋈Z = (Z ⋈ X) ⋈ Y
(b) A (B (X)) = B (A (X) (A⋈Q  R B) are always equivalent.
(c) A (B (X)) = B (A (X)
(d) None of the above
3

Answer Key
1. (d) 7. (a, c)
2. (d) 8. (a, b)
3. (c) 9. (a, b)
4. (a) 10. (a, c, d)
5. (1)
6. (c)
4

Hints & Solutions


1. (d) U: σ rating<5 (Sailors) ⋈ Reserves
In relational algebra A ÷ B is defined as P(A) –P
((P(A)× qr (B) – p,q,r (A)) 4 Suresh 3 NULL 4 2018-01-01
A÷ B is used when we wish to express queries with π BoatID (S) ⋂ π BoatID(u) = {4, 5} ⋂ {4} = {4}
“all”.

2. (d) 6. (c)
SELECT DISTINCT P1, P2, P3 …. Pn Given:
w (P, Q, R), x (S, P, T) y(P, Q, R, S, T) and z (R, S, T)
FROM R1, R2, R3….. Rm
(w × x) contains 6 attributes whereas y contains 5
WHERE Q attributes. So, they aren’t union-compatible. Hence
So, from R1, R2, R3…. Rm intersection operation can’t be performed.
Here, there is no join condition, so it will perform NOTE: If number of attributes in Relation A is n and
cartesian product, then select Q and perform number of attributes in relation B is m then number of
projection. attributes “A x B” will be “n + m”.
P1, P2, P3…. Pn (Q (R1× R2 × R3×…… ×Rm))
7. (a, c)
(a) TRUE
3. (c)
(a) When B = , then result of A × B = then it is not A
equivalent to A. So, this equivalence is false. P Q R S T
(b) It is clearly seen that it is false / not equivalence p1 q1 r1 s1 t1
as difference is not commutative. p2 q2 r2 s2 t2
(c) Both expressions are equivalent. In expression
A⋈T(Q, S) (B), first we are performing rename A1(A) A2(A)
P Q R R S T
operation on attribute of relation B and then
p1 q1 r1 r1 s1 t1
performing natural join on common column Q. p2 q2 r2 r2 s2 t2

4. (a) A1(A) ⋈A2(A)


a1  a2 = {< p, q, r > | < p,q,r > a1 < p, q, r > a2} P Q R S T
a1  a2 = {< p, q, r > | < p,q,r > a1  < p, q, r > a2} p1 q1 r1 s1 t1
a1 – a2 = {< p, q, r > | < p,q,r > a1  < p, q, r > a2} p2 q2 r2 s2 t2
A1(A) ⋈A2(A) = A
5. (1) (b) FALSE since A1(A) ⋈A2(A) = A
Let σ age = 35  rating ≥ 5 (sailors) as T
(c) TRUE. PQ→T holds in A1(A) ⋈A2(A). An FD
T: 1 Ram 5 35
PQ→T holds if and only iff- for same values of
is selected. PQ, the T value must be same.
(5, Akhil, Null, 35) is not selected as rating contains
NULL value and NULL cannot be compared to ‘5’.
8. (a, b)
NOTE: Null compared with value result will be
(a) Natural join is commutative and Associative so it
undefined. is always true.
S: T ⋈ Reserves (b) Selection is commutative.
(c) Projection is not commutative.
Sail Sail Rating Age Boat ID Date Hence, a and b are correct.
ID Name
1 Ram 5 35 4 2017-03-15
2 Ram 5 35 5 2017-04-15
5

9. (a, b) (b) False, the cardinality of (A⋈P = R and Q  S B) is


(a) Task = ‘welding’ (Jobsite) always larger than or equal to the size of (A⋈P = R
From this we will get all row of jobsite having task and Q = S B).
welding.
(c) True, because the results of both (P=5 (A⋈Q=R B))
Tool ⋈ holds ⋈ Tool Box ⋈ Jobsite
Natural join is done and with ToolID→ ToolID and (P=5 (A) ⋈Q=R B) are always equivalent.
column gets displayed. (d) True because the result (A×B) – (A⋈ Q = RB) and
(b) same explanation as (A) (A ⋈Q  R B) are always equivalent.
(c) incorrect because after projecting ToolID we Hence, correct answer is a, c and d.
cannot apply condition on task.
Hence corrects option is a and b.

10. (a, c, d)
(a) True, because (A⋈P=R and Q=S B) is more restrictive
than (A⋈P = R B), it will also filter out the row in
which Q is not equal to S therefore the cardinality
(Number of rows) of (A ⋈P=R B) is always larger
than or equal to the size of (A⋈P = R and Q = S B).

Any issue with DPP, please report by clicking here:- https://forms.gle/t2SzQVvQcs638c4r5


For more questions, kindly visit the library section: Link for web: https://smart.link/sdfez8ejd80if

PW Mobile APP: https://smart.link/7wwosivoicgd4


1

Branch : CSE & IT Batch : Hinglish


Database Management System
Transaction & Concurrency Control DPP 03

[NAT] [MCQ]
1. Consider the following schedule 6. The goal of concurrency control on database system is
S: w1(X); w1(Y); r2(X); w2(Y); r3(X); w3(Y) to
How many schedules are conflict equivalent to given (a) Only allow concurrent execution of transaction
schedule (S) _________? that correspond to serial execution of some of the
transactions.
[NAT] (b) Allow only transactions that don’t access common
relationship to run concurrently.
2. Consider the following schedule
(c) Execute transactions serially.
S = r1(P); r3(S); w1(Q); r2(Q) r4(Q), w2(R)
(d) None of the above.
r5(R); w4(T); r5(T); w5(Q)
How many serial schedules conflict equal to
schedules(S)? ________. [MCQ]
7. What problem can occur when a DBMS executes
multiple transactions concurrently?
[NAT]
(a) Lost update problem.
3. Consider the following schedule
(b) Dirty read problem.
S = r1(P); r3(S); w1(Q); r2(Q) r4(Q), w2(R);
(c) Incorrect summary problem.
r5(R); w4(T); r5(T); w5(Q)
(d) All of the above.
How many serial schedules view equal to
schedule(S)__________?
[MCQ]
8. Consider the following statements
[MCQ]
S1: Every view serializable schedule is conflict
4. Consider the following transactions
serializable.
T1: r1(P); w1(P); r1(Q); w1(Q)
S2: Some view serializable schedules are conflict
T2: r2(P); r2(Q)
serializable.
T3: w3(P); w3(Q)
(a) Only S1 is true.
How many concurrent schedules between T1, T2 and T3
(b) Only S2 is true
transactions _________?
(c) Both S1 & S2 are true
(a) 400
(s) Neither S1 nor S2 is true
(b) 410
(c) 420
[MCQ]
(d) None
9. Consider the following schedule involving two
transactions
[NAT]
S1: r1(A); r2(A); w2(A); r3(A); w1(A); w2(B); r3(B),
5. How many views equivalent serial schedules are
c2, w3(A); c1, c3
possible for the given schedules below _________
S: w1(P) r2(P) w3(P) r4(P)w5(P) r6(P) S2: r2(A); r1(A); w1(A); w2(A); w2(A); r3(A); w3(A),
r2(B); c1, c3; c2
2

Which one of the following statements is TRUE? Time T1 T2


(a) S1 is recoverable and S2 is not recoverable. t0 read(P);
(b) S1 is not recoverable and S2 is recoverable. t1 write(P);
(c) Both S1 and S2 are recoverable. t2 read(R);
(d) Both S1 and S2 are not recoverable. t3 write(R);
t4 read(Q);
[MCQ] t5 write(Q);
10. Consider the following schedule: t6 read(P);
S: r1(A); r2(C); w1(A); r3(A) r2(B); w2(B), w3(A); t7 commit;
r3(B); r2(A)
t8 read(Q);
for the schedule S given above two orderings of
commits (ci) operations are specified.
I. c1; c3; c2 Suppose that the transaction T1 fails immediately after
time instance 8. Which one of the following is correct?
II. c1; c2; c3
S1: Schedule S is non recoverable and cannot ensure
Which of the above ordering ensures recoverability of
transaction atomicity
schedule S?
S2: Only T2 should be aborted and then restarted to
(a) Only I
ensure truncation atomicity
(b) Both I and II
(a) Only S1 is true
(c) Only II
(b) Only S2 is true
(d) None of these
(c) Both S1 and S2 are true
(d) Both S1 and S2 are false
[MCQ]
11. Consider the following partial schedule ‘S’ involving
two transaction T1 and T2
3

Answer Key
1. (8) 7. (d)
2. (10) 8. (b)
3. (10) 9. (a)
4. (c) 10. (d)
5. (2) 11. (a)
6. (a)
4

Hints & Solutions


1. (8) Total 10 topological orders.
Given schedule As we know that number of serial schedule conflict ‘S’
S: w1(X); w1(Y); r2(X); w2(Y);r3(X);w3(Y) is equal to number of topological orders.
Conflict equivalent schedules to above schedules.
3. (10)
Final write Q: T1 T5
Initial Reads
Data item Initial reads Writes
P T1 -
Q - T1 T5
R - T2
There are 2 ways r2(X) placed such that it must be
before w2(Y) and conflicting pairs should be in S T3 -
precedence. T - T4
Hence 2 possibilities to place r2(x) to avoid conflict Updated reads
equivalence in above schedule. w1(Q) → r2(Q)
S = w1(X) r2(X) w1(Y) w2(Y) w3(Y) r4(Q)
T5 also writes Q
r3(X) w2(R) → r5(Q)
4 ways
w4(T) → r5(T)
S = w1(X); w1(Y) r2(X) w2(Y) w3(Y)
T1 T5

r3(X)
-
4 ways
T1 → T2
Total 8 conflict equal schedules to the given schedule.
T1 → T4
T2 → T5
2. (10)
T4 → T5
Constructing the precedence graph
view equal serial orders
T1 T2 T5

T4 can be placed in two ways


1) T1 T2 T4 T5
Topological orders
T1 T2 T4 T5 T3
5 ways
T3
2) T1 T4 T2 T5
5 ways
Topological orders
T3
T1 T4 T2 T5
5 ways
 There are 10 serial orders.
T3

5 ways
5

4. (c) S2:
8! T1 T2 T3
= 420 r2(A)
4!  2!  2!
r1(A)
w1(A)
5. (2) w2(A)
S: w1(P)r2(P) w3(P)r4(P) w5(P)r6(P) w2(B)
r3(A)
w3(A)
Final write r3(B)
• Can exchange c1
• without violation view equal conditions c3
View equal serial schedules are c2
T1 T2 T3 T4 T5 T6 Here T3 reads the changes of T2 but T3 commits
T3 T4 T1 T2 T5 T6 before T2. So it is not recoverable schedule.
Hence, correct option is (a).

6. (a) 10. (d)


only allow concurrent execution of transaction that T1 T2 T3
correspond to serial execution of some of the r1(A)
transactions. r2(c)
w1(A)
7. (d) r3(A)
All the problems mentioned in option are potential r2(B)
when a DBMS executes multiple transactions w2(B)
concurrently. w3(A)
r3(B)
r2(A)
8. (b)
c1
Every conflict serializable schedules are view c3
serializable but vice versa is not true. However, some c2
view serializable schedules are conflict serializable.
T3 reads the changes of T2 corresponding to B and
commits itself before T2. So this schedule is not
9. (a) recoverable
S1:
T1 T2 T3 T1 T2 T3
r1(A) r1(A)
r2(A) r2(c)
w2(A) w1(A)
r3(A) r3(A)
w1(A) r2(B)
w2(B) w2(B)
r3(B) w3(A)
c2 r3(B)
w3(A) r2(A)
c1 c1
c3 c2
c3
Here the transaction reads the changes of T2 reads the changes of T3 Corresponding to A
uncommitted transaction but commits itself. So and commits itself before committing of T3. So
schedule is recoverable. this schedule is also not recoverable. Hence
answer is option (d).
6

11. (a) by other transaction and then gets committed itself


T1 gets faild after t8, as T1 is uncommitted at t1 time hence it is non recoverable.
and write (P) and T2 reads P at t6 and gets committed. T1 gets failed hence not atomic. Hence correct option
Hence uncommitted transaction changes are got read is a.

Any issue with DPP, please report by clicking here:- https://forms.gle/t2SzQVvQcs638c4r5


For more questions, kindly visit the library section: Link for web: https://smart.link/sdfez8ejd80if

PW Mobile APP: https://smart.link/7wwosivoicgd4


1

Branch : CSE & IT Batch : Hinglish


Database Management System DPP-01
Transaction and Concurrency Contro

[NAT] [MCQ]
1. Two operations are called conflicting operations, if 4. Suppose many concurrent transactions are made to
they satisfy which of the below conditions: run over the same data set and the 2nd transaction
I: They work on same data item. updates the database before the 1st transaction is
II: Both the operations belong to different finished or completed its execution then which one
transactions. among the following property is violated and the
III: There exists at most one write operation. database is no longer consistent.
The number of conditions satisfied for conflicting (a) Durability (b) Isolation
operations is/are ________.
(c) Atomicity (d) Consistency
[MCQ]
[MSQ]
5. Consider the following T1 and T2 transactions:
2. Consider the following schedule S:
P = 0 and Q = 0;
T1 T2 T3
T1: Read(P);
R(x) Read(Q);
W(x) If P = 0 then Q = Q + 10;
R(x) write (B);
W(x) T2: Read(Q);
W(x) Read(P);
Choose the correct statements from the following for If P = 0 then P = P + 15;
above schedule S. write (P);
(a) S is a conflict serializable schedule. The non-serial interleaving of T1 and T2 for
(b) S is a view serializable schedule. concurrent execution leads to
(c) S is a serializable schedule. (a) Serializable Schedule
(d) None of the above. (b) Schedule which is not conflict serializable
schedule.
[NAT] (c) A conflict serializable.
3. For the given schedule S below, the number of (d) None of these.
conflict pairs is/are: [MCQ]
S: 6. Consider the following statements:
T1 T2 T3 S1: If a schedule is view serializable then it may not
R(x) be conflict serializable.
R(x)
S2: If a schedule is conflict serializable then it is also
R(x)
view serializable schedule.
W(y)
(a) Only S1 is true
W(y)
W(y) (b) Only S2 is true
(c) Both S1 & S2 are true
(c) Neither S1 nor S2 is true
2

If a crash occurs just after step 9. Which of the


[MCQ] following is the correct way for recovery?
7. Consider the following log which consists of (a) Undo (T3) then Undo (T1) then Redo (T2)
transactions T1, T2 and T3: (b) Redo (T3) then Undo (T1) then Undo (T2)
Step Details of log (c) Undo (T3) then Redo (T1) then Redo (T2)
1 <T1 Start> (d) None of these.
2 <T1, A, 200, 300>
3 <T1, A, 600, 500> [NAT]
4 <T2 start> 8. Consider the following schedule
5 <T1 commit> S: R1(A), R3(D), W1(B), R2(B), R4(B), W2(C),
6 <T2, B, 600, 400> R5(C), W4(E), R3(E), W5(B)
7 <T2 commit> How many serial schedules are possible which will be
8 <T3 start> view equal to S? __________.
9 <T3, A, 600, 100>
3

Answer Key

1. (2) 5. (b)
2. (b, c) 6. (c)
3. (3) 7. (c)
4. (b) 8. (10)
4

Hints & Solutions


1. (2) 4. (b)
Two operations are called conflicting if the below Isolation allows the multiple transaction to
conditions: occur at the same time without impacting each
I: They work on same data item. other’s execution. The property which first
violated is Isolation that result in loss of
II: Both the operations belong to different
consistency or result will be incorrect.
transactions.
5. (b)
III: There exists one write operation.
T1: R(A) T2: R(B)
Therefore, only two statements are correct.
R(B) R(A)
W(B) W(A)
2. (b, c)
If a schedule S is either conflict serializable or view T1 → T2: ........ W(B) R(B).......
serializable or both then it is serializable. T2 → T1: ........ W(A) R(A) ......
I: Checking conflict serializability using • There is no possibility of non-serial schedule
precedence graph. which becomes serializable by T2 followed by
T1 and T1 followed by T2
• A serial schedule is always serializable but it is
asking about the non-serial schedule.
Hence, option (b) is correct.

6. (c)
S1(true): If a schedule is view serializable then it
may not be conflict serializable.
Cycle exists in the precedence graph; therefore,
the schedule is not conflict serializable. S2(true): If a schedule is conflict serializable then it
is also view serializable schedule
II: Checking for view serializability.
Since there is a cycle in the precedence graph
and also there exists a blind write by 7. (c)
transaction T2 on data item x, so it may or may • T1 and T2 are committed. So, T1 and T2 will
not be view serializable. perform Redo.
Case 1: Initial read on data item x: T1 → T3 • T3 is not committed. So, T3 will Perform Undo.
Case 2: Updated write on data item x: T2 → T3 Hence, option (c) is correct.
Case 3: Final write on data item x: T3
By above three cases we can say the serial
order:
T1 → T2 → T3 8. (10)
Thus, the schedule S is view serializable and Given schedule View Equal
hence serializable.
Final Write: T1 → T5
B  T1 T5 No restriction
3. (3)
C  T2
The conflicting pairs are:
Initial Read: -
w1(y) → w2(y)
Data IR Write -
w1(y) → w3(y) item
w2(y) → w3(y) A T1 -
only 3 conflict pairs exist in the given schedule.
5

D T3 -
Updated Read: T1 → T2
W1(B) → R2(B) T1 → T4
W1(B) → R4(B) T2 → T5
W2(C) → R5(C) T4 → T5
W4(E) → R5(E)
T1 → T2 → T5
T4 must be before T5 and T1 must be before T4
• T1 T4 T2 T5
• T1 T2 T4 T5
T3 can be anywhere there is no any restriction.
Total possibilities = 5 + 5 = 10
Hence, (10) is correct.

Any issue with DPP, please report by clicking here:- https://forms.gle/t2SzQVvQcs638c4r5


For more questions, kindly visit the library section: Link for web: https://smart.link/sdfez8ejd80if

PW Mobile APP: https://smart.link/7wwosivoicgd4

You might also like