You are on page 1of 19

Database

Management Systems
(Solutions for Text Book Practice Questions)

2. ER and Relational Model 05. Ans: (b)


Sol: As there is a key constraint and partial
participation from purchase to dealership,
01. Ans: (b)
the E-R diagram represents “atmost one”
Sol: Derived attribute is an attribute that derives
relationship of car with dealership.
its value from one or more attributes.

06. Ans: (a)


02. Ans: (a)
Sol: M:1
Sol: The E-R model for the description is E1  R E2
M:1

Student Register Course 07. Ans: 19.


Sol: For (StudentName, StudentAge) to be a
S1 S1 C1 C1 key, all the combinations of these two
S2 S2 C1
C2 attributes must be unique.
S3 S3 C2

08. Ans: (b)


Sol: A superkey is one which contains a
03. Ans: (a)
candidate key.
Sol: As every specialized entity is subset of
generalized entity, then the deletion of S.K
C.K
generalized entity requires the deletion of
P.K
specialized entity.

04. Ans: (c)


A key which contains a candidate key
Sol:
(primary key) VY then it will be considered
 Composite attribute is an attribute which
as super key.
is composed of other attributes.
 Multi valued attribute represented with In option (a), (c) and (d) it contains
double ellipse. candidate key (primary key) VY.
 Derived attributes represented with dotted But option (b) doesn’t contain candidate key
ellipse
(primary key) VY. So it is not super key.

ACE Engineering Publications Hyderabad • Delhi • Bhopal • Pune • Bhubaneswar • Lucknow • Patna • Bengaluru • Chennai • Vijayawada • Vizag • Tirupati • Kolkata • Ahmedabad
2 DBMS

09. Ans: (b) 16. Ans: (d)


Sol: All the values present in Foreign key must Sol: Student has 3 attributes and primary key
present in primary key of the referenced attribute of department is added as foreign
relation. key because of M:1 relationship between
student and department.
10. Ans: (c)
Sol: It violates referential integrity constraint as 17. Ans: (b)
it is updating in foreign key but not in Sol: There are some tuples of course may not
primary key. participate with any tuple of professor, then
cid is a key for the relation.
11. Ans: (c)
Sol: When parent is update, it requires child table 18. Ans: (a)
to be updated simultaneously Sol: (AR1B) will be one table as there is total
participation and key constraint.
12. Ans: (c) (CR2) will be the second table as there is a
Sol: 1. On removal of row (2,4), row (5,2) and key constraint.
(7,2) must also be deleted as they depend on
value 19. Ans: (b)
2. On removal of row (5,2), row (9,5) must Sol: As we get key and participation constraint
also be deleted as it depends on value 5. from course to registration, therefore the
number of tuples in registration will be
13. Ans: 0 equal to the tuples in the course table.
Sol: When <3, 8> is deleted, its related tuples in
T2 is (8, 3) and 3 is set to null. Hence the 20. Ans: (b)
number of additional tuples to delete is 0 Sol: Strong entities E1 and E2 are represented as
separate tables, in addition to that many to
14. Ans: (a) many relationship (R2) must be converted as
Sol: As the key constraint from professor, the separate table by having primary key of E1
maximum number of tuples possible in and E2 as foreign key. One to many
Teaches is number of tuples in professor. relationship must be transferred to ‘many’
side table by having primary key of one side
15. Ans: (a) as foreign key. Hence we will have
Sol: minimum of 3 tables.
Professor Teaches Course


ACE Engineering Publications Hyderabad • Delhi • Bhopal • Pune • Bhubaneswar • Lucknow • Patna • Bengaluru • Chennai • Vijayawada • Vizag • Tirupati • Kolkata • Ahmedabad
3 CSIT‐Postal Coaching Solutions

21. Ans: (b) primary key of P side (i.e P1) as foreign key.
Sol: Strong entities E1 and E2 are converted as N is weak entity, so modify N to
separate tables. Since A23 is a multi valued accommodate primary key of P (i.e P1) as
attribute it should also be converted as foreign key.
separate table. Relationship R is transferred Therefore tables are (M1, M2, M3, P1),
to ‘m’ side (E2). (P1, P2), (N1, N2, P1). So correct answer is
(M1, M2, M3, P1).
22. Ans: 3
Sol: E-R model is 26. Ans: (b)
Sol:
Employee manages Department sponsors Project
 An Entity type is represented with one
relation.
The minimum number of relations in  Key attribute becomes primary key for the
relational model is 3. relation
1. (Employee, manages)  Composite attribute is represented with set of
2. Department simple attributes
3. (Project, sponsors)  Weak entity is represented always as a child
table
23. Ans: (c)
Sol: From both Employee and Department we 3. Functional Dependencies
have total participation and key constraint
possible, Which can be converted into one
01. Ans: (d)
relation in relational model.
Sol: As ‘BC’ is key BC→A is satisfied

24. Ans: (b) 02. Ans: (b)


Sol: M, P are strong entities hence they must be Sol: Based on the table values given in query and
represented by separate tables. M table is guidelines below, answer is b. YZ is having
modified to include primary key of P side unique combination, and Y is also having
( i.e P1). N is weak entity, and it is modified
unique values. Hence YZX, YZ are
to include primary key of P (i.e P1).
possible.

25. Ans: (a) 03. Ans: (c)


Sol: M and P are strong entities hence they must Sol: In option ‘C’; if a = 4 first and second tuples
be represented as separate tables. To include are with same AB=(4,2) but it’s ‘C’ is 3 and
R1, M table is modified to accommodate 5 causing AB→C dependency violated

ACE Engineering Publications Hyderabad • Delhi • Bhopal • Pune • Bhubaneswar • Lucknow • Patna • Bengaluru • Chennai • Vijayawada • Vizag • Tirupati • Kolkata • Ahmedabad
4 DBMS

04. Ans: (d) 11. Ans: (d)


Sol: AC+ =A,C,B,E,F,G Sol: AB→C, A→BC both can be determined
from remaining set of FD’s.
05. Ans: (c)
Sol: AF+ = AFDE not ACDEFG as given. 12. Ans: 5
Sol: AC → D can be eliminated, it can be
06. Ans: (c) derived from A → B and CB → D using
Sol: A functional dependency X  Y is said to augmentation and transitive rule.

be trivial iff Y  X. A → B  AC → BC
 AC → D
07. Ans: (b) And remaining FD’s are not possible to
Sol: CD + from functional dependencies eliminate
(FDs) = CDEAB, it includes RHS attributes  5 FD’s are there in minimal cover.
AC so it can be derived from FDs BD+ from
functional dependencies 13. Ans: (b)
(FDs) = BD only, RHS attributes CD are not Sol: As with C we determine B using the
included in the closure hence it cannot be dependencies C  E and C  B, then
derived BC + from functional dependencies
attribute B can be dropped from X.
(FDs) = BCDEA, it includes RHS attributes
CD, so it can be derived from FDs AC+ from
14. Ans: (d)
functional dependencies
Sol: BC→A is inessential as it can be determined
(FDs) = ACBDE, it includes RHS attributes
from the remaining set of dependencies.
BC so it can be derived from FDs

15. Ans: (a)


08. Ans: (c)
Sol: As V → W, delete W from VW → X results
Sol: AC+ contains I then AC→ I dependency is
in V → X
possible.
As V → X, delete X from Y → VX results
in Y → V
09. Ans: (a)
The irreducible set is
Sol: D→E of F is not covered by G.
V→W
10. Ans: (c) V→X
Sol: D→C in set2 and C→D in set1 not covered Y→V
by each other. Y→Z


ACE Engineering Publications Hyderabad • Delhi • Bhopal • Pune • Bhubaneswar • Lucknow • Patna • Bengaluru • Chennai • Vijayawada • Vizag • Tirupati • Kolkata • Ahmedabad
5 CSIT‐Postal Coaching Solutions

16. 23. Ans: (d)


Sol: A  BC Sol: Closure of AEH+ = BEH+= DEH += A, B, C,
AE  H D, E, H. If any closure includes all attributes
CD Minimal set of a table then it can become candidate key
DG of the table. Closure of AEH, BEH, DEH
EF includes all attributes of table. Hence they
are candidate keys.
17. Ans: 24
Sol: 24 +24–23=24. 24. Ans: (b)
Sol: A+ = ABCEFGH
18. Ans: 16 B+ = ABCEFGH
Sol: E+ = ABCEFGH
X F+ = ABCEFGH
Y
CDE ADE All of the above attribute closures contain
ABE all attributes of R, except D. Hence the
Z candidate keys are AD, BD, ED and FD. i.e,
= 23 + 23 + 23 – 22 – 21 – 22 + 21 the number of candidate keys are 4.
= 24 – 10 + 2
= 16 super keys 25. Ans: 3
Sol: The candidate keys are
F
19. Ans: (a)
Sol: Only EC+ contains all attributes of the AB
relation, then EC is key for R. CB

26. Ans: 6
20. Ans: (b)
Sol: AB, AD, EB, ED, CB, CD.
Sol: As ‘K’ is independent attribute, key is
ABDK.
27. Ans: 2
Sol: D, AH
21. Ans: (d)
Sol: ABD+ = A, B, C, D, E.
28. Ans: (c)
Sol:  A candidate key always determines any attribute
22. Ans: (b) of a relation. A superset of a candidate key is
Sol: ACEH+ contains all the attributes of R. called super key and it can determine all the
attributes of a relation


ACE Engineering Publications Hyderabad • Delhi • Bhopal • Pune • Bhubaneswar • Lucknow • Patna • Bengaluru • Chennai • Vijayawada • Vizag • Tirupati • Kolkata • Ahmedabad
6 DBMS

Then decompose into 2NF


4. Normalization
R1 (ADEIJJ)
01. R2 (BFGH)
Sol: 1. C.K = BD, Lossy, Dependency preserving R3 (ABC)
2. C.K = AB, CB, Loss-less, 3NF also in BCNF
Not Dependency preserving R3 (ABC)
3. C.K = A, C, Loss-less, R4 (DIJ)
Dependency preserving R5 (AED)
4. C.K = A, Loss-less, R6 (FGH)
Not Dependency preserving R7 (BF)
5. C.K = A, Lossy, AB+ is key.
Not Dependency preserving
04.
02. Ans: (b) Sol: Candidate key: AC
Sol: R1= A, B A+ = (ABE) R1, C+ = (CD) R2
R2= B, C (ACF) R3
R3= B, D
R2  R3 = B and it is key in R2 (BC). 05. Ans: (c)
(R2  R3)R1 = (B, C, D)  (A, B) = B. B Sol: R is in 1NF as A→FC and B→E are partial
is a key in (B, C, D) as BC, CD. Hence dependencies
it is lossless join but
CD is not preserved. 06.
Sol: (1) C  D
03. CA
Sol: R is in 1NF  decompose to 2NF BC
A+ = {A, D, E, I, J} R1 = 2NF C.K: B, 2NF but not 3NF
B+ = {B, F, G, H} R2 = 2NF (2) 2NF but not 3NF as no partial
D+
dependency CK: BD.
R4 (D I J) (3) R is in 3NF but not in BCNF
R1 (A D E I J)
R5 (A E D)
(4) C.K = A
F+ (5) Candidate Keys = AB, CD, BC, AD
R6 (F G H)
R2 (B F G H) R is in 3NF but not in BCNF.
R7 (B
F)
{A, B, C} R3 BCNF


ACE Engineering Publications Hyderabad • Delhi • Bhopal • Pune • Bhubaneswar • Lucknow • Patna • Bengaluru • Chennai • Vijayawada • Vizag • Tirupati • Kolkata • Ahmedabad
7 CSIT‐Postal Coaching Solutions

07. Ans: (d) storeid, storelocation attributes to new


Sol: Relation R1 satisfies A→B, B→C and relation STORE and make storeid attribute
C→AB dependencies and all the as a foreign key in RECEIPT and primary
determinants are super keys. Hence the key in STORE relations.
relation is in BCNF.
11. Ans: (a)
08. Ans: (a) Sol: Primary key for the table is F1 F2, so
Sol: F = {QR  S, RP, SQ} F1F3 and F2F4 become partial
dependencies therefore it is not even in 2 NF
The decomposed relations Y(PR) and
hence it is in 1 NF.
Z(QRS) satisfying the dependencies {RP}
and {QRS, SQ} respectively. 12. Ans: (a)
Relation Y is in BCNF but relation Z is not Sol: Candidate keys of the relation are A, BC
and E. As all determinants are keys, the
in BCNF because in SQ ; S is not a super
relation is in BCNF.
key.All the dependencies of relation X is
satisfying on relations Y and Z. 13. Ans: (c)
Sol: For option ‘A’: AB is key and B→C is a
09. Ans : (a) partial functional dependency and makes
Sol: As given client id and order id together is a relation is in 1NF but not in 2NF.
key and it is possible to determine For option ‘B’: AB and AC are keys and
Firstname, Lastname of a client using his satisfying the definition of 3NF, that is
client id, then we have the dependency either LHS is super key or RHS is
clientid → Firstname, Lastname which is a a prime attribute.
partial functional dependency. Hence the For option ‘C’: A is key and B→C is
relation is in 1 NF. transitive dependency hence the relation is
in 2NF but not in 3NF.
10. Ans: (c) For option ‘D’: B and C are keys and
Sol: As store id can determine storelocation; here satisfying the definition of BCNF, that is
is a dependency every LHS is a superkey.
storeid → storelocation and it is a partial
functional dependency because key of 14. Ans: (b)
RECEIPT is (customerid, storeid). Sol: (Volume, Number)  Year is a partial
Partial functional dependencies are not functional dependency. So, the given
allowed in 2NF. To convert into 2NF, move relation is in 1 NF but not in 2 NF.

ACE Engineering Publications Hyderabad • Delhi • Bhopal • Pune • Bhubaneswar • Lucknow • Patna • Bengaluru • Chennai • Vijayawada • Vizag • Tirupati • Kolkata • Ahmedabad
8 DBMS

15. Ans: (b) 5. Relational Algebra & Calculus


Sol: To simply the process assume
A= name, B= courseNo, C=RollNo, 01. Ans: (b)
D=grade. Candidate keys are AB, CB. If we Sol: Relational Algebra eliminate duplicates
select AB as the primary key, then C A is always.
allowed in 3 NF (either left side is a key or
right hand side is part of the key). AC is 02. Ans: (d)
allowed since it is prime attribute (an Sol: As R1 ⋈ R2 is based on A = C and B = D
attribute that is part of any candidate key)
means it is selecting the common tuples
from both R1 and R2, which is called R1 
16. Ans: (b)
R2.
Sol: rollno, courseid is superkey in rollno,
courseid→email, rollno is prime attribute in
03. Ans: (a)
email→rollno.
Sol: Π B(r1) – ΠC(r2) =  is always true. Because
‘B’ is foreign key referencing ‘C’ , so ‘C’
17. Ans: (d)
Sol: If relation consists only two attributes must be a primary key, ‘B’ cannot have a
always it satisfies BCNF (no partial and value that is not available in ‘C’. Hence
transitive dependencies). Hence option (a) is operation ΠB(r1)–ΠC(r2) is always .
correct.
If every key consists only one attribute, then 04. Ans: (a)
there is no partial dependency hence option Sol: Common column between tables ‘R’ and ‘S’
(b) is correct. is attribute B. In table ‘R’ B is primary key
If there is dependency X  Y, it is allowed (BA, AC). In table ‘S’ B is foreign key
in 3 NF if either X is a key or Y is part of so join is performed on attribute B.
some key (prime attribute). Hence option (c) Therefore maximum tuples possible in the
is correct. output is equal to rows in Table S (as it has
If there is dependency X  Y, it is allowed less number of rows, provided B values are
not repeated in table ‘S’).
in BCNF if either X is a key or all
determinants are keys Hence option (d) is
incorrect. 05. Ans: (a)
Sol: R in r1 (P,Q,R) is foreign key with 2000
18. Ans: (c) tuples references R (primary key) in r2
Sol: A table is said to be in BCNF if it is already (R,S,T) with 2500 tuples. So natural
in 3 NF and all determinants are keys. matching rows are 2000

ACE Engineering Publications Hyderabad • Delhi • Bhopal • Pune • Bhubaneswar • Lucknow • Patna • Bengaluru • Chennai • Vijayawada • Vizag • Tirupati • Kolkata • Ahmedabad
9 CSIT‐Postal Coaching Solutions

06. Ans: (a) 11. Ans: 1


Sol: As relation ‘r’ need to satisfy both Sol:
P R
conditions F1 and F2, we replace the
X Y Z Y V
  X1 Y1 Z1 Y1 V1
expression σ F 1  σ F2 r  with σ r  X1 Y1 Z2 Y3 V2
  F1  F 2
X2 Y2 Z2 Y2 V3
Using A1 only sufficient in the selection X2 Y2 Z4 Y2 V2
because A1A2.
Result of the expression

   is XX
07. Ans: (c) ( P R )
P .Y  R .Y  R .V V 2
Sol: ‘A’ is a column in relation R, then instead of X
2

joining all the tuples of R, with S we join Q R


only few tuples of R that satisfying the X Y T Y V
condition A = a with S. Which is the X2 Y1 2 Y1 V1
X1 Y2 5 Y3 V2
optimized query. X1 Y1 6 Y2 V3
X3 Y3 1 Y2 V2
08. Ans: (b)
Result of the expression
Sol: bal < 0 filter rows from account ∞ depositor
   is XX
( Q R )
from which we can operate on few rows to X Q .Y  R .Y  Q .T  2
filter b city = “Agra”. 1

The result of (x2) – (x1) = x2


09. Ans: (d)
Sol: The above query finds the Courses in which 12. Ans: (c)
the male students are enrolled. Sol: Output variable should be sid, since it is
division operation returns Sid of suppliers
10. Ans: (d) who supply all parts.
Sol: Minus operator indicates rows available in
LHS table but not in RHS table. In this 13. Ans: (a)
expression, LHS table produces all female Sol: Division operator is used to compare a value
students, RHS table consists students with with all the values of other relation.
less marks hence it produces names of all First expression returns sid’s of sailors who
girl students with more marks than all the reserved all boats called Ganga, and its outer
boy students. query returns those sailor names.

ACE Engineering Publications Hyderabad • Delhi • Bhopal • Pune • Bhubaneswar • Lucknow • Patna • Bengaluru • Chennai • Vijayawada • Vizag • Tirupati • Kolkata • Ahmedabad
10 DBMS

14. Ans: 4 19. Ans: 2


Sol: The output of T1 is: courseName Sol: Relational calculus eliminate the duplicates.
CA {T/B Book (T.Title = B.Title)}
CB
CC 20. Ans: (a)
the output of T2 is: StudentName Sol: SQL, Relational algebra, tuple relational
SA calculus and Domain relational calculus all
SC is representing the same. i.e., all these
SD expressions representing to find the distinct
SF names of all students who score more than
90% in the course numbered 107.
15. Ans: (c)
Sol: The ‘’ operator in tuple calculus will have
6. Structured Query Language (SQL)
same effect as the ‘  ’ intersection operator
in relational algebra.
01. Ans: (b)
Sol: The result of the query is
16. Ans: (c)
Sol: P. duration = 3 months selects all projects of
A B C
duration 3 months
1 4 4
T. pname = P.name selects project names in
the output. 2 5 1
2 5 3
17. Ans: (c) 3 5 2
Sol: In negative queries TRC produces infinite
results hence it is not considered as safe.
02. Ans: (c)
(10  0  30  0)
18. Ans: 4 avg (marks) =  10
4
Sol: Result of given query
P Q U
03. Ans: (c)
2 b 5 Sol: sum (rating)/count(0) is smaller value than
2 b 6 avg(rating).
2 c 5
3 d 6 04. Ans: (c)
Sol: Union operator eliminates the duplicates.

ACE Engineering Publications Hyderabad • Delhi • Bhopal • Pune • Bhubaneswar • Lucknow • Patna • Bengaluru • Chennai • Vijayawada • Vizag • Tirupati • Kolkata • Ahmedabad
11 CSIT‐Postal Coaching Solutions

05. Ans: (a) R S T R S T


Sol: All the three queries return the same results. ab b c c d a b c d
01 1 2 2 3 0 1 2 3
45 5 2 6 7 4 5 2 3
89 5 6
06. Ans: (b) 5 10
10 11 4 5 6 7
10 3 4 5 10 11
Sol: In general a query with a having clause 13 10 4 5 10 3
should also have a group by clause. If you
omit group by ( we can do it) , all the rows Totally ‘5’ tuples in the result.
not excluded by the where clause return as a
single group. All the attributes in select
10. Ans: (c)
clause must appear in Group by else it
violates 1 normal form. But all attributes Sol: Conditions Student. Roll_number
uses on group by clause need not appears in =Grades.Roll_number and Grade.grade=A
select clause. Hence p and s statements are look for students with Grade =A, conditions
correct.
Courses.Course_number
Grades.Course_number and Courses.Instructor
07. Ans: (b)
=Korth
Sol: Select clause contains either aggregate
look for courses taught by Korth. Students
function or the attributes that appear in
group by clause. who received B grades but taught by Korth
will not be retrieved in the query. So it
08. Ans : (c) retrieves name of students who have got an
Sol: If a is key; each group contains only one A grade in at least one of the courses taught
record and the having condition is always
by Korth.
false the result is empty. If a→b does not
hold on R then duplicate entries possible on
11. Ans: 2
‘a’ and each group may contain more than
Sol: It returns two rows.
one rows, therefore the result is non empty.
Student – Name Sum(P.Marks)
Raj 4
09. Ans: 5
Rohit 2
Sol: Natural join is a join among the two
relations with equality condition among all
12. Ans: 5
attributes having the same name.
Sol: For each student it returns one row as an
output.


ACE Engineering Publications Hyderabad • Delhi • Bhopal • Pune • Bhubaneswar • Lucknow • Patna • Bengaluru • Chennai • Vijayawada • Vizag • Tirupati • Kolkata • Ahmedabad
12 DBMS

13. Ans: (c) contain some rows where B is greater than 5


Sol: and when joined with tuples of 'S' whose B
R1 R2 R1 ⋈ R2
A B A C A B C is less than 5 results in some extra rows,
1 5 1 7
1 5 7 when compared with result of Q.
4 9 3 7 null
3 7
4 null 9
17. Ans: (b)
14. Ans: 8 Sol: Inner query finds managerid of manager
Sol: Full outer join of R and S will give T who manages a department with highest
relation. Here NULL entries are taken for R budget and the outer query returns that
and S to include all missing instances of employee name who is a manager
common attribute A while joining R and S.
18. Ans: (b)
15. Ans: (d) Sol: Innermost query retrieves bookno. of a book
Sol: Database Systems.
 Inner join returns the rows that have next query retrieves rollno. who reserved
matching rows of both the relation. Database Systems.
 Left outer join returns all the rows from Hence outer query retrieves student details
left side relation even if there is no who have not reserved Database system
book.
matching row in the right side relation.
 Right outer join returns all the rows from 19. Ans: (b)
right side relation even if there is no Sol: The condition is B>any (1,2,1,3,2,4) and the
matching row in the left side relation. output will be 4.
 Full outer join returns all the rows from
20. Ans: (a)
both the relation even if there is no
Sol: ‘=any’ operator is same as ‘in’ operator
matching row in the other relation.
 Query 4 returns a result, which is
21. Ans: (a)
superset of Query1, Query2 and Query3. Sol: The inner query returns all values of
capacity and P1.capacity is true only for the
16. Ans: (c) maximum capacity.
Sol: Left outer join returns all rows from left side
22. Ans: (b)
relation even if there is no matching row in
Sol: The ALL keyword specifies that the search
the right side relation. In option (c), 'r' may condition is TRUE if the comparison is

ACE Engineering Publications Hyderabad • Delhi • Bhopal • Pune • Bhubaneswar • Lucknow • Patna • Bengaluru • Chennai • Vijayawada • Vizag • Tirupati • Kolkata • Ahmedabad
13 CSIT‐Postal Coaching Solutions

TRUE for every value that the sub query produces salaries for department 5, > Any
returns. If the sub query returns no value, the operator Perfectly produces the desired
condition is TRUE. results.

23. Ans: 7
Sol: The output of the query is ta.player 7. Transactions & Concurrency Control
Klose
Ronaldo
G muller
Fontaine 01. Ans: (d)
Pele Sol: A: Atomicity C: Consistency
Klismann
I: Isolation D: Durability
Kocsis

24. Ans: 2 02. Ans: (b)


Sol: The query finds name of those passengers Sol: The data base system must be consistent
whose age is above 65 and has some before and after the transaction.
reservation for ‘AC’ class.
The output of the query is: pname 03. Ans: (d)
Rohan Sol: Irrespective of failures, the changes made by
Anil a committed transaction must be permanent.

25. Ans: (a) 04. Ans: (b)


Sol: Inner query returns number of orders for Sol: The number of serial schedules are 2
each product, and the outer query returns The number of concurrent schedules
pid’s of products ordered by at least two (5  3)!
are   56
customers. 5!*3!
Then, the total number of non serial
26. Ans: (b) schedules are = (number of concurrent
Sol: Since Q1 consists “not exists”, it produces schedules – number of serial schedules)
undesired results in certain conditions. Ex: If = 56 – 2 = 54
department = 4 and s.salary >= e.salary, or
department = 4 and s.salary <= e.salary, 05. Ans: (d)
condition is always failed hence inner query Sol: Transaction T3 perform read on A, which is
produces non empty set. This makes “not updated by T1 and committed before T1
exists” condition true hence empId is does.
selected for output. In Q2, Inner query

ACE Engineering Publications Hyderabad • Delhi • Bhopal • Pune • Bhubaneswar • Lucknow • Patna • Bengaluru • Chennai • Vijayawada • Vizag • Tirupati • Kolkata • Ahmedabad
14 DBMS

06. Ans: (a) 12.


Sol: As R3(x) is dirty operations which read Sol: (a) Not Conflict Serializable,
W1(x) and is committed before T1. Hence Not View Serializable,
schedule is non-recoverable. Recoverable, Avoids Cascading aborts,
Not strict.
07. Ans: (c) (b) Not Conflict Serializable,
Sol: A recoverable schedule is one where for Not View Serializable,
each pair of transactions Ti and Tj such that Not strict,
Tj reads a data item previously written by Ti, Recoverable, cascading aborts
the commit operation of Ti appear before the (c) Not Conflict Serializable,
read operation of Tj. Views serializable through Thomas write
rule, Serializable,
08. Ans: (b) Recoverable,
Sol: T2 performs dirty read on T3, so T2 should Avoids cascading aborts,
commit after T3 is committed. Not strict
(d) Conflict Serializable,
09. Ans: (b) View Serializable,
Sol: Transaction T2 is reading the data item ‘A’ Serializable,
that was previously written by T1. If T1 fails Not Recoverable,
after time instance 9 requires to rollback Not Avoid cascading aborts,
both T1 and T2, but rollback of T2 is not Not Strict

possible as it is already committed. And the (e) Conflict Serializable,


schedule is not- Recoverable. View Serializable,
Serializable,
10. Ans: (c) Recoverable,
Sol: A schedule is said to be strict if a value Avoids cascading aborts,
written by a transaction T is to be read or strict
written by another transaction until either T (f) Conflict Serializable,
commits or aborts. View serializable,
Serializable,
11. Ans: (b) Recoverable,
Sol: Every cascadeless schedule is recoverable No need cascading aborts,
but need not vice versa. strict

ACE Engineering Publications Hyderabad • Delhi • Bhopal • Pune • Bhubaneswar • Lucknow • Patna • Bengaluru • Chennai • Vijayawada • Vizag • Tirupati • Kolkata • Ahmedabad
15 CSIT‐Postal Coaching Solutions

13. Ans: (a)


Sol: If a schedule is serializable, the topological S2: T1 T2 T3
order of a graph (precedence graph) yields a R(x)
serial schedule. R(y)
R(y)
R(z) R(x)
14. Ans: (a) R(z)
Sol: The above schedule is serializable to serial W(x) W(y)
schedule T3, T1, T2 by constructing the
W(z)
precedence graph. W(z)

15. Ans: (a) Precedence graph


Sol:
S1: T1 T2
T1 T2 T3
R(x)
R(y) T3
R(x) S2 is not conflict serializable
R(y)
R(z)
W(y) 16. Ans: (a)
W(z) Sol: Precedence graph for each of the schedule
R(z)
given is:
W(x)
W(z) S1: S2:
T1 T2 T1 T2
Precedence graph

T1 S4:
T2 S3: T1
T1 T2
T3
For a schedule, whose precedence graph
S1 is conflict serializable to T2T3T1
contains cycles are said to be not conflict
serializable.
T1 T2 T3
R(A) 17. Ans: (d)
W(A)
Sol: S1 and S2 are conflict equivalent to serial
R(A) schedule T2, T3, T1.
W(A) S3 is not conflict equivalent as 2RA, 3WA
W(A) (T2<T3) and 3WA, 2WA (T3<T2) are the
conflict operations. There is no serial

ACE Engineering Publications Hyderabad • Delhi • Bhopal • Pune • Bhubaneswar • Lucknow • Patna • Bengaluru • Chennai • Vijayawada • Vizag • Tirupati • Kolkata • Ahmedabad
16 DBMS

schedule that satisfies both T2<T3 and transaction to release the lock where as an
T3<T2. younger transaction aborts if requesting a
lock held by an older one.
18. Ans: (c) In wound-wait deadlock prevention strategy
Sol: Precedence graph is an younger transactions need to wait for an
T1
older transaction to release the lock but an
T2
older transition requesting a lock held by an
T3 younger one preempts younger transaction
to abort.
19. Ans: (d)
Sol: Let Ti, Tj and Tk are three transactions, if we 24. Ans: (a)
assume blind write of Tk is the last write Sol: In the wait for graph we find a cycle from
operation, then blind writes of other two T31 – T30 – T29 – T31 results in a
transactions appear in two ways i.e deadlock.
Ti–Tj–Tk or
Tj–Ti–Tk 25. Ans: (b)
Sol: 2 PL is based on locks and hence not free
from deadlock but ensures conflict
20. Ans : (c)
serializability. Timestamp ordering protocol
Sol: To perform W(y) T2 acquires Exclusive lock
is based on timestamps ensures conflict
on y, which will be released only after
serializability and also free from deadlock.
commit in strict 2pl. Then request for T1 is
processed only after commit of T2,.
8. Indexing
21. Ans: (c)
Sol: In strict 2 PL, all excusive locks (write
locks) must be released after commit 01. Ans: (a)
statements. Hence Option (c) is correct. Sol: Cluster index is created on a column with
cluster of values (like year, age, branch
22. Ans: (c) where group of students fall under one
group), so it is non-key but requires
Sol: An older transaction requesting a data item
ordering.
held by an younger Tx need to wait.

02. Ans: 400


23. Ans: (c)
Sol: Blocking factor = 512/20=25
Sol: In wait-die deadlock prevention strategy and
Number of data blocks = 10000/25=400
older transaction will wait for younger

ACE Engineering Publications Hyderabad • Delhi • Bhopal • Pune • Bhubaneswar • Lucknow • Patna • Bengaluru • Chennai • Vijayawada • Vizag • Tirupati • Kolkata • Ahmedabad
17 CSIT‐Postal Coaching Solutions

In primary index, the number of index  All the key values in each node are kept in
records= 400 which is number of blocks in sorted order.
multi level index.
08. Ans: 52
03. Ans: (c) Sol: Key =8 Block size = 512,
Sol: Since block size is 210 (=1024 bytes), Block pointer = 2 bytes, the order of B+ tree
2m  2n = 210. Only option (c) satisfies with is maximum number of block pointers in it.
m = 8 and n = 2. (Let ‘n’)
n * 2 + (n – 1) 8  512
04. Ans: (c)
2n + 8n – 8  512
Sol: n*5+(n–1)*(10+8) 512
10n  520
5n+16n–18  512
n  52
23n  530
n  23. 09. Ans: (b)
Sol: n  P + (n-1)k <=B. Where n is order of the
05. Ans: (a)
tree, P is block pointer, k is key value and B
Sol: Insertion of new key is leading to insertion
is block size.
of new node at all 4 levels, in turn it is
leading to insertion of new root node. Hence Therefore n  6 + (n – 1)9 <=1024.
the maximum number of nodes that could be n = 1033/16 = 64 (approximately)
created are 5
10. Ans: 50
06. Ans: 5 Sol: Order of non-leaf node is
Sol: The nodes to access all records with a (n8) + (n–1) 12  1024
“search key greater than or equal to 7 and 8n + 12n – 12  1024
less than 15” is (9), (5), (5, 7) (9, 11) and 20n  1036
(13, 15). n  51
maximum number of keys possible is :50
07. Ans: (b)
Sol: • B+ Tree is a height balanced search tree 11. Ans: (b)
 non leaf nodes have pointers to the next Sol: order of leaf node is n(9+7)+6<=512
16n<=506
level nodes but not to the data records
n <=31
 All the leaf nodes are connected with a
order of internal node is n*6+(n-1)*9<=512
pointer Pnext. 15n<=521
N<=34

ACE Engineering Publications Hyderabad • Delhi • Bhopal • Pune • Bhubaneswar • Lucknow • Patna • Bengaluru • Chennai • Vijayawada • Vizag • Tirupati • Kolkata • Ahmedabad
18 DBMS

The maximum number of entries in the B+ Insert 25


tree leaf node order ‘L’ and internal node of
order ‘i’ of ‘l’ levels is i l *L that is (34)3 * 20 40

31 entries
15 30 50

12. Ans: (b)


10 15 20 25 30 40 50
Sol: All internal nodes, except the root, will have
between n/2 and n children where ‘n’ is the
order of the node. Since the maximum 16. Ans: (a)
number of keys is 5, maximum number of Sol: If we remove K50 in index node, there is no
children a node can have is 6. Number of change in height as still root, index and leaf
keys in a node is n-1. Hence minimum nodes exist.
number of keys = n/2 -1= 6/2 -1= 2. Leaf nodes are now, after Delete 50, the B+
is:
13. Ans: (d)
Sol: The resultant tree after the insertion is 20

15 30
40 45

30 40 45 50 10 15 20 25 30 40

10 15 20 25 30 40
14. Ans: (d)
Sol: Deleting ‘10’ from internal node requires 10
to be replaced with copy of 13. Hence Root now consists: 20
(i) is true, (ii) is true but (iii) is not true
15. Ans: (a)
Sol: Insert 15

40

15 30 50

10 15 20 30 40 50


ACE Engineering Publications Hyderabad • Delhi • Bhopal • Pune • Bhubaneswar • Lucknow • Patna • Bengaluru • Chennai • Vijayawada • Vizag • Tirupati • Kolkata • Ahmedabad

You might also like