0% found this document useful (0 votes)
143 views15 pages

DBMS Practice Questions Gate 2025

The document provides examples and solutions for drawing entity relationship diagrams and discusses concepts related to relational database models like keys, constraints, and referential integrity. It includes questions about ER diagrams, weak entities, converting ER diagrams to relational schemas, and properties of relational models.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
143 views15 pages

DBMS Practice Questions Gate 2025

The document provides examples and solutions for drawing entity relationship diagrams and discusses concepts related to relational database models like keys, constraints, and referential integrity. It includes questions about ER diagrams, weak entities, converting ER diagrams to relational schemas, and properties of relational models.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

DBMS Practice Questions

1. ER Models

1) Draw an ER diagram to represent: “a person has only one passport and a passport is given
to one person”

Solution:

2) Draw an ER diagram to represent: “a customer can place many orders but a order cannot
be placed by many customers”

Solution:

3) Draw an ER diagram to represent: “many students can study in a single college but a
student cannot study in many colleges at the same time”

Solution:

4) Draw an ER diagram to represent: “a student can be assigned to many projects and a


project can be assigned to many students”.

Solution:

5) Construct an E-R diagram for a car insurance company whose customers own one or more
are each. Each car has associated with it zero to any number of recorded accidents. Each
insurance policy covers one or more ars and has one or more premium payments associated
with it. Each payment is for a particular period of time, and has an associated due date, and
the date when the payment was received.
Solution:

6) Design an E-R diagram for keeping track of the scoring statistics of your favorite sports
team. You should store the matches played, the scores in each match, the players in each
match, and individual player scoring statistics for each match.

Solution:

7) Construct an E-R diagram for a hospital with a set of patients and a set of medical doctors.
Associate with each patient a log of the various tests and examinations conducted.

Solution:
8) A weak entity set can always be made into a strong entity set by adding to its attributes the
primary-key. In this context, choose the statement(s) that are correct [MSQ]

A) This may lead to redundancy.


B) If we add primary-key attributes to the weak entity set, they will be present in both the
entity set, and the relationship set and they need not to be the same.
C) The primary key of a weak entity set can be inferred from its relationship with the strong
entity set.
D) If we add primary-key attributes to the weak entity set, they will be present in both the
entity set, and the relationship set and they have to be the same.

Solution: (A) (C) (D)


The primary key of a weak entity set can be inferred from its relationship with the strong entity
set. If we add primary-key attributes to the weak entity set, they will be present in both the
entity set, and the relationship set and they have to be the same. Hence there will be
redundancy.

9) We can convert any weak entity set to a strong entity set by simply adding appropriate
attributes. Then, the purpose(s) of having weak entity is/are [MSQ]

A) To avoid data duplication/redundancy.


B) Weak entities can be deleted automatically when their strong entity is deleted.
C) Weak entities reflect the logical structure of an entity being dependent on another entity.
D) Can avoid inconsistencies caused by duplicating the key of the strong entity.

Solution: (A)(B)(C)(D)
We have weak entities for several reasons:
• We want to avoid the data duplication and consequent possible inconsistencies caused by
duplicating the key of the strong entity.
• Weak entities reflect the logical structure of an entity being dependent on another entity.
• Weak entities can be deleted automatically when their strong entity is deleted.
10) In an Entity-Relationship (ER) model, suppose R is a many-to-one relationship from entity
set E1 to entity set E2. Assume that E1 and E2 participate totally in R and that the cardinality
of E1 is greater than the cardinality of E2. Which one of the following is true about R?

(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.

Solution: (A)
E1 to E2 is a many to one relationship. Hence,
No entity in E1 can be related to more than one entity in E2, and an entity in E2 can be
related to more than one entity in E1.

11) 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

Answer: (C)

The term ‘entity’ belongs to the ER model and the term ‘relational table’ belongs to the
relational model. ER model supports both multivalued and composite attributes.
In Relation model, an entry in a relational table can have exactly one value or a NULL.
2. Relational Database Model

1) What is/are the advantages of the Relational model? [MSQ]

A) Provides structural Independence.


B) Provides data independence.
C) There is no limit on the size of the values stored in the attributes.
D) Easy to validate domain constraints.

Solution: (A)(B)(D)
Structural Independence: The relational database is only concerned with data and not with a
structure. This can improve the performance of the model.
Data independence: The Structure of Relational database can be changed without having to
change any application.
Relational databases have limits on field lengths which can't be exceeded.
Relational databases provide methods to validate domain constraints.

2) Pick the correct statement(s) among the following. [MSQ]

A) The number of tuples in the relation is known as degree of the relation.


B) The number of attributes in a relation is known as cardinality.
C) An attribute can only take values which lie inside the domain range.
D) Every relation in the database should have at least one set of attributes which defines a
tuple uniquely.

Solution: (C) (D)


The number of attributes in the relation is known as degree of the relation.
The number of tuples in a relation is known as cardinality.
Every relation in the database should have at least one set of attributes which defines a tuple
uniquely. Ex: ROLL_NO in STUDENT relation is a key, as no two students can have the
same roll number.
An attribute can only take values which lie inside the domain range.

3) Pick the correct statement(s) among the following. [MSQ]

A) The value in referencing relation cannot be inserted, if the referencing attribute’s value is
not present in referenced attribute value.
B) A row cannot be deleted or updated from referenced relation, if the value of referenced
attribute is used in value of referencing attribute.
C) A primary key cannot be a composite key.
D) A proper subset of super keys is called a candidate key.

Solution: (A)(B) (D)


Insertion Anomaly in Referencing Relation: The value in referencing relation cannot be
inserted, if the referencing attribute’s value is not present in referenced attribute value.

Deletion/ Updation Anomaly in Referenced Relation: A row cannot be deleted or updated


from referenced relation, if the value of referenced attribute is used in value of referencing
attribute.
A primary key can be a composite key (minimal multiple attributes of a relation uniquely
determining a tuple).

A proper subset of super keys is called a candidate key.

4) Consider the following relational schema.

Emp_ID Name Salary

1234 Anil Kumar 48000

1238 Vishwas 75000


Which of the relational database constraints the above schema may violate?

A) Domain constraints
B) Key constraints
C) Entity Integrity constraints
D) None of the constraints are violated.

Solution: (A)
Domain constraints: Every domain must contain atomic values. Hence, composite and
multi-valued attributes are not allowed.

5) Consider the following relational schema.

Emp_ID Name Salary

1234 Anil 48000

1237 Anand 60000

1238 Vishwas 75000

1238 Naresh 67800


Which of the relational database constraints the above schema may violate?

A) Domain constraints
B) Key constraints
C) Entity Integrity constraints
D) None of the constraints are violated.

Solution: (B)
Key constraints: EMP_ID is the primary key, and third and the last tuple has the same value in
1238, so it is violating the key constraint.

6) Consider the following relational schema.


Emp_ID Name Salary

1234 Anil 48000

1257 Anand 60000

1238 Vishwas 75000

Null Naresh 67800


Which of the relational database constraints the above schema may violate?

A) Domain constraints
B) Key constraints
C) Entity Integrity constraints
D) None of the constraints are violated.

Solution: (C)
Entity Integrity constraints: no primary key can take NULL value, since using primary key we
identify each tuple uniquely in a relation. EMP_ID is the primary key, and last tuple has the
Null value, so it is violating the entity Integrity constraint.

7) Pick the correct statement(s) among the following. [MSQ]

A) In referential integrity it is required that the primary key and the foreign key have the same
data types.
B) Referential integrity requires that a foreign key must have a matching primary key.
C) Referential integrity can be achieved even if the foreign key value is set to null.
D) In referential integrity it is required that the primary key and the foreign key have the same
domain.

Solution: (A)(B)(C) (D)


Referential integrity requires that a foreign key must have a matching primary key or it must
be null.
Also, In referential integrity it is required that the primary key and the foreign key have the
same data types, and have the same domain.

8) Consider the following Student relational schema:


Student ( roll , name , sex , age , address , class , section )

Which of the following is not a super key ?

A) {roll , name , sex , age , address , class , section}


B) {class , section , roll}
C) {class , section , roll , sex}
D) None of these.

Solution: (D)
Al are super keys since each set can uniquely identify each student in the Student table.
9) Let R(A1,A2,A3) be a relational schema with A1 as the candidate key. Then the number of
super keys possible are ________ [NAT]

Solution: 4
Any superset of candidate key A1 is the super key.
Hence, super keys are A1, A1A2, A1A3, A1A2A3.

10) Counting the number of super keys given a candidate key.

Example 1: https://elearning.ravindrababuravula.com/materials/course/15/2459
Example 2: https://elearning.ravindrababuravula.com/materials/course/15/2460
Example 3: https://elearning.ravindrababuravula.com/materials/course/15/2461
Example 4: https://elearning.ravindrababuravula.com/materials/course/15/2462
3. Conversion of ER model to Relational model

Q1) Convert the following ER-model to relational schema.

Solution:

A strong entity set with only simple attributes will require only one table in a relational model.

● Attributes of the table will be the attributes of the entity set.


● The primary key of the table will be the key attribute of the entity set.

Roll_no Name Age

1 Ajay 32

2 Anil 32

3 Vishwa 31

Q2) Convert the following ER-model to relational schema.

Solution:

● A strong entity set with any number of composite attributes will require only one table
in a relational model.
● While conversion, simple attributes of the composite attributes are taken into account
and not the composite attribute itself.

Relational schema: Student ( Roll_no , First_name , Last_name , House_no , Street , City )


Q3) Convert the following ER-model to relational schema.

Solution:
A strong entity set with any number of multi valued attributes will require two tables in
relational model.

● One table will contain all the simple attributes with the primary key.
● Other table will contain the primary key and all the multi valued attributes.

Relational schema: R1(Roll_no, Cityt) R2(Roll_no, Mobile_no)

Q4) Convert the following ER-model to relational schema.

Solution:
A relationship set will require one table in the relational model. Attributes of the table are-

● Primary key attributes of the participating entity sets


● Its own descriptive attributes if any.
● Set of non-descriptive attributes will be the primary key.

Relational schema: Employees (ssn, name, lot) Departments (did, dname, budget)
Works_In ( ssn, did, since)

Q5) Convert the following ER-model to relational schema.

Solution:
Relational schema: A ( a1 , a2 ), R ( a1 , b1 ), B ( b1 , b2 )
Q6) Convert the following ER-model to relational schema.

Solution:
Relational schema: A ( a1 , a2 ) BR ( a1 , b1 , b2 )

Q7) Convert the following ER-model to relational schema.

Solution:
Relational schema: AR ( a1 , a2 , b1 ) B ( b1 , b2 )

Q8) Convert the following ER-model to relational schema.

Solution:
Relational schema: AR ( a1 , a2 , b1 ) B ( b1 , b2 ) OR A ( a1 , a2 ) BR ( a1 , b1 , b2 )

Q9) Convert the following ER-model to relational schema.

Solution:
Because cardinality ratio = 1 : n , so we will combine the entity set B and relationship set R.
Relational schema: A ( a1 , a2 ) and BR ( a1 , b1 , b2 )
Because of total participation, foreign key a1 is NOT NULL.

Q10) Convert the following ER-model to relational schema.

Solution:
If there is a key constraint from both the sides of an entity set with total participation, then that
binary relationship is represented using only one table.
Relational schema: ARB ( a1 , a2 , b1 , b2 )

Q11) Convert the following ER-model to relational schema.

Solution:
Weak entity set always appears in association with identifying relationship with total
participation constraint
Relational schema: A ( a1 , a2 ) BR ( a1 , b1 , b2 )

Q12) Find the minimum number of tables required for the following ER diagram in relational
model

Solution:
Relational schema: Minimum 3 tables will be required:
MR1 (M1 , M2 , M3 , P1) P (P1 , P2) NR2 (P1 , N1 , N2)

Q13) Find the minimum number of tables required to represent the given ER diagram in
relational model

Solution:
Relational schema: minimum 4 tables will be required-
AR1R2 (a1 , a2 , b1 , c1) B (b1 , b2) C (c1 , c2) R3 (b1 , c1)

Q14) Find the minimum number of tables required to represent the given ER diagram in
relational model
Solution:
Relational schema: minimum 5 tables will be required:
BR1R4R5 (b1 , b2 , a1 , c1 , d1) A (a1 , a2) R2 (a1 , c1) CR3 (c1 , c2 , d1) D (d1 , d2)

Q15) Find the minimum number of tables required to represent the given ER diagram in
relational model

Solution:
Relational schema: minimum 3 tables will be required:
E1 (a1 , a2) E2R1R2 (b1 , b2 , a1 , c1 , b3) E3 (c1 , c2)

Q16) Convert the following ER-model to relational schema

Solution:
• Entity-set schemas: job (title, level ) employee (employee_id, employee_name ) branch
(branch_name, branch_city, assets )
• Relationship-set schema: – Primary key includes entity-sets on non-arrow links works_on
(employee_id, branch_name, title )

Q17) Convert the following ER-model to relational schema


Solution:

Q18) Convert the following ER-model to relational schema

Solution:

Q19) Convert the following ER-model to relational schema


Solution:

Q20) Convert the following ER-model to relational schema

Solution:

You might also like