Relational Algebra and Tuple Calculus: GATE DA Previous Year Questions

Relational Algebra and Tuple Calculus · Database Management and Warehousing

5 questions · asked in 3 of 3 years (2024–2026)

MCQ 3 · NAT 21-mark 2 · 2-mark 3

2024Questions per year2026

Questions 1–5 of 5

Q1GATE 20262 marksMCQ−0.67 if wrong
Consider the given relations X,YX, Y and ZZ. The relation XX has three columns P,QP, Q and RR. The relation YY has three columns P,QP, Q and SS. The relation ZZ has two columns PP and TT.

X
PQRP1Q1R1P2Q2R2P3Q3R2\begin{array}{|c|c|c|} \hline P & Q & R \\ \hline P1 & Q1 & R1 \\ \hline P2 & Q2 & R2 \\ \hline P3 & Q3 & R2 \\ \hline \end{array}

Y
PQSP1Q12P1Q25P2Q16P3Q31\begin{array}{|c|c|c|} \hline P & Q & S \\ \hline P1 & Q1 & 2 \\ \hline P1 & Q2 & 5 \\ \hline P2 & Q1 & 6 \\ \hline P3 & Q3 & 1 \\ \hline \end{array}

Z
PTP1T1P3T2P4T3P4NULL\begin{array}{|c|c|} \hline P & T \\ \hline P1 & T1 \\ \hline P3 & T2 \\ \hline P4 & T3 \\ \hline P4 & \text{NULL} \\ \hline \end{array}

Consider the relational algebra expression

∏PRS[(σ(Q=Q3∨R=R2)[X⋈Y])⋈(σ(S>1)[Y⋈Z])]\prod_{P R S}\left[\left(\sigma_{(Q=Q 3 \vee R=R 2)}[X \bowtie Y]\right) \bowtie\left(\sigma_{(S > 1)}[Y \bowtie Z]\right)\right]

where ⋈\bowtie denotes natural join operation.

Which of the following options is the correct output for the given expression?

Q2GATE 20262 marksNAT
Let there be two relations XX and YY as shown. XX has three columns P,QP, Q and R.YR . Y has two columns PP and SS.

X\textbf{X}
PQRP1Q1R1P2Q2R2P3Q3R2\begin{array}{|c|c|c|} \hline P & Q & R \\ \hline P1 & Q1 & R1 \\ \hline P2 & Q2 & R2 \\ \hline P3 & Q3 & R2 \\ \hline \end{array}

Y\textbf{Y}
PSP110P115P220P31\begin{array}{|c|c|} \hline P & S \\ \hline P1 & 10 \\ \hline P1 & 15 \\ \hline P2 & 20 \\ \hline P3 & 1 \\ \hline \end{array}

Consider that the following tuple relational calculus expression is evaluated.

{t∣t∈X∧∃z∈X(t[P]=z[P])∧∃m∈Y(m[P]=t[P]∧m[S]>1)}\{t \mid t \in X \wedge \exists z \in X(t[P]=z[P]) \wedge \exists m \in Y(m[P]=t[P] \wedge m[S]>1)\}

The number of tuples that will be returned is ________. (Answer in integer )

Q3GATE 20251 markMCQ−0.33 if wrong
Consider the following three relations:

Car  (model,year,serial‾,color)Car \; (model, year, \underline{serial}, color)
Make  (maker,model‾)Make \; (maker, \underline{model})
Own  (owner‾,serial‾)Own \; (\underline{owner}, \underline{serial})

A tuple in CarCar represents a specific car of a given modelmodel, made in a given yearyear, with a serial number and a color. A tuple in MakeMake specifies that a makermaker company makes cars of a certain model. A tuple in OwnOwn specifies that an ownerowner owns the car with a given serialserial number. Keys are underlined; ((owner‾,serial‾)(\underline{owner}, \underline{serial})) together form the key for Own.Own. (⋈\bowtie denotes natural join)

πowner(Own⋈(σcolor="red"(Car⋈(σmaker="ABC"Make))))\pi_{\text{owner}} (\text{Own} \bowtie (\sigma_{\text{color} = \text{"red"}} (\text{Car} \bowtie (\sigma_{\text{maker} = \text{"ABC"}} \text{Make})) ))

Which one of the following options describes what the above expression computes?

Q4GATE 20252 marksNAT
Consider the following tables, Loan and Borrower, of a bank.

Loanloan_numbranch _ nameamountL11Banjara Hills90000L14Kondapur50000L15SR Nagar40000L22SR Nagar25000L23Balanagar80000L25Kondapur70000L19SR Nagar65000\begin{array}{c} \textbf{Loan}\\ \begin{array}{|c|c|c|} \hline \textbf{loan\_num} & \textbf{branch \_ name} & \textbf{amount} \\ \hline L11 & \text{Banjara Hills} & 90000 \\ \hline L14 & \text{Kondapur} & 50000 \\ \hline L15 & \text{SR Nagar} & 40000 \\ \hline L22 & \text{SR Nagar} & 25000 \\ \hline L23 & \text{Balanagar} & 80000 \\ \hline L25 & \text{Kondapur} & 70000 \\ \hline L19 & \text{SR Nagar} & 65000 \\ \hline \end{array}\end{array}

Borrowercustomer_nameloan_numAnandL11KarteekL11KarteekL14AnkitaL15GopalL19KarteekL22KarteekL23SunilL23SunilL25\begin{array}{c} \textbf{Borrower} \\ \begin{array}{|c|c|} \hline \textbf{customer\_name} & \textbf{loan\_num} \\ \hline \text{Anand} & \text{L11} \\ \hline \text{Karteek} & \text{L11} \\ \hline \text{Karteek} & \text{L14} \\ \hline \text{Ankita} & \text{L15} \\ \hline \text{Gopal} & \text{L19} \\ \hline \text{Karteek} & \text{L22} \\ \hline \text{Karteek} & \text{L23} \\ \hline \text{Sunil} & \text{L23} \\ \hline \text{Sunil} & \text{L25} \\ \hline \end{array}\end{array}

  Query: πbranch_name, customer_name(Loan⋈Borrower)÷πbranch_name(Loan)\pi_{\text{branch\_name, customer\_name}}(\text{Loan} \Join \text{Borrower}) \div \pi_{\text{branch\_name}}(\text{Loan})

where ⋈\Join denotes natural join. The number of tuples returned by the above relational algebra query is ________ (Answer in integer)

Q5GATE 20241 markMCQ−0.33 if wrong
Consider a database that includes the following relations:

Defender(name, rating, side, goals)
Forward(name, rating, assists, goals)
Team(name, club, price)

Which ONE of the following relational algebra expressions checks that every name occurring in Team appears in either Defender or Forward, where ϕ\phi denotes the empty set?

Keep practising

Topics in Database Management and Warehousing

All DA topics ›