wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Spring2026.DBI202.Chapter2.Quiz

Total questions: 27

Worksheet time: 20mins

Name
Class
Date
1.
Which operator is used to select a subset of rows from a relation that satisfy a specific condition?
a)
Projection (π)
b)
Selection (σ)
c)
Join (⋈)
d)
Union (∪)
2.

The operation that produces a new relation with a subset of columns from the original relation is called (a)   .

3.
Given R(A,B), which expression correctly selects tuples where attribute A equals 10?
a)

πA=10​(R)

b)

σA=10​(R)

c)

ρR(A=10)

d)

R⋈A=10

4.

To combine all tuples from two union-compatible relations, we use the (a)   operator.

5.
What is the result of the Cartesian Product (R×S) if R has 3 tuples and S has 5 tuples?
a)
8 tuples
b)
15 tuples
c)
3 tuples
d)
5 tuples
6.

The (a)   operator, denoted by ⋈, combines tuples from two relations that match on all common attributes.

7.
Which of the following is the correct symbol for the Rename operator?
a)
σ
b)
π
c)
ρ
d)
γ
8.
If we want to find elements that are in relation R but NOT in relation S, we use the expression ________.
a)
R - S
b)
R \ S
c)
Difference
d)

All options are correct

9.

In the expression πname,age​(σage>20​(Students)), which operation is performed first?

a)
Projection
b)
Selection
c)
Rename
d)
Intersection
10.

A Theta-join (R⋈θ​S) is equivalent to a ________ followed by a Selection.

a)
product
b)
cross product
c)
cartesian product
d)

All options are correct

11.
Which operator is used to remove duplicate tuples in its result by definition?
a)
All relational operators
b)
Only Union
c)
Only Projection
d)
None
12.
Given R(A,B) and S(B,C), the Natural Join R⋈S will have which set of attributes?
a)
{A, B, B, C}
b)
{A, B, C}
c)
{A, C}
d)
{B}
13.

To find the intersection of R and S (R∩S) using only Difference (−), the formula is ________.

a)
R - (R - S)
b)
S - (S - R)
c)

R - (S - R)

d)

S - (R - S)

14.
What condition must be met for two relations to be used in a Set Union, Intersection, or Difference?
a)
Same number of tuples
b)
They must be union-compatible
c)
They must have a common key
d)
One must be empty
15.
Which operator would you use to change the schema of a relation without changing the data?
a)
σ
b)

π

c)
d)
×
16.

The result of πL​(R) has a degree equal to the number of attributes in ________.

a)
L
b)
list L
c)

R

d)

π

17.
Which operation is most useful for combining data from different relations based on a common ID?
a)
Cartesian Product
b)
Intersection
c)
Natural Join
d)
Difference
18.

Relations used: Inventory (partID, partName, color), Suppliers (sid, sName, address)

and Catalog (sid, partID, cost).
Find all rows in the Inventory relation with a color attribute of 'Red'.

a)

σcolor=′Red′​(Inventory)

b)

πcolor=′Red′​(Inventory)

c)

ρcolor=′Red′​(Inventory)

d)

color=′Red′​(Inventory)

19.

Relations used:

  • Inventory (partID, partName, color)

  • Suppliers (sid, sName, address)

  • Catalog (sid, partID, cost)

Find the IDs of suppliers (sid) who supply part 'P101'. Answer: πsid​(σpartID=′P101′​( (a)   ))

20.
Given R(A,B) and S(B,C), the Natural Join R⋈S will result in a schema with attributes ________.
a)
{A, B, C}
b)

{B}

c)

{A, R.B, S.B, C}

d)

{A, C}

21.

To find the intersection of R and S using only the Difference operator, the formula is: R−(R−?).

(a)  

22.

Relations used:

  • Inventory (partID, partName, color)

  • Suppliers (sid, sName, address)

  • Catalog (sid, partID, cost)

Find the names of suppliers (sName) who supply 'Red' parts with a cost < 50. Answer:

πsName​(Suppliers⋈(σcolor=′Red′ AND cost<50​(Inventory⋈ (a)   )))

23.

Given:

  • Inventory (partID, partName, color)

  • Suppliers (sid, sName, address)

  • Catalog (sid, partID, cost)

Find partIDs (partID) supplied by both 'Supplier A' AND 'Supplier B'.

a)

πpartID​(σsName=′SupplierA′​(S⋈C)) ∩ πpartID​(σsName=′SupplierB′​(S⋈C))

b)

πpartID​(σsName=′SupplierA′​(S⋈C)) ∪ πpartID​(σsName=′SupplierB′​(S⋈C))

c)

πpartID​(σsName=′SupplierA′ AND sName=′SupplierB′(S⋈C))

d)

πpartID​σsName=′SupplierA′ AND sName=′SupplierB′(S⋈C)

24.

Given:

  • Inventory (partID, partName, color)

  • Suppliers (sid, sName, address)

  • Catalog (sid, partID, cost)

Find the names of parts (partName) that are NOT in the Catalog.

Answer: πpartName​(Inventory)−πpartName​(Inventory⋈?)

(a)  

25.

Relations used:

  • Inventory (partID, partName, color)

  • Suppliers (sid, sName, address)

  • Catalog (sid, partID, cost)

Find the addresses of suppliers in 'Hanoi' who supply 'Blue' or 'Green' parts.

Answer: π (a)   ​(σaddress=′Hanoi′​(Suppliers)⋈Catalog⋈σcolor='Blue' OR color='Green'​(Inventory))

26.

Relations used:

  • Inventory (partID, partName, color)

  • Suppliers (sid, sName, address)

  • Catalog (sid, partID, cost)

Find the IDs of parts supplied by at least two different suppliers.

a)

πC1.partID​(σC1.partID=C2.partID AND C1.sid≠C2.sid​(ρC1​(Catalog)×ρC2​(Catalog)))

b)

πC1.partID​(σC1.partID=C2.partID AND C1.sid≠C2.sid​(ρC1​(Catalog)⋈ρC2​(Catalog)))

c)

πC1.partID​(σC1.partID=C2.partID OR C1.sid≠C2.sid​(ρC1​(Catalog)×ρC2​(Catalog)))

d)

πC1.partID​(σC1.partID≠C2.partID AND C1.sid≠C2.sid​(ρC1​(Catalog)×ρC2​(Catalog)))

27.

Relations used:

  • Inventory (partID, partName, color)

  • Suppliers (sid, sName, address)

  • Catalog (sid, partID, cost)

Find the partID of parts that have the color 'Red' OR have a cost < 10.

a)

πpartID​(σcolor=′Red′​(Inventory))∪πpartID​(σcost<10​(Catalog))

b)

πpartID​(σcolor=′Red′​(Inventory))⋂πpartID​(σcost<10​(Catalog))

c)

πpartID​(σcolor=′Red′​(Inventory))⋂​(σcost<10​(Catalog))

d)

πpartID​(σcolor=′Red′​(Inventory))∪​(σcost<10​(Catalog))