{ "@context": "https://schema.org", "@type": "Organization", "name": "Brainscape", "url": "https://www.brainscape.com/", "logo": "https://www.brainscape.com/pks/images/cms/public-views/shared/Brainscape-logo-c4e172b280b4616f7fda.svg", "sameAs": [ "https://www.facebook.com/Brainscape", "https://x.com/brainscape", "https://www.linkedin.com/company/brainscape", "https://www.instagram.com/brainscape/", "https://www.tiktok.com/@brainscapeu", "https://www.pinterest.com/brainscape/", "https://www.youtube.com/@BrainscapeNY" ], "contactPoint": { "@type": "ContactPoint", "telephone": "(929) 334-4005", "contactType": "customer service", "availableLanguage": ["English"] }, "founder": { "@type": "Person", "name": "Andrew Cohen" }, "description": "Brainscape’s spaced repetition system is proven to DOUBLE learning results! Find, make, and study flashcards online or in our mobile app. Serious learners only.", "address": { "@type": "PostalAddress", "streetAddress": "159 W 25th St, Ste 517", "addressLocality": "New York", "addressRegion": "NY", "postalCode": "10001", "addressCountry": "USA" } }

Advanced Relational Algebra and Relational Calculus MCQs Flashcards

(40 cards)

1
Q

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

A

UNION

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

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

A

R

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

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.

A

It returns all combinations of tuples from two relations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

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

A

{t | t ∈ Students AND t.GPA > 3.5}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

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.

A

It lacks the ability to perform aggregations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

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

A

All of the above

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

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

A

The tuples in R that are not in S

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

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.

A

It represents the set of all attributes that can be functionally determined.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

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

A

CROSS JOIN

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

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

A relation with attributes from both R and S

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

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.

A

It is a declarative language that specifies what to retrieve rather than how to retrieve it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

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

A

Limiting the result set to specific values for an attribute

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which operation can be used to find common tuples in two relations?

o A) UNION
o B) INTERSECT
o C) DIFFERENCE
o D) JOIN

A

INTERSECT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

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

A

Tuples from R where attribute A equals 10

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

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.

A

It provides a procedural approach to query execution.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

In tuple relational calculus, which symbol is used to denote the universal quantifier?

o A) ∃
o B) ∀
o C) ∈
o D) ⊆

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

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

A

The intersection of attributes A from R and S

18
Q

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

A

{t | t ∈ Students AND t.Age > 20}

19
Q

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

20
Q

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

21
Q

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.

A

INNER JOIN returns only matching records; OUTER JOIN returns all records.

22
Q

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

A

{s | s ∈ Students AND s.GPA > 3.0}

23
Q

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.

A

Not directly available; it must be expressed using other operations.

24
Q

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.

A

It filters records after aggregation.

25
Which of the following is NOT a characteristic of relational algebra? ## Footnote o A) It is procedural. o B) It is declarative. o C) It uses mathematical operations. o D) It focuses on sets of tuples.
It is declarative.
26
In relational algebra, what does the RENAME operation allow you to do? ## Footnote o A) Change the values of tuples o B) Change the name of a relation or its attributes o C) Filter the result set o D) Perform a join operation
Change the name of a relation or its attributes
27
In which scenario would you typically use a LEFT JOIN? ## Footnote o A) When you want only matching records from both tables. o B) When you want all records from the left table and matching records from the right. o C) When you want to combine data from two unrelated tables. o D) When you want to exclude all records from the left table.
When you want all records from the left table and matching records from the right.
28
Which of the following is true about relational calculus? ## Footnote o A) It is less expressive than relational algebra. o B) It is only used for simple queries. o C) It can express all queries that relational algebra can express. o D) It requires procedural knowledge to use.
It can express all queries that relational algebra can express.
29
What does the term "closure" refer to when discussing a set of functional dependencies? ## Footnote o A) The completion of a database o B) The set of all attributes that can be functionally derived from a given set o C) The removal of duplicate records o D) The final output of a query
The set of all attributes that can be functionally derived from a given set
30
What does the expression R1 ⋈ R2 ON R1.A = R2.B indicate? ## Footnote o A) A cartesian product of R1 and R2 o B) An inner join between R1 and R2 based on the condition that R1.A equals R2.B o C) A union of R1 and R2 o D) A selection of R1 where R1.A equals R2.B
An inner join between R1 and R2 based on the condition that R1.A equals R2.B
31
In relational calculus, what does the expression {t | t ∈ R AND P(t)} mean? ## Footnote o A) Select tuples from R that satisfy predicate P. o B) Select all tuples from R. o C) Select tuples from R that do not satisfy predicate P. o D) Select tuples based on an aggregate function.
Select tuples from R that satisfy predicate P.
32
What is the result of a FULL OUTER JOIN between two relations? ## Footnote o A) Only the matching rows from both relations o B) All rows from both relations, with NULLs where there are no matches o C) A union of both relations o D) An intersection of both relations
All rows from both relations, with NULLs where there are no matches
33
What does the expression π_A,B(R) perform? ## Footnote o A) Selects all attributes A and B from R o B) Projects only attributes A and B from relation R o C) Filters tuples based on attributes A and B o D) Joins relation R with itself
Projects only attributes A and B from relation R
34
What would be the output of R ∩ S if R and S have no common tuples? ## Footnote o A) R o B) S o C) An empty relation o D) R ∪ S
An empty relation
35
What is the purpose of using DISTINCT in a SQL query? ## Footnote o A) To sort the results o B) To remove duplicate rows from the result set o C) To limit the number of rows returned o D) To filter results based on conditions
To remove duplicate rows from the result set
36
Which of the following relational algebra expressions would yield the same result? ## Footnote o A) π_Name(σ_Age>20(Students)) o B) σ_Age>20(π_Name(Students)) o C) Both A and B o D) None of the above
π_Name(σ_Age>20(Students))
37
What is the main characteristic of the RENAME operation in relational algebra? ## Footnote o A) It does not change the number of rows. o B) It changes the values in tuples. o C) It allows for the creation of new relations. o D) It can only rename attributes, not relations.
It does not change the number of rows.
38
In tuple relational calculus, what does the expression ∃x (P(x) ∧ Q(x)) mean? ## Footnote o A) For all x, P(x) and Q(x) are true. o B) There exists at least one x such that both P(x) and Q(x) are true. o C) Neither P(x) nor Q(x) is true for all x. o D) P(x) is true for all x.
There exists at least one x such that both P(x) and Q(x) are true.
39
Which of the following is the primary advantage of relational calculus over relationalalgebra? ## Footnote o A) It is more procedural. o B) It is easier to optimize. o C) It allows for a clearer expression of queries without specifying how to execute them. o D) It can express all operations of relational algebra.
It allows for a clearer expression of queries without specifying how to execute them.
40
What does the expression R - S represent in relational algebra? ## Footnote o A) The union of R and S o B) The intersection 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