Advanced Relational Algebra and Relational Calculus MCQs Flashcards
(40 cards)
Which algebraic operation in relational algebra can be used to combine the results of
o A) UNION
o B) INTERSECT
o C) DIFFERENCE
o D) JOIN
UNION
What is the result of the operation R ∪ R where R is a relation?
o A) R
o B) R with duplicates removed
o C) An empty relation
o D) A relation with double the tuples of R
R
Which of the following statements is true regarding the Cartesian product?
o A) It combines two relations based on a common attribute.
o B) It returns all combinations of tuples from two relations.
o C) It removes duplicates from the resulting relation.
o D) It is equivalent to an INNER JOIN.
It returns all combinations of tuples from two relations.
In tuple relational calculus, which of the following is a valid expression?
o A) {t | t ∈ Students AND t.GPA > 3.5}
o B) SELECT * FROM Students WHERE GPA > 3.5
o C) Students ∩ Graduates
o D) ALL OF THE ABOVE
{t | t ∈ Students AND t.GPA > 3.5}
What is the main limitation of relational calculus compared to relational algebra?
o A) It cannot express complex queries.
o B) It is more procedural.
o C) It lacks the ability to perform aggregations.
o D) It is less intuitive.
It lacks the ability to perform aggregations.
Which of the following operations can be expressed using relational algebra but not relational calculus?
o A) JOIN
o B) SELECT
o C) PROJECT
o D) All of the above
All of the above
In relational algebra, what does the expression R - S represent?
o A) The intersection of R and S
o B) The union of R and S
o C) The tuples in R that are not in S
o D) The Cartesian product of R and S
The tuples in R that are not in S
What is the significance of the term “closure” in the context of functional dependencies?
o A) It represents the set of all attributes that can be functionally determined.
o B) It indicates the completeness of a relation.
o C) It refers to the elimination of duplicates.
o D) It is a method for optimizing queries.
It represents the set of all attributes that can be functionally determined.
Which type of join will produce the largest result set?
o A) INNER JOIN
o B) LEFT JOIN
o C) RIGHT JOIN
o D) CROSS JOIN
CROSS JOIN
In relational algebra, what is the result of the expression R ⋈ S if R and S have no common attributes?
o A) A relation with attributes from both R and S
o B) An empty relation
o C) A relation with attributes from R only
o D) A relation with attributes from S only
A relation with attributes from both R and S
Which of the following statements about relational calculus is true?
o A) It is procedural and requires an algorithm to execute.
o B) It is a declarative language that specifies what to retrieve rather than how to retrieve it.
o C) It cannot express queries involving aggregates.
o D) It is less powerful than relational algebra.
It is a declarative language that specifies what to retrieve rather than how to retrieve it.
What does the term “domain restriction” refer to in relational calculus?
o A) The use of specific domains in attributes
o B) Limiting the result set to specific values for an attribute
o C) Restricting the types of operations that can be performed
o D) Defining the schema of a relation
Limiting the result set to specific values for an attribute
Which operation can be used to find common tuples in two relations?
o A) UNION
o B) INTERSECT
o C) DIFFERENCE
o D) JOIN
INTERSECT
What does the expression σ_A=10(R) return?
o A) All tuples in R
o B) Tuples from R where attribute A equals 10
o C) The distinct values of A in R
o D) A count of tuples in R with A = 10
Tuples from R where attribute A equals 10
Which of the following is an advantage of using relational algebra over relational calculus?
o A) It is easier to understand.
o B) It can express a wider range of queries.
o C) It provides a procedural approach to query execution.
o D) It is better for academic purposes.
It provides a procedural approach to query execution.
In tuple relational calculus, which symbol is used to denote the universal quantifier?
o A) ∃
o B) ∀
o C) ∈
o D) ⊆
∀
What does the expression π_A(R) ∩ π_A(S) represent?
o A) The union of attributes A from R and S
o B) The intersection of attributes A from R and S
o C) The difference of attributes A from R and S
o D) The Cartesian product of attributes A from R and S
The intersection of attributes A from R and S
Which of the following can be considered a valid relational calculus expression?
o A) {t | t ∈ Students AND t.Age > 20}
o B) Students WHERE Age > 20
o C) SELECT * FROM Students WHERE Age > 20
o D) ALL OF THE ABOVE
{t | t ∈ Students AND t.Age > 20}
What is the result of the expression R ⋈ S if R has 10 tuples and S has 5 tuples, and they join on a common attribute with 3 matching values?
o A) 15 tuples
o B) 30 tuples
o C) 3 tuples
o D) 5 tuples
30 tuples
Which operation in relational algebra is used to rename a relation or its attributes?
o A) SELECT
o B) PROJECT
o C) RENAME
o D) JOIN
RENAME
What is the difference between INNER JOIN and OUTER JOIN?
o A) INNER JOIN returns all records; OUTER JOIN returns only matching records.
o B) INNER JOIN returns only matching records; OUTER JOIN returns all records.
o C) They are the same.
o D) INNER JOIN cannot be used with more than two tables.
INNER JOIN returns only matching records; OUTER JOIN returns all records.
In relational calculus, which of the following is a valid way to express “find all students with a GPA above 3.0”?
o A) {s | s ∈ Students AND s.GPA > 3.0}
o B) SELECT * FROM Students WHERE GPA > 3.0
o C) Students WHERE GPA > 3.0
o D) ALL OF THE ABOVE
{s | s ∈ Students AND s.GPA > 3.0}
Which operation is used to perform a relational division in relational algebra?
o A) INTERSECT
o B) DIFFERENCE
o C) JOIN
o D) Not directly available; it must be expressed using other operations.
Not directly available; it must be expressed using other operations.
What is the significance of the HAVING clause in SQL?
o A) It filters records before aggregation.
o B) It filters records after aggregation.
o C) It sorts the results.
o D) It joins two relations.
It filters records after aggregation.