DBMS_DPP
DBMS_DPP
[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
Answer Key
1. (b) 6. (c)
2. (a) 7. (b)
3. (c) 8. (b)
4. (a) 9. (b, c)
5. (b)
4
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.
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.
[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]
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:
[NAT] [MCQ]
6. Consider the following ER diagram 7. Consider the following ER model:
Answer Key
1. (a) 5. (c)
2. (c) 6. (6)
3. (b) 7. (c)
4. (17)
4
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
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.
[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’; {
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
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.
i i n DPP 01
[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
[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
[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
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.
[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
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
Answer Key
1. (c) 5. (d)
2. (d) 6. (c)
3. (d) 7. (c)
4. (d) 8. (d)
4
(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
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
[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
[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
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)
[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
(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
[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] [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
[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 .
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
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.
[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 PR 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
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
10. (a)
If the query in option a returns non null output, then the
dependency does not hold. Hence (a) option is correct.
[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
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
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).
[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
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
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
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).
[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
Answer Key
1. (2) 5. (b)
2. (b, c) 6. (c)
3. (3) 7. (c)
4. (b) 8. (10)
4
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.