Relational-Algebra

Question 1

Consider the following relations P(X,Y,Z), Q(X,Y,T) and R(Y,V).

   

How many tuples will be returned by the following relational algebra query?

x(P.Y=R.Y ∧ R.V=V2)(P × R)) - ∏x(Q.Y=R.Y ∧ Q.T>2)(Q × R))
A
0
B
1
C
2
D
3
       Database-Management-System       Relational-Algebra       GATE 2019
Question 1 Explanation: 
σ(P.Y = R.Y ∧ R.V = V2)(P × R)

x(P.Y = R.Y ∧ R.V = V2)(P × R))

σ(Q.Y = R.Y ∧ Q.T>2)(Q × R)
x(Q.Y = R.Y ∧ Q.T>2)(Q × R))

x(P.Y = R.Y ∧ R.V = V2)(P × R)) - ∏x(Q.Y = R.Y ∧ Q.T>2)(Q × R))
Question 2

Consider the relations r(A, B) and s(B, C), where s.B is a primary key and r.B is a foreign key referencing s.B. Consider the query

    Q: r⋈(σB<5(s))

Let LOJ denote the natural left outer-join operation. Assume that r and s contain no null values.

Which one of the following is NOT equivalent to Q?

A
σB<5 (r ⨝ s)
B
σB<5 (r LOJ s)
C
r LOJ (σB<5(s))
D
σB<5(r) LOJ s
       Database-Management-System       Relational-Algebra       GATE 2018
Question 2 Explanation: 
Consider the following relations r(A, B) and S(B, C), where S.B is a primary key and r.B is a foreign key referencing S.B
Consider the following tables without NULL values.

Q: r⨝(σB<5(S))
The result of σB<5(S) is

The result of σB<5(S) is

Option (A):
The result of r⨝S is

The result of σB<5(r⨝S) is

Option (B):
The result of r LOJ S is

The result of σB<5(r LOJ S) is

Option (C):
The result of σB<5(S) is

Now, the result of r LOJ(σB<5(S))

Option (D):
The result of σB<5(r) is

Now, the result of σB<5(r) LOJ S is

Therefore, from the output of above four options, the results of options, the results of options (A), (B) and (D) are equivalent to Q.
Question 3

Consider a database that has the relation schemas EMP(EmpId, EmpName, DeptId), and DEPT(DeptName, DeptId). Note that the DeptId can be permitted to a NULL in the relation EMP. Consider the following queries on the database expressed in tuple relational calculus.

    (I) {t│∃u ∈ EMP(t[EmpName] = u[EmpName] ∧ ∀v ∈ DEPT(t[DeptId] ≠ v[DeptId]))}
    (II) {t│∃u ∈ EMP(t[EmpName] = u[EmpName] ∧ ∃v ∈ DEPT(t[DeptId] ≠ v[DeptId]))}
    (III) {t│∃u ∈ EMP(t[EmpName] = u[EmpName] ∧ ∃v ∈ DEPT(t[DeptId] = v[DeptId]))}

Which of the above queries are safe?

A
(I) and (II) only
B
(I) and (III) only
C
(II) and (III) only
D
(I), (II) and (III)
       Database-Management-System       Relational-Algebra       GATE 2017 [Set-1]
Question 3 Explanation: 
An expression is said to be safe, if it yield a finite number of tuples, otherwise unsafe.
(I) Gives EmpNames who do not belong to any Department. So, it is going to be a finite number of tuples as a result.
(II) Gives EmpNames who do not belong to some Department. This is also going to have finite number of tuples.
(III) Gives EmpNames who do not belong to same Department. This one will also give finite number of tuples.
All the expressions I, II and III are giving finite number of tuples. So, all are safe.
Question 4

Consider a database that has the relation schema CR(StudentName, CourseName). An instance of the schema CR is as given below.

The following query is made on the database.

         T1 ← πCourseNameStudentName='SA'(CR))
         T2 ← CR ÷ T1

The number of rows in T2 is ____________.

A
4
B
5
C
6
D
7
       Database-Management-System       Relational-Algebra       GATE 2017 [Set-1]
Question 4 Explanation: 
(1) T1 ← πCourseNameStudentName = 'SA'(CR))
The σStudentName = 'SA'(CR) will produce the following

⇾ The result of T1 ← πCourseNameStudentName='SA'(CR)) is

(2) T2 ← CR÷T1
⇾ We see that SA is enrolled for CA, CB and CC.
⇾ T2 will give the StudentNames those who have enrolled for all the CA, C, CC courses. So, the following Students are enrolled for the given 3 courses.

⇾ So, the output of T2 will have 4 rows.
Question 5

Consider two relations R1(A,B) with the tuples (1,5), (3,7) and R2(A,C) = (1,7), (4,9). Assume that R(A,B,C) is the full natural outer join of R1 and R2. Consider the following tuples of the form (A,B,C): a = (1.5,null), b = (1,null,7), c = (3,null,9), d = (4,7,null), e = (1,5,7), f = (3,7,null), g = (4,null,9). Which one of the following statements is correct?  

A
R contains a,b,e,f,g but not c, d.
B
R contains all of a,b,c,d,e,f,g
C
R contains e,f,g but not a,b
D
R contains e but not f,g
       Database-Management-System       Relational-Algebra       GATE 2015 [Set-2]
Question 5 Explanation: 

⋆ So, from the above resultant table, R contains e, f, g only but not a, b.
Question 6

Suppose R1(A, B) and R2(C, D) are two relation schemas. Let r1 and r2 be the corresponding relation instances. B is a foreign key that refers to C in R2. If data in r1 and r2 satisfy referential integrity constraints, which of the following is ALWAYS TRUE?

A
B (r1) - ∏C (r2) = ∅
B
C (r2) - ∏B (r1) = ∅
C
B (r1) = ∏C (r2)
D
B (r1) - ∏C (r2) ≠ ∅
       Database-Management-System       Relational-Algebra       GATE 2012
Question 6 Explanation: 
Referential integrity means, all the values in foreign key should be present in primary key.
So we can say that r2(C) is the superset of r1(B).
So (subset - superset) is always empty.
Question 7

Consider the following relations A, B, C.

How many tuples does the result of the following relational algebra expression contain? Assume that the schema of AUB is the same as that of A.

(AUB)⋈A.Id>40∨C.Id<15 C
A
7
B
4
C
5
D
9
       Database-Management-System       Relational-Algebra       GATE 2012
Question 7 Explanation: 


Performs the cross product and selects the tuples whose A∙Id is either greater than 40 or C∙Id is less than 15. It yields:
Question 8

Which of the following functional dependencies hold for relations R(A, B, C) and S(B, D, E):

B -> A
A -> C

The relation R contains 200 tuples and the rel ation S contains 100 tuples. What is the maximum number of tuples possible in the natural join of R and S (R natural join S)

A
100
B
200
C
300
D
2000
       Database-Management-System       Relational-Algebra       GATE 2010
Question 8 Explanation: 
Given
R(A, B, C) – 200 tuples
S(B, D, E) – 100 tuples
FD’s:
B → A
A → C
― ‘B’ is primary key for R and foreign key of S from the given FDs.
― Maximum tuples in natural join of R and S is min(200, 100) = 100.
Question 9

Let R and S be two relations with the following schema

    R(P,Q,R1,R2,R3)
    S(P,Q,S1,S2)

Where {P, Q} is the key for both schemas. Which of the following queries are equivalent?

    I. ΠP(R ⨝ S)
    II. ΠP(R) ⨝ ΠP(S)
    III. ΠPP,Q(R) ∩ ΠP,Q(S))
    IV. ΠPP,Q(R) - (ΠP,Q(R) - ΠP,Q(S)))
A
Only I and II
B
Only I and III
C
Only I, II and III
D
Only I, III and IV
       Database-Management-System       Relational-Algebra       GATE 2008
Question 9 Explanation: 
Natural join is based on the common columns of the two tables.
We have two common columns in 'R' and 'S' which are 'P' and 'Q'.
(I) Both P and Q are used while doing the join, i.e., both P and Q are used to filter.
(II) Q is not used here for filtering. Natural join is done on all P's from R and all P's from S. So different from option (I).
(III) Through venn diagram it can be proved that A∩B = A - (A-B).
So through above formula we can say that (III) and (IV) are equivalent.
So, finally (I), (III) and (IV) are equivalent.
Question 10

Information about a collection of students is given by the relation studinfo(studId, name, sex). The relation enroll(studId, courseId) gives which student has enrolled for (or taken) that course(s). Assume that every course is taken by at least one male and at least one female student. What does the following relational algebra expression represent?

ΠcourseId((ΠstudIdsex="female"(studInfo))×ΠcourseId(enroll))-enroll)
A
Courses in which all the female students are enrolled.
B
Courses in which a proper subset of female students are enrolled.
C
Courses in which only male students are enrolled.
D
None of the above
       Database-Management-System       Relational-Algebra       GATE 2007
Question 10 Explanation: 
Option A: It is not result the all the female students who are enrolled. So option A is false.
Option B: Yes, True. It selects the proper subset of female students which are enrolled because in the expression we are performing the Cartesian product.
Option C: False. It doesn’t shows (or) display the males students who are enrolled.
Question 11

Let r be a relation instance with schema R = (A, B, C, D). We define r1 = ΠA,B,C(R) and r2 = ΠA,D(R). Let s = r1*r2 where * denotes natural join. Given that the decomposition of r into r1 and r2 is lossy, which one of the following is TRUE?

A
s ⊂ r
B
r ∪ s = r
C
r ⊂ s
D
r * s = s
       Database-Management-System       Relational-Algebra       GATE 2005
Question 11 Explanation: 
Let us consider an example:
Table r: R(A, B, C, D)

Table r1: ΠA,B,C(R)

Table r2: ΠA,D(R)

S = r1 * r2 (* denotes natural join)
Table S:

Table r ⊂ Table S
⇒ r ⊂ S
Question 12

Let R1(A,B,C) and R2(D,E) be two relation schema, where the primary keys are shown underlined, and let C be a foreign key in R1 referring to R2. Suppose there is no violation of the above referential integrity constraint in the corresponding relation instances r1 and r2. Which one of the following relational algebra expressions would necessarily produce an empty relation?

A
ΠD(r2) - ΠC(r1)
B
ΠC(r1) - ΠD(r2)
C
ΠD(r1C≠Dr2)
D
ΠC(r1C=Dr2)
       Database-Management-System       Relational-Algebra       GATE 2004
Question 12 Explanation: 
C be a foreign key in R1 referring to R2.
→ Based on referral integrity C is subset of values in R2 then,
ΠC(r1) - ΠD(r2) results empty relation.
Question 13

Consider the following relation schema pertaining to a students database:

   Student (rollno, name, address)
   Enroll (rollno, courseno, coursename) 

Where the primary keys are shown underlined. The number of tuples in the Student and Enroll tables are 120 and 8 respectively. What are the maximum and minimum number of tuples that can be present in (Student * Enroll), where '*' denotes natural join ?

A
8, 8
B
120, 8
C
960, 8
D
960, 120
       Database-Management-System       Relational-Algebra       GATE 2004
Question 13 Explanation: 
Natural join is a JOIN operation that creates an implicit join cause for you based on common columns in the two tables being joined.
→ In the question only enroll Id's are same with the student table.
→ The no. of minimum and maximum tuples is same i.e., 8, 8.
Question 14

Consider the relation Student (name, sex, marks), where the primary key is shown underlined, pertaining to students in a class that has at least one boy and one girl. What does the following relational algebra expression produce? (Note: p is the rename operator).

The condition in join is "(sex = female ^ x = male ^ marks ≤ m)"

A
names of girl students with the highest marks
B
names of girl students with more marks than some boy student
C
names of girl students with marks not less than some boy students
D
names of girl students with more marks than all the boy students
       Database-Management-System       Relational-Algebra       GATE 2004
Question 14 Explanation: 
In the operator '-' between the two subexpression gives the names of all female students whose marks are greater than the all the male students of the class.
Question 15

With regard to the expressive power of the formal relational query languages, which of the following statements is true?

A
Relational algebra is more powerful than relational calculus.
B
Relational algebra has the same power as relational calculus.
C
Relational algebra has the same power as safe relational calculus.
D
None of the above.
       Database-Management-System       Relational-Algebra       GATE 2002
Question 15 Explanation: 
Relational algebra has the same power as safe relational calculus.
A query can be formulated in safe Relational Calculus if and only if it can be formulated in Relational Algebra.
Question 16

Suppose the adjacency relation of vertices in a graph is represented in a table Adj(X,Y). Which of the following queries cannot be expressed by a relational algebra expression of constant length?

A
List of all vertices adjacent to a given vertex
B
List all vertices which have self loops
C
List all vertices which belong to cycles of less than three vertices
D
List all vertices reachable from a given vertex
       Database-Management-System       Relational-Algebra       GATE 2001
Question 16 Explanation: 
(a) Finding a adjacency vertex for the given vertex is too simple i.e., Adj(X,Y).
(b) Finding a self loop is also simple (Oop(X,X))
(c) If a → b, b → c then c!=a, finding this is also simple.
(d) List all the elements reachable from a given vertex is too difficult in Relational Algebra.
Question 17

Let r and s be two relations over the relation schemes R and S respectively, and let A be an attribute in R. Then the relational algebra expression σA=a(r⋈s) is always equal to

A
σA=a (r)
B
r
C
σA=a (r)⨝s
D
None of the above
       Database-Management-System       Relational-Algebra       GATE 2001
Question 17 Explanation: 
(a) A=a for all r
(b) Display table
(c) A=a for all Tables r and s
Question 18

Given the relations

   employee (name, salary, deptno) and
   department (deptno, deptname, address)  

Which of the following queries cannot be expressed using the basic relational algebra operations (σ, π, ×, ⋈, ∪, ∩, -)?

A
Department address of every employee
B
Employees whose name is the same as their department name
C
The sum of all employees’ salaries
D
All employees of a given department
       Database-Management-System       Relational-Algebra       GATE 2000
Question 18 Explanation: 
The sum of all employee’s salaries can’t be represented by using the given six basic algebra operation. If we want to represent sum of salaries then we need to use aggregation operator.
Question 19

Consider the join of a relation R with a relation S. If R has m tuples and S has n tuples then the maximum and minimum sizes of the join respectively are

A
m + n and 0
B
mn and 0
C
m + n and |m – n|
D
mn and m + n
       Database-Management-System       Relational-Algebra       GATE 1999
Question 19 Explanation: 
For maximum:
Suppose there is no common attribute in R and S due to which natural join will act as cross product. So then in cross product total no. of tuples will be mn.
For minimum:
Suppose there is common attribute in R and S, but none of the row of R matches with rows of S then minimum no. of tuples will be 0.
Question 20

The relational algebra expression equivalent to the following tuple calculus expression:

{t| t ∈ r ∧(t[A] = 10 ∧ t[B] = 20)} is
A
σ(A=10∨B=20) (r)
B
σ(A=10) (r) ∪ σ(B=20) (r)
C
σ(A=10) (r) ∩ σ(B=20) (r)
D
σ(A=10) (r) - σ(B=20) (r)
       Database-Management-System       Relational-Algebra       GATE 1999
Question 20 Explanation: 
The given relational algebra expression represents tuples having A=10 and B=20 which is equivalent to
σ(A=10) (r) ∩ σ(B=20) (r)
Question 21

Given two union compatible relations R1(A,B) and R2(C,D), what is the result of the operation R1A = CAB = DR2?

A
R1 ∪ R2
B
R1 × R2
C
R1 - R2
D
R1 ∩ R2
       Database-Management-System       Relational-Algebra       GATE 1998
Question 21 Explanation: 
The join here will be selecting only those tuples where A=C and B=D, meaning it is the intersection.
Question 22

Which of the following query transformations (i.e. replacing the l.h.s. expression by the r.h.s. expression) is incorrect? R1 and R2 are relations, C1, C2 are selection conditions and A1, A2 are attributes of R1?

A
σC1C1(R1)) → σC2C2(R1))
B
σC1A1(R1)) → σA1C1(R1))
C
σC1(R1 ∪ R2) → σC1(R1) ∪ σC1
D
πA1C1(R1)) → σC1A1(R1))
       Database-Management-System       Relational-Algebra       GATE 1998
Question 22 Explanation: 
If the selection condition is on attribute A2, then we cannot replace it by RHS as there will not be any attribute A2 due to projection of A1 only.
Question 23

Give a relational algebra expression using only the minimum number of operators from (∪, −) which is equivalent to R ∩ S.

A
Out of syllabus (For explanation see below)
       Database-Management-System       Relational-Algebra       GATE 1994
Question 23 Explanation: 
R - (R - S)
→ No need of using Union operation here. → In question they gave (∪, −) but we don't use both.
→ And also they are saying that only the minimum number of operators from (∪, −) which is equivalent to R ∩ S.
So, the expression is minimal.
Question 24

Consider a selection of the form σA≤100(r), where r is a relation with 1000 tuples. Assume that the attribute values for A among the tuples are uniformly distributed in the interval [0, 500]. Which one of the following options is the best estimate of the number of tuples returned by the given selection query ?

A
50
B
100
C
150
D
200
       Database-Management-System       Relational-Algebra       GATE 2007-IT
Question 24 Explanation: 
σA≤100(r), r has 1000 tuples.
Values for A among the tuples are uniformly distributed in the interval [0, 500]. This can be split to 5 mutually exclusive and exhaustive intervals of same width of 100 ([0-100], [101-200], [201-300], [301-400], [401-500], 0 makes the first interval larger - this must be type in this question) and we can assume all of them have same number of values due to uniform distribution. So no. of tuples with A value in first interval should be,
Total no. of tuples/5 = 1000/5 = 200
Question 25

Consider the following relation schemas:
b-Schema = (b-name, b-city, assets)
a-Schema = (a-num, b-name, bal)
d-Schema = (c-name, a-number)

Let branch, account and depositor be respectively instances of the above schemas. Assume that account and depositor relations are much bigger than the branch relation.

Consider the following query:

 Пc-nameb-city = "Agra" ⋀ bal < 0 (branch ⋈ (account ⋈ depositor)  

Which one of the following queries is the most efficient version of the above query?

A
Пc-namebal < 0b-city = “Agra” branch ⋈ account) ⋈ depositor)
B
Пc-nameb-city = “Agra”branch ⋈ (σbal < 0 account ⋈ depositor))
C
Пc-nameb-city = “Agra” branch ⋈ σb-city = “Agra” ⋀ bal < 0 account) ⋈ depositor)
D
Пc-nameb-city = “Agra” ⋀ bal < 0 account ⋈ depositor))
       Database-Management-System       Relational-Algebra       GATE 2007-IT
Question 25 Explanation: 
Answer should be (A) and not (B), because we are doing a join between two massive tables whereas in (A) we are doing join between relatively smaller table and larger one and the output that this inner table gives (which is smaller in comparison to join that we are doing in (B)) is used for join with depositor table with the selection condition.
Options (C) and (D) are invalid as there is no b-city column in a-schema.
Question 26

Consider the relations r1(P, Q, R) and r2(R, S, T) with primary keys P and R respectively. The relation r1 contains 2000 tuples and r2 contains 2500 tuples. The maximum size of the join r1⋈ r2 is :

A
2000
B
2500
C
4500
D
5000
       Database-Management-System       Relational-Algebra       GATE 2006-IT
Question 26 Explanation: 
r1⋈ r2 is a join operation done on the common attribute R. So this can have 2000 tuples.
Question 27
Which operation is used to extract specific columns from a table?
A
Project
B
Join
C
Extract
D
Substitute
       Database-Management-System       Relational-Algebra       ISRO-2007
Question 27 Explanation: 
Projection (π)
Projection is used to project required column data from a relation. By Default projection removes duplicate data.
Example :
R(A B C)
----------
1 2 4
2 2 3
3 2 3
4 3 4
π (BC)
B C
-----
2 4
2 3
3 4
Question 28
The join operation can be defined as
A
a cartesian product of two relations followed by a selection
B
a cartesian product of two relations
C
a union of two relations followed by cartesian product of the two relations
D
a union of two relations
       Database-Management-System       Relational-Algebra       ISRO CS 2008
Question 28 Explanation: 

→ The join operation can be defined as a cartesian product of two relations followed by a selection.

→ A SQL JOIN clause is used to combine rows from two or more tables, based on a related column between them.

Different Types of SQL JOINs

1. INNER JOIN: Returns records that have matching values in both tables



2. LEFT (OUTER) JOIN: Return all records from the left table, and the matched records from the right table



3. RIGHT (OUTER) JOIN: Return all records from the right table, and the matched records from the left table



4. FULL (OUTER) JOIN: Return all records when there is a match in either left or right table


Question 29
Consider the join of a relation R , with a relation S . If R has m number of tuples and S has n number of tuples then the maximum and minimum sizes of the join respectively are:
A
m + n & 0
B
mn & 0
C
m + n & | m – n |
D
mn & m + n
       Database-Management-System       Relational-Algebra       ISRO-2016
Question 29 Explanation: 
For maximum:
If there is common attribute in R and S, and every row of R match with every row of S then total no. of tuples will be mn.
For minimum:
If there is no common attribute between R and S or if there is common attribute but none of the row of R matches with rows of S then output tuples will be 0.
Question 30
Given the relations employee (name, salary, dept-no), and department (dept-no, dept-name,address) Which of the following queries cannot be expressed using the basic relational algebra operations (σ, π, x, -, ∪, p)
A
Department address of every employee
B
Employees whose name is the same as their department name
C
The sum of all employees’ salaries
D
All employees of a given department
       Database-Management-System       Relational-Algebra       ISRO-2016
Question 30 Explanation: 
The sum of all employee salaries can’t be represented by using the given six basic algebra operation. If we want to represent sum of salaries then we need to use aggregation operator.
Question 31
Which of the following is a fundamental operation in relational algebra?
A
Set intersection
B
Assignment
C
Natural Join
D
None of the above
       Database-Management-System       Relational-Algebra       Nielit Scientist-B IT 4-12-2016
Question 31 Explanation: 
Fundamental operation in relational algebra
1.Select
2.Project
3.Cartesian Product
4.Rename
5.Union
6.Set Difference
Question 32
Which of the following is a fundamental operation in relational algebra?
A
Set intersection
B
Natural Join
C
Assignment
D
None of the above
       Database-Management-System       Relational-Algebra       Nielit Scientist-B IT 4-12-2016
Question 32 Explanation: 
Fundamental operation in relational algebra 1.Select
2.Project
3.Cartesian Product
4.Rename
5.Union
6.Set Difference
Question 33

Consider the schema R = (A, B, C, D, E, F) on which the following functional dependencies hold :

A ➝ B
B, C ➝ D
E ➝ C
D ➝ A

What are the candidate keys of R ?

A
AEF, BEF and DEF
B
AEF, BEF and BCF
C
AE and BE
D
AE, BE and DE
       Database-Management-System       Relational-Algebra       UGC-NET CS 2018 DEC Paper-2
Question 33 Explanation: 
EFA+ = {EFABCD}
EFB+ = {EFABCD}
EFC+ = {EFC}
EFD+ = {EFDCAB}
So, EFA, EFB, EFD are the keys for the given relation R = (A, B, C, D, E, F).
Question 34
A tuple in relation DBMS is a equivalent to
A
Record
B
Field
C
File
D
Database
       Database-Management-System       Relational-Algebra       NieLit STA 2016 March 2016
Question 34 Explanation: 
A tuple in relation DBMS is a equivalent to record
Equivalent Database Concepts
Relation → Table
Tuple → Row or record
Attribute → Column or field
Cardinality → Number of rows
Degree → Number of columns
Primary key → Unique identifier
Domain → Pool of legal values
Question 35
If R is a relation in relational data Model and A1,A2,..An are the attributes of relation R, what is the cardinality of R expressed in terms of domain of attributes?
A
|R|<=|dom(A1)X dom(A2)..dom(An)|
B
|R|>=|dom(A1)X dom(A2)..dom(An)|
C
|R|=max(|dom(A1)|,|dom(A2)|,..|dom(An)|)
D
|R|=min(|dom(A1)|,|dom(A2)|,..|dom(An)|)
       Database-Management-System       Relational-Algebra       Nielit Scientist-B IT 22-07-2017
Question 35 Explanation: 
● In the context of databases, cardinality refers to the uniqueness of data values contained in a column.
● Cardinality refers to a number. It gives the number of unique values that appear in the table for a particular column.
● For eg: you have a table called Person with column Gender. Gender column can have values either 'Male' or 'Female''.
● Then the cardinality of Gender column is 2, since there are only two unique values that could possibly appear in that column – Male and Female.
Question 36
A table joined with itself is called
A
join
B
self join
C
outer join
D
Equi join
       Database-Management-System       Relational-Algebra       Nielit Scientist-B IT 22-07-2017
Question 36 Explanation: 
● A self join is a join in which a table is joined with itself (which is also called Unary relationships), especially when the table has a FOREIGN KEY which references its own PRIMARY KEY.
● To join a table itself means that each row of the table is combined with itself and with every other row of the table.
Question 37
Consider the join of a relation R with relation S. If R has m tuples and S has n tuples, then the maximum size of join is
A
mn
B
m+n
C
(m+n)/2
D
2(m+n)
       Database-Management-System       Relational-Algebra       Nielit Scientist-B IT 22-07-2017
Question 37 Explanation: 
For maximum:
If there is common attribute in R and S, and every row of R match with every row of S then total no. of tuples will be mn.
Question 38
which of the following desired features are beyond the capability of relational algebra?
A
Aggregate Computation
B
Multiplication
C
Finding transitive closure
D
All of the above
       Database-Management-System       Relational-Algebra       Nielit Scientific Assistance IT 15-10-2017
Question 38 Explanation: 
● Aggregate Computation is a a function to a collection of values to generate a single result.
● Multiplication means cartesian product
●Transitive closure:
Given a domain D, let binary relation R be a subset of D×D. The transitive closure R​ +​ of R is the smallest subset of D×D that contains R and satisfies the following condition:
∀ x∀y∀z((x, y ) ∈ R + ⋀ ( y, z ) ∈ R + ⇒ ( x, z ) ∈ R + )
Question 39
______ operation preserves those tuples that would be lost in____
A
Natural join, outer join
B
Outer join, natural join
C
Left outer join, right outer join
D
Left outer join, natural join
       Database-Management-System       Relational-Algebra       KVS 22-12-2018 Part-B
Question 39 Explanation: 
→ A NATURAL JOIN is a JOIN operation that creates an implicit join clause for you based on the common columns in the two tables being joined. Common columns are columns that have the same name in both tables.
→ A NATURAL JOIN can be an INNER join, a LEFT OUTER join, or a RIGHT OUTER join. The default is INNER join.
→ The SQL OUTER JOIN returns all rows from both the participating tables which satisfy the join condition along with rows which do not satisfy the join condition. The SQL OUTER JOIN operator (+) is used only on one side of the join condition only.
Question 40
Consider two database relations R and S having 3 tuples in R and 2 tuples in S. What is the maximum number of tuples that could appear in the natural join of R and S?
A
6
B
2
C
3
D
5
       Database-Management-System       Relational-Algebra       KVS DEC-2017
Question 40 Explanation: 
→ If the tables R and S contains common attributes and value of that attribute in each tuple in both tables are same, then the natural join will result n*m tuples as it will return all combinations of tuples.
Consider following two tables

→ Result of natural join R * S (If domain of attribute C in the two tables are same )
→ You can see both R and S contain the attribute C whose value is 2 in each and every tuple. Table R contains 3 tuples, Table S contains 2 tuples, where Result table contains 3*2=6 tuples.
Note: While performing a natural join, if there were no common attributes between the two relations, Natural join will behave as Cartesian Product.
Question 41
In relational databases, the natural join of two tables is
A
cartesian product always
B
combination of union and filtered cartesian product
C
combination of selection and filtered cartesian product
D
combination of projection and filtered cartesian product
       Database-Management-System       Relational-Algebra       KVS DEC-2017
Question 41 Explanation: 
→While performing a natural join, if there were no common attributes between the two relations, Natural join will behave as Cartesian Product.
→ Example: If the tables R and S contains common attributes and value of that attribute in each tuple in both tables are same, then the natural join will result n*m tuples as it will return all combinations of tuples.
Question 42
In RDBMS, which type of Join returns all rows that satisfy the join condition ?
A
Inner Join
B
Outer Join
C
Semi Join
D
Anti Join
       Database-Management-System       Relational-Algebra       UGC NET CS 2018 JUNE Paper-2
Question 42 Explanation: 
Inner Join : Inner join combines two tables having a common attributes. While combining it only join the rows of two tables having same value in common attribute. So in that way inner join return the records having matching values in both the tables.
Question 43
Consider the relations R(A, B) and S(B, C) and the following four relational algebra queries over R and S:

I. ΠA, B (R ⨝ S)

II. R ⨝ ΠB(S)

III. R ∩ (ΠA(R) × ΠB(S))

IV. ΠA, R.B (R × S)

where R⋅B refers to the column B in table R.

One can determine that:

A
I, III and IV are the same query.
B
II, III and IV are the same query.
C
I, II and IV are the same query.
D
I, II and III are the same query.
       Database-Management-System       Relational-Algebra       UGC NET CS 2016 July- paper-3
Question 43 Explanation: 




Question 44
Semi-join strategies are techniques for query processing in distributed database system. Which of the following is a semi-join technique ?
A
Only the joining attributes are sent from one site to another and then all of the rows are returned.
B
All of the attributes are sent from one site to another and then only the required rows are returned.
C
Only the joining attributes are sent from one site to another and then only the required rows are returned.
D
All of the attributes are sent from one site to another and then only the required rows are returned.
       Database-Management-System       Relational-Algebra       UGC NET CS 2016 July- paper-3
Question 44 Explanation: 
A semi-join returns one copy of each row in the first table for which at least one match is found. Semi-join is like EXCEPT command in SQL.
Question 45
Suppose database table T1(P, R) currently has tuples {(10, 5), (15, 8), (25, 6)} and table T2 (A, C) currently has {(10, 6), (25, 3), (10, 5)}. Consider the following three relational algebra queries RA1, RA2 and RA3:



The number of tuples in the resulting table of RA1, RA2 and RA3 are given by:
A
2, 4, 2 respectively
B
2, 3, 2 respectively
C
3, 3, 1 respectively
D
3, 4, 1 respectively
       Database-Management-System       Relational-Algebra       UGC NET CS 2016 Aug- paper-3
Question 45 Explanation: 


Question 46
Consider the following three tables R, S and T. In this question, all the join operations are natural joins (⨝). (π) is the projection operation of a relation:

A
(a)
B
(b)
C
(c)
D
(d)
       Database-Management-System       Relational-Algebra       UGC NET CS 2015 Dec - paper-3
Question 46 Explanation: 
Natural join of table R & S results into
Question 47
With respect to relational algebra, which of the following operations are included from mathematical set theory
(a) join
(b) Intersection
(c) Cartisian product
(d) Project
A
(a) and (b)
B
(b) and (c)
C
(c) and (d)
D
(b) and (d)
       Database-Management-System       Relational-Algebra       UGC NET June-2019 CS Paper-2
Question 47 Explanation: 
Only Intersection and cartesian product operations are included from mathematical set theory. The Join and Project operations are not there in mathematical set theory.
Question 48
Which of the following has the same expressive power with regard to relational query language?
(a) Relational algebra and Domain relational calculus
(b) Relational algebra and Tuple relational calculus
(c) Relational algebra and Domain relational calculus restricted to safe expression
(d) Relational algebra and Tuple relational calculus restricted to safe expression
A
(a) and (b) only
B
(c) and (d) only
C
(a) and (c) only
D
(b) and (d) only
       Database-Management-System       Relational-Algebra       UGC NET June-2019 CS Paper-2
Question 48 Explanation: 
Relational algebra, Domain relational calculus restricted to safe expression and Tuple relational calculus restricted to safe expression have the same expressive power.
Question 49

In a system for a restaurant, the main scenario for placing order is given below:

(a) Customer reads menu

(b) Customer places an order

(c) Order is sent to kitchen for preparation

(d) Ordered items are served

(e) Customer requests for a bill for the order

(f) Bill is prepared for this order

(g) Customer is given the bill

(h) Customer pays the bill

A sequence diagram for the scenario will have at least how many objects among whom the messages will be exchanged.
A
3
B
4
C
5
D
6
       Database-Management-System       Relational-Algebra       UGC-NET DEC-2019 Part-2
Question 50
Given two tables R1(x, y) and R2(y, z) with 50 and 30 number of tuples respectively. Find maximum number of tuples in the output of natural join between tables R1 and R2 i.e. R1 * R2? (*. Natural Join)
A
30
B
20
C
50
D
1500
       Database-Management-System       Relational-Algebra       UGC-NET DEC-2019 Part-2
Question 50 Explanation: 
For this question one should understand the meaning of natural join.
NATURAL JOIN requires that the two join attributes (or each pair of join attributes) have the same name in both relations.
Let us take a small example where we are having two relations named Employee(EID, Ename) and Department(EID, DID)

Since relation R2 is having 30 tuples, so in best case natural join of R1 and R2 will 30 tuples.
Question 51

Considering the relation schemas R (A, B, C, D) and S (C. D. E. F), what will be the degree of the resultant relation of the following Relational Algebra expression. Where “*” represents the”natural join" operation?
A
3
B
4
C
6
D
5
       Database-Management-System       Relational-Algebra       CIL Part - B
Question 52

Consider the following relation schema R and S along with their tuple sets.

R(A, B) = {, , , , ,, , , ,, , }

S(A) = {a1, a2, a3}

What is the value of TR / S. where "/" represents the Relational Algebra “division" operation?
A
T(B) = {b1, b3}
B
T(B) = {b1, b2, b4}
C
T(B) = {b1, b4}
D
T(B) = {b1, b3, b4}
       Database-Management-System       Relational-Algebra       CIL Part - B
Question 52 Explanation: 
Question 53

Relations and fields can be renamed in relational algebra using the renaming operator

A
p
B
σ
C
Θ
D
       Database-Management-System       Relational-Algebra       CIL 2020
Question 54

The ____ defines a set of operations on relations, paralleling the usual algebraic operations such as addition, subtraction or multiplication, which operates on numbers.

A
Relational calculus
B
Referential Integrity
C
Relational Algebra
D
Relations
       Database-Management-System       Relational-Algebra       CIL 2020
Question 55

Which of the following is a unary operation?

A
Intersection
B
Projection
C
Join
D
Cartesian Product
       Database-Management-System       Relational-Algebra       CIL 2020
Question 55 Explanation: 
Intersection, join , cartesian product is performed between two relations. But projection is just used to select a few columns from a relation.
Question 56

The number of tuples in the result of a left outer join operation will always be

A
greater than the number of tuples in the result of the corresponding join operation.
B
at least equal to the number of tuples in the result of the corresponding join operation.
C
less than the number of tuples in the result of the corresponding join operation.
D
greater than the number of tuples in the result of the corresponding right outer join operation.
       Database-Management-System       Relational-Algebra       APPSC-2012-DL CA
Question 56 Explanation: 
The number of tuples in the result of a left outer join operation will always be at least equal to the number of tuples in the result of the corresponding join operation, because if all the tuples of left relation is not included during join operation then the remaining tuples of left relation will also be included in the final output.
Question 57
Given two union compatible R1(A,B) and R2(C, D). What is the result of the operations R1 A = C AB = DR2?
A
R1∪R2
B
R1×R2
C
R1-R2
D
R1∩R2
       Database-Management-System       Relational-Algebra       TNPSC-2012-Polytechnic-CS
Question 57 Explanation: 
The operations will give the result whose values of both the attributes of R1 and R2 are equal.Which means the operation is nothing but R1∩R2.
Question 58
Consider join of a relation R with a relation S. If R has m tuples and S has n tuples then maximum and minimum sizes of the join respectively are
A
m+n and O
B
mn and O
C
m+n and m-n
D
mn and m+n
       Database-Management-System       Relational-Algebra       TNPSC-2012-Polytechnic-CS
Question 58 Explanation: 
For maximum no. of tuples,
If every row of r matches with each row of s, i.e., it means, the join attribute has the same value in all the rows of both r and s, then maximum mn tuples possible.
For minimum no. of tuples, if condition of join is not satisfied for any tuple then, minimum 0 tuples will be there.
Question 59
___________ operator is used to retain the unmatched rows of relations when they joined.
A
Outer join
B
Inner join
C
Natural join
D
Self join
       Database-Management-System       Relational-Algebra       TNPSC-2017-Polytechnic-CS
Question 59 Explanation: 
Outer join operator is used to retain the unmatched rows of relations when they joined.
Question 60
The materialization approach of query evaluation includes (from root to leaf) :
A
π, ∞, σ
B
π, σ, ∞
C
σ, π, ∞
D
σ, ∞, π
       Database-Management-System       Relational-Algebra       TNPSC-2017-Polytechnic-CS
Question 60 Explanation: 
In SQL we write
SELECT
FROM
WHERE
in a sequence.
So it is equivalent to
SELECT-π
FROM- ∞
WHERE-σ
There are 60 questions to complete.
PHP Code Snippets Powered By : XYZScripts.com
error: Content is protected !!