DBMSNotes
DBMSNotes
DBMSNotes
1. In the context of owner and weak entity sets in the ER (Entity-Relationship) data model, which one of the
following statements is TRUE?
A. The weak entity set MUST have total participation in the identifying relationship
B. The owner entity set MUST have total participation in the identifying relationship
C. Both weak and owner entity sets MUST have total participation in the identifying relationship
D. Neither weak entity set nor owner entity set MUST have total participation in the identifying
relationship
2. Let S be the specification: "Instructors teach courses. Students register for courses. Courses are allocated
classrooms. Instructors guide students." Which one of the following ER diagrams CORRECTLY
represents S?
A. (i)
B. (ii)
C. (iii)
D. (iv)
4. Consider the entities 'hotel room', and 'person' with a many to many relationship 'lodging' as shown below:
If we wish to store information about the rent payment to be made by person (s) occupying different
hotel rooms, then this information should appear as an attribute of
A. Person
B. Hotel Room
C. Lodging
D. None of these
5. Given the basic ER and relational models, which of the following is INCORRECT?
A. An attribute of an entity can have more than one value
B. An attribute of an entity can be composite
C. In a row of a relational table, an attribute can have more than one value
D. In a row of a relational table, an attribute can have exactly one value or a NULL value
relational table requires that, in a row, an attribute can have exactly one value or NULL value.
6. Which one of the following is used to represent the supporting many-one relationships of a weak entity set in
an entity-relationship diagram?
A. Diamonds with double/bold border
B. Rectangles with double/bold border
C. Ovals with double/bold border
D. Ovals that contain underlined identifiers
8. In an Entity-Relationship (ER) model, suppose 𝑅 is a many-to-one relationship from entity set E1 to entity set
E2. Assume that E1 and E2 participate totally in 𝑅 and that the cardinality of E1 is greater than the cardinality
of E2.
Which one of the following is true about 𝑅?
A. Every entity in E1 is associated with exactly one entity in E2
B. Some entity in E1 is associated with more than one entity in E2
C. Every entity in E2 is associated with exactly one entity in E1
D. Every entity in E2 is associated with at most one entity in E1
Since it is a many to one relationship from E1 to E2, therefore:
1. No entity in 𝐸1 can be related to more than one entity in 𝐸2. ( hence B is incorrect)
2. An entity in 𝐸2 can be related to more than one entity in 𝐸1.(hence C and D are incorrect).
9. An ER model of a database consists of entity types 𝐴 and 𝐵. These are connected by a relationship 𝑅 which
does not have its own attribute. Under which one of the following conditions, can the relational table for R be
merged with that of A?
A. Relationship 𝑅 is one-to-many and the participation of 𝐴 in 𝑅 is total
B. Relationship 𝑅 is one-to-many and the participation of 𝐴 in 𝑅 is partial
C. Relationship 𝑅 is many-to-one and the participation of 𝐴 in 𝑅 is total
D. Relationship 𝑅 is many-to-one and the participation of 𝐴 in 𝑅 is partial
Which of the following possible relations will not hold if the above ERD is mapped into a relation model?
A. Person (NID, Name)
B. Qualification (NID, ExamID, QualifiedDate)
C. Exam (ExamID, NID, ExamName)
D. Exam (ExamID, ExamName)
13. Consider a relation 𝑅(𝐴,𝐵,𝐶,𝐷,𝐸) with the following three functional dependencies.
𝐴𝐵→𝐶;𝐵𝐶→𝐷;𝐶→𝐸;
The number of superkeys in the relation 𝑅 is ______8________ .
14. Consider the following statements 𝑆1 and 𝑆2 about the relational data model:
𝑆1: A relation scheme can have at most one foreign key.
𝑆2: A foreign key in a relation scheme 𝑅 cannot be used to refer to tuples of 𝑅.
Which one of the following choices is correct?
A. Both 𝑆1 and 𝑆2 are true
B. 𝑆1 is true and 𝑆2 is false
C. 𝑆1 is false and 𝑆2 is true
D. Both 𝑆1 and 𝑆2 are false
According to the data shown in the table, which of the following could be a candidate key of the table?
A. {Last Name}
B. {Room}
C. {Shift}
D. {Room, Shift}
Candidate key:- must be able to uniquely determine every other attribute. i.e., whenever a candidate key value is
repeated, all other values must repeat or in a set, candidate key cannot be repeated.
17. Immunity of the external schemas (or application programs) to changes in the conceptual scheme is referred to
as:
A. Physical Data Independence
B. Logical Data Independence
C. Both (a) and (b)
D. None of the above
Physical data independence:- if we make any change in the physical storage of schema that it will not affect our
logical schema/ conceptual schema like relation table.
Logical data independence:- if we make any change in the conceptual schema it will not affect external schema
or end software using this database.
19. Which of the following is NOT a superkey in a relational schema with attributes 𝑉,𝑊,𝑋,𝑌,𝑍 and primary key
𝑉 𝑌?
A. 𝑉𝑋𝑌𝑍
B. 𝑉𝑊𝑋𝑍
C. 𝑉𝑊𝑋𝑌
D. 𝑉𝑊𝑋𝑌𝑍
the primary key is {V,Y} this should be present in all superkey...check in all option in option B ..{V,Y}
20. If D1,D2,…D𝑛 are domains in a relational model, then the relation is a table, which is a subset of
A. D1⊕D2⊕⋯⊕D𝑛
B. D1×D2×⋯×D𝑛
C. D1∪D2∪⋯∪D𝑛
D. D1∩D2∩⋯∩D𝑛
21. Let R = (A, B, C, D, E, F) be a relation scheme with the following dependencies C→F, E→A, EC→D, A→B.
Which of the following is a key of R?
A. CD
B. EC EC is minimal Super key which can derive all the attributes of relation...
C. AE
D. AC
22. The maximum length of an attribute of type text is
A. 127
B. 255
C. 256
D. It is variable Text types are Variable length types
23. Let 𝑥,𝑦,𝑧,𝑎,𝑏,𝑐 be the attributes of an entity set E. If {𝑥},{𝑥,𝑦},{𝑎,𝑏},{𝑎,𝑏,𝑐},{𝑥,𝑦,𝑧} are superkeys then
which of the following are the candidate keys?
A. {𝑥,𝑦} and {𝑎,𝑏}
B. {𝑥} and {𝑎,𝑏} Minimal superkey Are Also Called Candidate key..
C. {𝑥,𝑦,𝑧} and {𝑎,𝑏,𝑐}
D. {𝑧} and {c}
For (Student Name, Student Age) to be a key for this instance, the value X should NOT be equal
to__19____.
Name and Age together form a key,
25. The maximum number of superkeys for the relation schema R(E, F, G, H) with E as the key is _____.
3 keys F,G,H has 2 choices either present in candidate key or not 2^3 8
26. Consider the relation scheme 𝑅=(𝐸,𝐹,𝐺,𝐻,𝐼,𝐽,𝐾,𝐿,𝑀,𝑁) and the set of functional dependencies{{𝐸,𝐹}→{𝐺},
{𝐹}→{𝐼,𝐽},{𝐸,𝐻}→{𝐾,𝐿},{𝐾}→{𝑀},{𝐿}→{𝑁}}on 𝑅. What is the key for 𝑅?
A. {𝐸,𝐹}
B. {𝐸,𝐹,𝐻}
C. {𝐸,𝐹,𝐻,𝐾,𝐿}
D. {𝐸}
27. Consider a relational table with a single record for each registered student with the following attributes:
Registration_Num: Unique registration number for each registered student
UID: Unique identity number, unique at the national level for each citizen
BankAccount_Num: Unique account number at the bank. A student can have multiple accounts or joint
accounts. This attribute stores the primary account number.
Name: Name of the student
Hostel_Room: Room number of the hostel
A B C
1 1 1
1 1 0
2 3 2
2 3 2
30. Consider a schema 𝑅(𝐴,𝐵,𝐶,𝐷) and functional dependencies 𝐴→𝐵 and 𝐶→𝐷. Then the decomposition of R
into 𝑅1(𝐴,𝐵) and 𝑅2(𝐶,𝐷) is
A. dependency preserving and lossless join
B. lossless join but not dependency preserving
C. dependency preserving but not lossless join
D. not dependency preserving and not lossless join
Here, no common attribute in R1 and R2, therefore lossy join will be there.and both the dependencies are
preserved in composed relations so, dependency preserving.
32. What is the optimized version of the relation algebra expression 𝜋𝐴1(𝜋𝐴2(𝜎𝐹1(𝜎𝐹2(𝑟)))), where 𝐴1,𝐴2 are
sets of attributes in 𝑟 with 𝐴1⊂𝐴2 and 𝐹1,𝐹2 are Boolean expressions based on the attributes in 𝑟?
A. 𝜋𝐴1(𝜎(𝐹1∧𝐹2)(𝑟))
B. 𝜋𝐴1(𝜎(𝐹1∨𝐹2)(𝑟))
C. 𝜋𝐴2(𝜎(𝐹1∧𝐹2)(𝑟))
D. 𝜋𝐴2(𝜎(𝐹1∨𝐹2)(𝑟))
since 𝐴1 is subset of 𝐴2 will get only 𝐴1 attributes as it is in the outside, so we can remove project 𝐴2.
33. Which of the following tuple relational calculus expression(s) is/are equivalent to ∀𝑡 ∈ 𝑟(𝑃(𝑡))?
I. ¬∃𝑡∈𝑟(𝑃(𝑡))
II. ∃𝑡∉𝑟(𝑃(𝑡))
III. ¬∃𝑡∈𝑟(¬𝑃(𝑡))
IV. ∃𝑡∉𝑟(¬𝑃(𝑡))
A. I only
B. II only
C. III only
D. III and IV only
The given statement means for all tuples from r, P is true. III means there does not exist a tuple in r where P is not true. Both
are equivalent.
34. Consider the relations 𝑟1(P, Q, R) and 𝑟2(R, S, T) with primary keys P and R respectively. The relation 𝑟1
contains 2000 tuples and 𝑟2 contains 2500 tuples. The maximum size of the join 𝑟1⋈𝑟2 is :
A. 2000
B. 2500
C. 4500
D. 5000
The common attribute is R and it is the primary key in the second relation. So R value should be distinct (primary key
implies unique) for 2500 rows. Hence when we do join, maximum possible number of tuples is 2000.
35. Which of the following relational query languages have the same expressive power?
I. Relational algebra
II. Tuple relational calculus restricted to safe expressions
III. Domain relational calculus restricted to safe expressions
A. II and III only
B. I and II only
C. I and III only
D. I, II and III All are equivalent in expressive power
36. Let 𝑅1(𝐴, 𝐵, 𝐶) and 𝑅2(𝐷, 𝐸) be two relation schema, where the primary keys are shown underlined, and let C
be a foreign key in 𝑅1 referring to 𝑅2. Suppose there is no violation of the above referential integrity
constraint in the corresponding relation instances 𝑟1 and 𝑟2. Which of the following relational algebra
expressions would necessarily produce an empty relation?
A. Π𝐷(𝑟2) − Π𝐶(𝑟1)
B. Π𝐶(𝑟1) − Π𝐷(𝑟2)
C. Π𝐷(𝑟1⋈𝐶≠𝐷 𝑟2)
D. Π𝐶(𝑟1⋈𝐶=𝐷 𝑟2)
C in 𝑅1 is a foreign key referring to the primary key 𝐷 in 𝑅2. So, every element of 𝐶 must come from
some 𝐷 element.
37. With regards to the expressive power of the formal relational query languages, which of the following
statements is true?
A. Relational algebra is more powerful than relational calculus
B. Relational algebra has the same power as relational calculus
C. Relational algebra has the same power as safe relational calculus
D. None of the above
39. Consider the join of a relation 𝑅 with a relation 𝑆. If 𝑅 has 𝑚 tuples and 𝑆 has 𝑛 tuples then the maximum and
minimum sizes of the join respectively are
A. 𝑚+𝑛 and 0
B. 𝑚𝑛 and 0
C. 𝑚+𝑛 and |𝑚−𝑛|
D. 𝑚𝑛 and m+n
Maximum when no common attribute i.e m*n and minimum when there is a common i.e 0
40. The join operation can be defined as
A. a cartesian product of two relations followed by a selection
B. a cartesian product of two relations
C. a union of two relations followed by cartesian product of the two relations
D. a union of two relations
42. Suppose the adjacency relation of vertices in a graph is represented in a table Adj (𝑋,𝑌). Which of the
following queries cannot be expressed by a relational algebra expression of constant length?
A. List all vertices adjacent to a given vertex
B. List all vertices which have self loops
C. List all vertices which belong to cycles of less than three vertices
D. List all vertices reachable from a given vertex
𝐴 𝐵
𝑆
10 20
𝐴 𝐶
20 30
10 90
30 40
30 45
30 50
40 80
50 95
The total number of tuples obtained by evaluating the following expression 𝜎𝐵<𝐶(𝑅⋈𝑅.𝐴=𝑆.𝐴 𝑆) is ____2____.
44. Give a relational algebra expression using only the minimum number of operators from (∪,−) which is
equivalent to 𝑅 ∩ S. R - (R - S)
45. The relational algebra expression equivalent to the following tuple calculus expression:
{𝑡 ∣ 𝑡 ∈ 𝑟 ∧ (𝑡[𝐴] = 10 ∧ 𝑡[𝐵] = 20)} is
A. 𝜎(𝐴=10∨𝐵=20)(𝑟)
B. 𝜎(𝐴=10)(𝑟) ∪ 𝜎(𝐵=20)(𝑟)
C. 𝜎(𝐴=10)(𝑟) ∩ 𝜎(𝐵=20)(𝑟)
D. 𝜎(𝐴=10)(𝑟) − 𝜎(𝐵=20)(𝑟)
Tuple 𝑡 should have two attributes 𝐴 and 𝐵 such that 𝑡.𝐴=10 and 𝑡.𝐵=20.
So, (Tuples having 𝐴=10)∩( Tuples having 𝐵=20)=(Tuples having 𝐴=10 and B=20).
46. A relation 𝑟(𝐴,𝐵) in a relational database has 1200 tuples. The attribute 𝐴 has integer values ranging
from 6 to 20, and the attribute 𝐵 has integer values ranging from 1 to 20. Assume that the
attributes 𝐴 and 𝐵 are independently distributed.
The estimated number of tuples in the output of 𝜎(𝐴>10) ∨ (𝐵=18) (𝑟) is ____________.
𝑃(𝐴>10) = 10/15 = 2/ 3
𝑃(𝐵=18) = 1/20
𝑃(𝐴>10∧𝐵=18) = 2/3 × 1/20 = 1/ 30
𝑃(𝐴>10∨𝐵=18) = 𝑃(𝐴>10)+𝑃(𝐵=18) – 𝑃(𝐴>10∧𝐵=18) = 2/3 + 1/20 – 1/30 = (40+3–2) / 60 = 41/60
Estimated number of tuples = 41/60 × 1200 = 820
The above answer is TRUE for SQL SELECT but not for Relational Algebra as by theory relational algebra operates on
a set which means all the elements must be distinct. Since we have 15 distinct possible values for 𝐴 and 20 distinct
possible values for 𝐵, in strict relational algebra we’ll get
Estimated number of tuples= 41/60 × (15×20) = 205.
Official Answer: 205 OR 820
47. Which of the following relational calculus expression is not safe?
A. {𝑡∣∃𝑢∈𝑅1(𝑡[𝐴]=𝑢[𝐴])∧¬∃𝑠∈𝑅2(𝑡[𝐴]=𝑠[𝐴])}
B. {𝑡∣∀𝑢∈𝑅1(𝑢[𝐴]="𝑥"⇒∃𝑠∈𝑅2(𝑡[𝐴]=𝑠[𝐴]∧𝑠[𝐴]=𝑢[𝐴]))}
C. {𝑡∣¬(𝑡∈𝑅1)}
D. {𝑡∣∃𝑢∈𝑅1(𝑡[𝐴]=𝑢[𝐴])∧∃𝑠∈𝑅2(𝑡[𝐴]=𝑠[𝐴])}
It returns tuples not belonging to R1 (which is infinitely many). So, it is not safe.
52. Consider the following two tables and four queries in SQL.
Book (isbn, bname), Stock(isbn, copies)
Query 1:
SELECT B.isbn, S.copies FROM Book B INNER JOIN Stock S ON B.isbn=S.isbn;
Query 2:
SELECT B.isbn, S.copies FROM Book B LEFT OUTER JOIN Stock S ON B.isbn=S.isbn;
Query 3:
SELECT B.isbn, S,copies FROM Book B RIGHT OUTER JOIN Stock S ON B.isbn=S.isbn
Query 4:
SELECT B.isbn, S.copies FROM Book B FULL OUTER JOIN Stock S ON B.isbn=S.isbn
Which one of the queries above is certain to have an output that is a superset of the outputs of the other
three queries?
A. Query 1
B. Query 2
C. Query 3
D. Query 4
Left Outer Join Only Display in relation Table As Left side Entities
Right Outer Join Display All in Right Side Entities full outer Join showed all Left And Right Along With Null Values
60. Which commands are used to control access over objects in relational database?
A. CASCADE & MVD
B. GRANT & REVOKE
C. QUE & QUIST
D. None of these
62. In SQL, relations can contain null values, and comparisons with null values are treated as unknown. Suppose
all comparisons with a null value are treated as false. Which of the following pairs is not equivalent?
A. 𝑥=5 𝑛𝑜𝑡(𝑛𝑜𝑡(𝑥=5))
B. 𝑥=5𝑥 > 4 and 𝑥 < 6, where 𝑥 is an integer
C. 𝑥≠5 𝑛𝑜𝑡(𝑥=5) x= null and any condition with null is false;
D. none of the above
SQL won’t remove duplicates like relational algebra projection, we have to remove it explicitly by distinct.
If there are no indexes on the relation SQL will either chose one/more on its own or simply work without any index. No
index would just slow the query but it will surely work.
SQL does not permit 2 attributes to have same name in a relation.
64. Which of the following statements about a relation 𝑅 in first normal form (1NF) is/are TRUE?
A. 𝑅 can have a multi-attribute key
B. 𝑅 cannot have a foreign key
C. 𝑅 cannot have a composite attribute
D. 𝑅 cannot have more than one candidate key
65. In a relational data model, which one of the following statements is TRUE?
A. A relation with only two attributes is always in BCNF.
B. If all attributes of a relation are prime attributes, then the relation is in BCNF.
C. Every relation has at least one non-prime attribute.
D. BCNF decompositions preserve functional dependencies.
66. The following functional dependencies hold true for the relational schema 𝑅{𝑉,𝑊,𝑋,𝑌,𝑍}:
V→W
VW → X
Y → VX
Y→Z
Which of the following is irreducible equivalent for this set of functional dependencies?
A. V → W
V→X
Y→V
Y→Z
B. V → W
W→X
Y→V
Y→Z
C. V → W
V→X
Y→V
Y→X
Y→Z
D. V → W
W→X
Y→V
Y→X
Y→Z
67. If every non-key attribute functionally dependent on the primary key, then the relation will be in
A. First normal form
B. Second normal form
C. Third normal form
D. Fourth Normal form
1 NF: atomic values 2 NF: Full Functional Dependency. 3 NF: No transitive dependency. BCNF: Super Key
68. For a database relation 𝑅(𝑎,𝑏,𝑐,𝑑) where the domain of 𝑎,𝑏,𝑐 and 𝑑 include only atomic value, only the
following functions dependencies and those that can be inferred from them hold
𝑎→𝑐
𝑏→𝑑
The relation is in:
A. First normal form but not in second normal form
B. Second normal form but not in third normal form
C. Third normal form
D. None of the above
Which is the weakest normal form that the new database satisfies, but the old one does not?
A. 1NF
B. 2NF
C. 3NF
D. BCNF
70. Consider the relation 𝑋(𝑃,𝑄,𝑅,𝑆,𝑇,𝑈) with the following set of functional dependencies
𝐹={{𝑃,𝑅}→{𝑆,𝑇},{𝑃,𝑆,𝑈}→{𝑄,𝑅}}
Which of the following is the trivial functional dependency in 𝐹+, where 𝐹+ is closure to F?
A. {𝑃,𝑅}→{𝑆,𝑇} Non Trivial FD
B. {𝑃,𝑅}→{𝑅,𝑇} Semi Non Trivial FD
C. {𝑃,𝑆}→{𝑆} Trivial FD
D. {𝑃,𝑆,𝑈}→{𝑄} Non Trivial FD
73. Which normal form is considered adequate for normal relational database design?
A. 2𝑁𝐹
B. 5𝑁𝐹
C. 4𝑁𝐹
D. 3NF always have decomposition which is dependency preserving and loseless
74. A table has fields 𝐹1,𝐹2,𝐹3,𝐹4,𝐹5 with the following functional dependencies
𝐹1→𝐹3, 𝐹2→𝐹4, (𝐹1.𝐹2)→𝐹5
In terms of Normalization, this table is in
A. 1NF not 2NF as F1 F3 and F2 F4 partial dependency is present
B. 2NF
C. 3NF
D. None of these
75. Relation 𝑅 is decomposed using a set of functional dependencies, 𝐹, and relation 𝑆 is decomposed using
another set of functional dependencies, 𝐺. One decomposition is definitely BCNF, the other is definitely 3𝑁𝐹,
but it is not known which is which. To make a guaranteed identification, which one of the following tests
should be used on the decompositions? (Assume that the closures of 𝐹 and 𝐺 are available).
A. Dependency-preservation
B. Lossless-join
C. BCNF definition
D. 3𝑁𝐹 definition
76. Relation 𝑅 with an associated set of functional dependencies, 𝐹, is decomposed into BCNF. The redundancy
(arising out of functional dependencies) in the resulting set of relations is
A. Zero
B. More than zero but less than that of an equivalent 3𝑁𝐹 decomposition
C. Proportional to the size of F+
D. Indeterminate
If a relation schema is in BCNF then all redundancy based on functional dependency has been removed, although other
types of redundancy may still exist.
X Y Z
1 4 2
1 5 3
1 6 3
3 2 2
78. Consider the schema 𝑅=(𝑆,𝑇,𝑈,𝑉) and the dependencies 𝑆→𝑇,𝑇→𝑈,𝑈→𝑉 and 𝑉→𝑆. Let 𝑅=(𝑅1 and 𝑅2) be a
decomposition such that 𝑅1∩𝑅2≠𝜙. The decomposition is
A. not in 2NF
B. in 2NF but not 3NF
C. in 3NF but not in 2NF
D. in both 2NF and 3NF
Dependencies are S --> T, T --> U, U -->V V --> S
S+ = STUV U+ = UVST
T+ = UVST V+ = VSTU
There is no Partial Dependencies here So it is in 2 NF
RHS of every Dependencies is a Key as well as all are Prime Attributes So it is in 3 NF.
79. R(A, B, C, D) is a relation. Which of the following does not have a lossless join, dependency
preserving 𝐵𝐶𝑁𝐹 decomposition?
A. 𝐴→𝐵,𝐵→𝐶𝐷
B. 𝐴→𝐵,𝐵→𝐶,𝐶→𝐷
C. 𝐴𝐵→𝐶,𝐶→𝐴𝐷
D. 𝐴→𝐵𝐶𝐷
(A) A->B, B->CD
AB, BC, CD B is the key of second and C is the key of third, hence lossless.
ABC, CD. C is key of second, but C->A violates BCNF condition in ABC as C is not a key. We cannot decompose
ABC further as AB->C dependency would be lost. Hence the ANSWER.