
This set covers ER modelling and relational algebra, two topics that show up in almost every DBMS paper. It is useful for GATE, university semester exams, campus placements and interviews where you are asked to read an ER diagram, count the tables it needs or work out the output of an algebra expression.
How to practise: read each question and tap the option you think is correct. You will see right away whether you got it, along with a short explanation, and your score is tracked at the bottom of the screen. This set has 18 questions.
Topics covered in this set
- Attribute types and ER notation
- Weak entities, cardinality and participation
- ER-to-relational mapping and minimum tables
- Relational algebra operators: select, project, join, division
- Tuple and domain relational calculus basics
DBMS MCQs with answers and explanations
Q1. A table stores date_of_birth for every employee, and age is shown on screen by calculating it from date_of_birth. In ER terms, age is a:
a) Composite attribute
b) Multivalued attribute
c) Derived attribute
d) Key attribute
Q2. In Chen's ER notation, an attribute drawn as a double ellipse represents:
a) A multivalued attribute
b) A derived attribute
c) A composite attribute
d) A key attribute
Q3. In an ER diagram, a double line connecting an entity set to a relationship set indicates:
a) Partial participation
b) A one-to-one relationship
c) The discriminator of a weak entity
d) Total participation
Q4. How is the primary key of a weak entity set formed?
a) From its discriminator (partial key) alone
b) From the primary key of its identifying (owner) entity set combined with its discriminator
c) From any attribute that happens to be unique in the weak entity set
d) From a row id generated automatically by the DBMS
Q5. Each employee works in exactly one department, and a department can have many employees. The relationship has no attributes. When mapping to relations without a separate table for the relationship, where should the foreign key be placed?
a) In EMPLOYEE, referring to DEPARTMENT's primary key
b) In DEPARTMENT, referring to EMPLOYEE's primary key
c) In both EMPLOYEE and DEPARTMENT
d) Nowhere; a separate relationship table is mandatory
Q6. STUDENT and COURSE are related by a many-to-many relationship ENROLLS that has an attribute grade. What is the correct relational mapping of ENROLLS?
a) Add course_id and grade as columns in STUDENT
b) Add student_id and grade as columns in COURSE
c) Create ENROLLS(student_id, course_id, grade) with (student_id, course_id) as the primary key
d) Merge STUDENT and COURSE into a single table
Q7. Entity sets CAR and TRUCK share attributes such as reg_no, make and colour. Combining them into a higher-level entity set VEHICLE is called:
a) Specialization
b) Generalization
c) Aggregation
d) Normalization
Q8. Relation R(A, B) contains the tuples given below. How many tuples does the relational algebra expression π_A(R) return?
A | B 1 | p 1 | q 2 | p 3 | r 2 | q
a) 5
b) 2
c) 4
d) 3
Q9. Together with rename, which set of relational algebra operators is complete, meaning every other operator can be expressed using them?
a) Select, project, union, set difference, Cartesian product
b) Select, project, union, intersection, natural join
c) Select, project, Cartesian product, natural join, division
d) Project, union, intersection, set difference
Q10. R(A, B, C) has 5 tuples and S(D, E) has 4 tuples. What does R × S (Cartesian product) contain?
a) 9 tuples and 5 attributes
b) 20 tuples and 6 attributes
c) 20 tuples and 5 attributes
d) 9 tuples and 6 attributes
Q11. Entity sets E1 (key a1) and E2 (key b1) are connected by a relationship R that is one-to-many from E1 to E2 (each E2 entity is related to at most one E1 entity). R has no attributes and participation is partial on both sides. What is the minimum number of relations needed?
a) 1
b) 3
c) 4
d) 2
Q12. STUDENT(roll_no, name, phone_numbers) has phone_numbers as a multivalued attribute. STUDENT is related to COURSE(course_id, title) by a many-to-many relationship ENROLLS. What is the minimum number of relations in a 1NF relational design?
a) 3
b) 4
c) 5
d) 2
Q13. Given relations R(A, B) and S(B, C) below, how many tuples are in the natural join R ⋈ S?
R: S: A | B B | C 1 | x x | 10 2 | y x | 20 3 | x y | 30 4 | z w | 40
a) 3
b) 4
c) 5
d) 8
Q14. What is the result of Enrolled ÷ Course for the relations below?
Enrolled(sid, cid): Course(cid): S1 | C1 C1 S1 | C2 C2 S2 | C1 S2 | C3 S3 | C1 S3 | C2 S3 | C3
a) {S1, S3}
b) {S1, S2, S3}
c) {S3}
d) {S1}
Q15. R has m tuples and S has n tuples (m, n ≥ 1). What is the minimum possible number of tuples in the left outer join R ⟕ S?
a) 0
b) n
c) min(m, n)
d) m
Q16. Which relational algebra expression is equivalent to the tuple relational calculus query { t | t ∈ Employee ∧ t.salary > 50000 }?
a) π_salary(Employee)
b) σ_salary>50000(Employee)
c) Employee - σ_salary>50000(Employee)
d) π_salary(σ_salary>50000(Employee))
Q17. Why is the tuple relational calculus expression { t | ¬(t ∈ Employee) } called unsafe?
a) Its result can be infinite, since it includes every possible tuple that is not in Employee
b) It uses the universal quantifier
c) It refers to more than one relation
d) It cannot be expressed using a WHERE clause
Q18. Which of the following relational algebra equivalences is NOT valid in general?
a) σ_c1(σ_c2(R)) = σ_c2(σ_c1(R))
b) π_A(π_A,B(R)) = π_A(R)
c) π_A(R - S) = π_A(R) - π_A(S)
d) σ_c(R ∪ S) = σ_c(R) ∪ σ_c(S)
Quick revision notes
- Double ellipse = multivalued, dashed ellipse = derived, double rectangle = weak entity, double diamond = identifying relationship.
- A weak entity's key = owner's primary key + discriminator; it always has total participation in the identifying relationship.
- 1:N mapping: put the 'one' side's key as a foreign key in the 'many' side; M:N always needs a separate relation.
- A multivalued attribute maps to a separate relation (entity key + attribute value).
- Fundamental operators: select, project, union, set difference, Cartesian product, rename.
- Projection in relational algebra removes duplicates; SQL SELECT does not unless DISTINCT is used.
- R ÷ S returns the values of R's other attributes that are paired with every tuple of S.
- Domain relational calculus uses variables over attribute values; tuple relational calculus uses variables over whole tuples.
Frequently asked questions
What is the difference between total and partial participation in an ER diagram?
Total participation means every entity in the set must be involved in at least one instance of the relationship, shown with a double line. Partial participation allows some entities to be unrelated, shown with a single line. It decides whether the foreign key can be NULL after mapping.
When is the division operator used in relational algebra?
Division is used for 'for all' queries, such as finding students who have enrolled in every course offered. It is not a fundamental operator and can be written using projection, Cartesian product and set difference.
Is relational calculus more powerful than relational algebra?
No. Safe tuple relational calculus, safe domain relational calculus and relational algebra have the same expressive power. Algebra is procedural (it says how to compute the result), while calculus is declarative (it says what the result should be).
Comments
Post a Comment