Relational Model and Relational Algebra # MCQs Practice set

Q.1 In a relational model, each row in a table is called a:

Column
Tuple
Attribute
Key
Explanation - In relational databases, a row represents a single record and is called a tuple.
Correct answer is: Tuple

Q.2 Which of the following is NOT a property of a relation in a relational database?

Unique rows
Atomic values
Ordered rows
Named attributes
Explanation - In relational databases, the order of rows is irrelevant. Rows can appear in any order.
Correct answer is: Ordered rows

Q.3 The operation in relational algebra that combines tuples from two relations based on a common attribute is called:

Union
Join
Intersection
Difference
Explanation - A join operation combines related tuples from two relations based on a common attribute.
Correct answer is: Join

Q.4 Which relational algebra operation is used to select a subset of tuples that satisfy a given condition?

Projection
Selection
Union
Cartesian Product
Explanation - Selection (σ) retrieves all tuples in a relation that satisfy a specific condition.
Correct answer is: Selection

Q.5 Which operation in relational algebra removes duplicate tuples?

Union
Projection
Selection
Join
Explanation - Projection (π) selects specific columns from a relation and eliminates duplicate tuples.
Correct answer is: Projection

Q.6 A relation schema consists of:

Tuples and attributes
Attributes and domain
Primary keys only
Foreign keys only
Explanation - A relation schema defines the name of the relation, its attributes, and the domain of each attribute.
Correct answer is: Attributes and domain

Q.7 Which of the following is a unary operation in relational algebra?

Union
Intersection
Selection
Cartesian Product
Explanation - Unary operations work on a single relation; Selection (σ) is a unary operation.
Correct answer is: Selection

Q.8 What does the Cartesian Product operation in relational algebra produce?

All possible pairs of tuples from two relations
Only matching tuples
Union of tuples
Difference of tuples
Explanation - Cartesian Product combines every tuple of one relation with every tuple of another relation.
Correct answer is: All possible pairs of tuples from two relations

Q.9 Which of the following is the correct notation for Projection in relational algebra?

σ
π
ρ
τ
Explanation - The symbol π is used for the projection operation in relational algebra.
Correct answer is: π

Q.10 If R(A, B) and S(B, C) are two relations, which operation gives tuples with matching B values?

Union
Join
Difference
Projection
Explanation - A join operation combines tuples from R and S where the B attribute values match.
Correct answer is: Join

Q.11 Which relational algebra operation is commutative?

Union
Selection
Projection
Cartesian Product
Explanation - Union is commutative: R ∪ S = S ∪ R, while selection and projection are not commutative.
Correct answer is: Union

Q.12 In relational algebra, which operation finds tuples present in one relation but not in another?

Intersection
Union
Difference
Join
Explanation - The Difference (−) operation returns tuples in one relation that are not in the other.
Correct answer is: Difference

Q.13 Which of the following best describes an attribute in a relational table?

A row in a table
A column representing a property
A unique key
A set of tuples
Explanation - Attributes define the columns of a table, representing properties of the entity.
Correct answer is: A column representing a property

Q.14 Which operation in relational algebra is used to rename attributes of a relation?

Selection
Projection
Rename
Join
Explanation - The rename operation (ρ) allows changing the name of a relation or its attributes.
Correct answer is: Rename

Q.15 Which of the following is true about primary keys?

They can have duplicate values
They uniquely identify each tuple
They are always integers
They are optional
Explanation - A primary key uniquely identifies each record in a relation and cannot contain NULLs.
Correct answer is: They uniquely identify each tuple

Q.16 What is the result of a natural join between two relations?

Cartesian product of the relations
Tuples combined on common attributes
Union of the relations
Difference of the relations
Explanation - Natural join combines tuples from two relations based on attributes with the same name.
Correct answer is: Tuples combined on common attributes

Q.17 In relational algebra, which operation can be used to eliminate duplicates after projection?

Union
Selection
Projection
Join
Explanation - Projection automatically removes duplicate tuples from the resulting relation.
Correct answer is: Projection

Q.18 Which property ensures that no two tuples in a relation are identical?

Entity integrity
Tuple uniqueness
Referential integrity
Domain constraint
Explanation - Tuple uniqueness ensures that every tuple in a relation is distinct.
Correct answer is: Tuple uniqueness

Q.19 Which relational algebra operation is associative?

Union
Selection
Projection
Rename
Explanation - Union is associative: (R ∪ S) ∪ T = R ∪ (S ∪ T). Selection and projection are not associative.
Correct answer is: Union

Q.20 Which of the following represents a valid domain for an attribute?

Integer values only
Set of allowable values
Unique keys only
All tuples in a relation
Explanation - The domain of an attribute is the set of permitted values that the attribute can take.
Correct answer is: Set of allowable values

Q.21 What is the difference between selection and projection in relational algebra?

Selection chooses columns, projection chooses rows
Selection chooses rows, projection chooses columns
Both choose rows
Both choose columns
Explanation - Selection filters tuples (rows) based on a condition, projection selects specific attributes (columns).
Correct answer is: Selection chooses rows, projection chooses columns

Q.22 Which operation returns tuples common to two relations?

Union
Intersection
Difference
Join
Explanation - Intersection returns only those tuples that exist in both relations.
Correct answer is: Intersection

Q.23 In a relation R(A, B), which of the following ensures that the B values in R reference values in another relation S(B, C)?

Primary key constraint
Foreign key constraint
Unique constraint
Domain constraint
Explanation - A foreign key in one relation ensures referential integrity by referencing primary keys in another relation.
Correct answer is: Foreign key constraint

Q.24 Which relational algebra operation is used to combine tuples from two relations and remove duplicates?

Union
Cartesian Product
Join
Difference
Explanation - Union combines tuples from two relations and automatically removes duplicate tuples.
Correct answer is: Union

Q.25 Which type of join returns all tuples from the left relation and matching tuples from the right relation?

Inner join
Left outer join
Right outer join
Full outer join
Explanation - Left outer join returns all tuples from the left relation and fills NULL for non-matching tuples from the right relation.
Correct answer is: Left outer join