Relational Calculus MCQs
Relational Calculus MCQs (Q1โQ100)
Q1.
Consider relation Student(SID, Name, Age, Marks).
Which of the following Tuple Relational Calculus (TRC) expressions retrieves names of students with Marks > 80?
A. {t | โs โ Student (t.Name = s.Name โง s.Marks > 80)}
B. {t | โs โ Student (t.Marks > 80)}
C. {t | โs โ Student (s.Marks = 80)}
D. {t | t.Marks > 80}
โ
Answer: A
๐ก Solution:t represents result tuples; expression uses existential quantifier correctly and binds s to relation.
Q2.
In TRC, which quantifier ensures universal condition?
A. โ
B. โ
C. ยฌโ
D. =
โ
Answer: B
๐ก Solution:โ (for all) ensures every tuple satisfies the condition โ used for universal quantification.
Q3.
Find names of students who are older than all students named ‘Riya’.
A. {t | โs โ Student (t.Age > s.Age โง s.Name=’Riya’)}
B. {t | โs โ Student (s.Name=’Riya’ โ t.Age > s.Age)}
C. {t | ยฌโs โ Student (s.Name=’Riya’ โง t.Age โค s.Age)}
D. Both B and C
โ
Answer: D
๐ก Solution:
Both (B) universal and (C) negated existential forms are logically equivalent in relational calculus.
Q4.
If a TRC expression contains both โ and โ, it represents:
A. Procedural Query
B. Declarative Query
C. Imperative Program
D. SQL Stored Function
โ
Answer: B
๐ก Solution:
Relational calculus is non-procedural (declarative) โ specifies what to retrieve, not how.
Q5.
Given Employee(EID, Dept, Salary) find employees whose salary is greater than some employee in Dept ‘HR’.
A. {t | โe โ Employee (e.Dept=’HR’ โง t.Salary > e.Salary)}
B. {t | โe โ Employee (e.Dept=’HR’ โง t.Salary > e.Salary)}
C. {t | t.Salary > ALL(SELECT Salary FROM Employee WHERE Dept=’HR’)}
D. {t | ยฌโe โ Employee (e.Dept=’HR’)}
โ
Answer: A
๐ก Solution:
The existential quantifier โsomeโ maps to โ, checking existence of a lower-salary HR employee.
Q6.
In Domain Relational Calculus (DRC), which is a valid query form?
A. { | P(x,y)}
B. {x,y | P(x,y)}
C. {t | t โ R}
D. {tuple | tuple โ R}
โ
Answer: A
๐ก Solution:
DRC expresses results as lists of attribute values, not tuple variables.
Q7.
Find all roll numbers r such that student scored more than 70 marks:
A. {r | โn,m (Student(r,n,m) โง m > 70)}
B. {r | โn,m (Student(r,n,m) โ m > 70)}
C. {r | Student(r,n,70)}
D. {r | โm (m < 70)}
โ
Answer: A
๐ก Solution:
Uses domain variables (r,n,m) and existential quantifier correctly.
Q8.
Which of the following statements is true about relational calculus?
A. It specifies how to retrieve data.
B. It is equivalent in expressive power to relational algebra.
C. It can express non-relational operations.
D. It cannot represent negation.
โ
Answer: B
๐ก Solution:
Coddโs theorem: Relational algebra โก Relational calculus in expressive power.
Q9.
A safe TRC expression ensures:
A. Finite result set
B. Infinite result set
C. Referential independence
D. Nested quantification
โ
Answer: A
๐ก Solution:
Safety rule restricts domain of variables โ only finite tuples are returned.
Q10.
Which is an unsafe TRC query?
A. {t | t โ Student โง t.Marks > 70}
B. {t | ยฌ(t โ Student)}
C. {t | โs โ Student (s.Marks = t.Marks)}
D. {t | t.Marks = 90}
โ
Answer: B
๐ก Solution:ยฌ(t โ Student) defines infinite domain โ unsafe.
Q11.
The domain of a variable in relational calculus refers to:
A. The type of variable
B. The set of all possible values
C. Tuple schema
D. Query result
โ
Answer: B
๐ก Solution:
Domain = all possible attribute values a variable may take.
Q12.
Find all employee IDs who earn the highest salary:
A. {t | t โ Emp โง ยฌโe โ Emp (e.Salary > t.Salary)}
B. {t | โe โ Emp (e.Salary < t.Salary)}
C. {t | t โ Emp โง t.Salary < ALL(Emp.Salary)}
D. None
โ
Answer: A
๐ก Solution:
Negated existence ensures no higher salary exists โ retrieves max-salary tuples.
Q13.
Which relational calculus construct allows expressing joins?
A. Multiple tuple variables and conjunction (โง)
B. Union operator
C. Arithmetic comparison
D. Cartesian quantifier
โ
Answer: A
๐ก Solution:
Joining achieved using multiple tuple variables and conditions linking them.
Q14.
For R(A,B) and S(B,C), the TRC query {t | โrโR, sโS (r.B=s.B โง t.A=r.A โง t.C=s.C)} is equivalent to:
A. R โ S
B. R ร S
C. R โ S
D. ฯ(A,C)(R)
โ
Answer: A
๐ก Solution:
Join condition r.B=s.B merges R and S tuples.
Q15.
In TRC, {t | โr โ R (t.A=r.A โง r.B>50)} returns:
A. Tuples with A values from R where B>50
B. All tuples of R
C. None
D. Only B values
โ
Answer: A
๐ก Solution:
The result includes all tuples t with A taken from r satisfying predicate.
Q16.
Which of the following is not allowed in safe relational calculus?
A. Equality
B. Conjunction
C. Unrestricted variables
D. Projection
โ
Answer: C
๐ก Solution:
All free variables must be range-restricted for safety.
Q17.
DRC and TRC differ primarily in:
A. Result form โ domain values vs tuple variables
B. Expressive power
C. Quantifier types
D. Usage of joins
โ
Answer: A
๐ก Solution:
TRC uses tuples, DRC uses individual domain variables.
Q18.
Which relational calculus query returns employees who donโt belong to Dept 20?
A. {t | t โ Emp โง ยฌ(t.Dept=20)}
B. {t | โe โ Emp (t.Deptโ 20)}
C. {t | โe โ Emp (e.Dept=20)}
D. None
โ
Answer: A
๐ก Solution:
Negation inside predicate correctly filters Dept โ 20.
Q19.
A bounded variable in TRC means:
A. It has finite possible values
B. It is bound by a quantifier
C. It is constant
D. It has no quantifier
โ
Answer: B
๐ก Solution:
Bound variable appears within scope of โ or โ.
Q20.
An unbound variable represents:
A. Variable not used in condition
B. Output (free) variable of the query
C. Infinite domain variable
D. Aggregate function
โ
Answer: B
๐ก Solution:
Free variable (unbound) defines the attributes to appear in result.
Q21.
Which query retrieves tuples of R where no matching tuple in S exists (anti-join)?
A. {t | tโR โง ยฌโsโS (t.A=s.A)}
B. {t | โsโS (t.Aโ s.A)}
C. {t | tโS}
D. {t | โtโR}
โ
Answer: A
๐ก Solution:
Negated existential join โ anti-join (R โ RโS).
Q22.
For safe queries, the domain of result variables must be:
A. Finite
B. Infinite
C. Universal
D. None
โ
Answer: A
๐ก Solution:
Safety ensures finite computable result sets.
Q23.
In DRC, to express intersection, one uses:
A. โง (AND) operator
B. โจ (OR) operator
C. โ
D. ยฌ
โ
Answer: A
๐ก Solution:
Intersection = tuples satisfying both predicates simultaneously.
Q24.
Which TRC expression finds names of students not enrolled in any course?
A. {t | tโStudent โง ยฌโeโEnroll (e.SID=t.SID)}
B. {t | tโStudent โง โeโEnroll (e.SID=t.SID)}
C. {t | โeโEnroll (e.SIDโ t.SID)}
D. Both A and C
โ
Answer: D
๐ก Solution:
Negated existence and universal quantification both represent โno enrollmentโ.
Q25.
Which of the following cannot be expressed in pure relational calculus?
A. Aggregation (SUM, AVG)
B. Selection
C. Projection
D. Join
โ
Answer: A
๐ก Solution:
Relational calculus lacks built-in aggregation operators โ handled in extended forms only.
Q26.
Given relation Course(CID, CName, Credits), find course IDs having more than 3 credits.
A. {t | t โ Course โง t.Credits > 3}
B. {t | โc โ Course (t.Credits > 3)}
C. {t | โc โ Course (c.Credits < 3)}
D. {t | ยฌ(t.Credits โค 3)}
โ
Answer: A
๐ก Solution:
Direct tuple predicate with > operator filters courses; option B compares unrelated tuples.
Q27.
Which of the following TRC queries retrieves students enrolled in both โDBMSโ and โOSโ courses?
A. {t | โe1,e2 โ Enroll (e1.SID = e2.SID โง e1.Course=’DBMS’ โง e2.Course=’OS’ โง t.SID = e1.SID)}
B. {t | โe โ Enroll (e.Course IN {‘DBMS’,’OS’})}
C. {t | โe โ Enroll (e.Course=’DBMS’)}
D. {t | t.Course=’DBMS’ โจ t.Course=’OS’}
โ
Answer: A
๐ก Solution:
Requires existence of two enrollments for the same SID; conjunction achieves intersection.
Q28.
Which TRC expression finds employees who earn less than everyone in Department 40?
A. {t | โe โ Emp (e.Dept=40 โ t.Salary < e.Salary)}
B. {t | โe โ Emp (e.Dept=40 โง t.Salary < e.Salary)}
C. {t | t.Dept โ 40}
D. {t | ยฌโe โ Emp (e.Dept=40 โง t.Salary โฅ e.Salary)}
โ
Answer: D
๐ก Solution:
Negated existential and universal formulations are equivalent; D avoids unsafe universal scanning.
Q29.
In TRC, free variables correspond to:
A. Output attributes
B. Temporary variables
C. Quantified conditions only
D. Aggregates
โ
Answer: A
๐ก Solution:
Unbound (free) variables define the result schema.
Q30.
Which of the following TRC queries is unsafe?
A. {t | tโEmp โง t.Salary > 50000}
B. {t | ยฌโe โ Emp (e.Salary = t.Salary)}
C. {t | t.Salary โฅ 0}
D. {t | tโEmp โง t.Dept=’IT’}
โ
Answer: C
๐ก Solution:t.Salary โฅ 0 has no range restrictionโcould generate infinite values.
Q31.
For safe queries, each free variable must appear:
A. Inside at least one atomic formula relating it to a relation
B. As a constant
C. Only once
D. After quantifier
โ
Answer: A
๐ก Solution:
Safety rule: every variable should be range-restricted by relation membership.
Q32.
Which TRC query is equivalent to ฯ A (R)?
A. {t | โr โ R (t.A = r.A)}
B. {t | โr โ R (t.A = r.A)}
C. {t | ยฌโr โ R (t.A โ r.A)}
D. {t | t โ R โง r.A = 10}
โ
Answer: A
๐ก Solution:
Existential quantification captures projection by matching each A value in R.
Q33.
Given R(A,B) and S(B,C), the TRC query {t | โrโR, sโS (r.B=s.B โง t.A=r.A โง t.C=s.C)} corresponds to which algebraic operation?
A. Join
B. Cartesian product
C. Difference
D. Projection
โ
Answer: A
๐ก Solution:
The equality r.B = s.B implies a natural join on B.
Q34.
Which calculus query retrieves all tuples of R not in S (assuming both have attributes A,B)?
A. {t | tโR โง ยฌโsโS (t.A=s.A โง t.B=s.B)}
B. {t | โsโS (t.Aโ s.A)}
C. {t | tโS}
D. {t | ยฌ(tโR)}
โ
Answer: A
๐ก Solution:
Negated existential ensures tuples present in R only โ represents R โ S.
Q35.
Which calculus operation implements union?
A. Logical OR (โจ)
B. Logical AND (โง)
C. Negation (ยฌ)
D. Implication (โ)
โ
Answer: A
๐ก Solution:
Union = tuples satisfying predicate P or Q.
Q36.
Find employees whose salary is not equal to any managerโs salary.
A. {t | tโEmp โง ยฌโmโMgr (t.Salary = m.Salary)}
B. {t | tโEmp โง โmโMgr (t.Salary = m.Salary)}
C. {t | tโEmp โง mโMgr}
D. {t | tโMgr}
โ
Answer: A
๐ก Solution:
Negated existence excludes all salaries matching a managerโs.
Q37.
A tuple variable in TRC must always range over:
A. A relation in the database
B. Domain of constants
C. Entire universe U
D. NULL values
โ
Answer: A
๐ก Solution:
Tuple variable takes values from an existing relationโs tuples.
Q38.
Which relational calculus query finds departments having no employees?
A. {t | tโDept โง ยฌโeโEmp (t.DID = e.DID)}
B. {t | โeโEmp (t.DID = e.DID)}
C. {t | โeโEmp (t.DID โ e.DID)}
D. Both A and C
โ
Answer: D
๐ก Solution:
Negated existence (A) and universal non-equality (C) are equivalent forms.
Q39.
If a TRC query returns an infinite result, it is said to be:
A. Unsafe
B. Non-relational
C. Recursive
D. Non-deterministic
โ
Answer: A
๐ก Solution:
Unsafe queries lack finite domain restrictions.
Q40.
Which of these DRC queries expresses selection?
A. { | R(x,y) โง y > 10}
B. { | R(x,y)}
C. { | S(x)}
D. { | y > 10}
โ
Answer: A
๐ก Solution:
Predicate y>10 filters tuples โ selection.
Q41.
What does the query {<x> | R(x) โจ S(x)} return?
A. Union of R and S
B. Intersection of R and S
C. Difference R โ S
D. Cartesian product
โ
Answer: A
๐ก Solution:
Logical OR represents union.
Q42.
Which of the following correctly represents R โฉ S in DRC?
A. { | R(x) โง S(x)}
B. { | R(x) โจ S(x)}
C. { | R(x) โง ยฌS(x)}
D. { | ยฌR(x) โจ S(x)}
โ
Answer: A
๐ก Solution:
Intersection โ conjunction (AND).
Q43.
For a database with R(A,B), the query {t | ยฌ(tโR)} is:
A. Unsafe
B. Join query
C. Selection
D. Aggregation
โ
Answer: A
๐ก Solution:
Negating relation membership introduces infinite tuples โ unsafe.
Q44.
Which of the following correctly expresses division R(A,B) รท S(B)?
A. {t | โs โ S โr โ R (t.A = r.A โง r.B = s.B)}
B. {t | โs โ S โr โ R (t.A = r.A)}
C. {t | ยฌโs โ S (r.B = s.B)}
D. {t | t โ R}
โ
Answer: A
๐ก Solution:
Division = โfor all B in S, A has that Bโ โ universal within existential structure.
Q45.
Which TRC expression returns all tuples of R where B = 10 or C = 20?
A. {t | tโR โง (t.B = 10 โจ t.C = 20)}
B. {t | tโR โง (t.B = 10 โง t.C = 20)}
C. {t | tโR โจ t.B = 10}
D. {t | tโR โง t.B > 20}
โ
Answer: A
๐ก Solution:
Logical OR inside predicate selects either condition.
Q46.
Which calculus query ensures no duplicate tuples in output?
A. All TRC/DRC queries (by definition)
B. Explicit DISTINCT keyword
C. Aggregation function
D. Use of UNION ALL
โ
Answer: A
๐ก Solution:
Relational model treats relations as sets โ duplicates not allowed.
Q47.
Which TRC query finds students whose marks are greater than 60 and less than 90?
A. {t | tโStudent โง t.Marks > 60 โง t.Marks < 90} B. {t | tโStudent โจ t.Marks > 60}
C. {t | t.Marks > 90}
D. {t | ยฌt.Marks < 60}
โ
Answer: A
๐ก Solution:
Conjunction restricts range between 60 and 90.
Q48.
Which operator corresponds to difference in relational algebra?
A. ยฌ (existential negation)
B. โจ
C. โ
D. โ
โ
Answer: A
๐ก Solution:
Difference uses negation to remove matching tuples.
Q49.
Which TRC expression retrieves tuples from R with attribute A equal to constant 5?
A. {t | tโR โง t.A = 5}
B. {t | t.A > 5}
C. {t | ยฌ(tโR)}
D. {t | โr โ R (r.A = 5)}
โ
Answer: A
๐ก Solution:
Simple predicate with constant comparison.
Q50.
Which TRC query expresses existence of at least one record in relation R with B = 30?
A. {t | โr โ R (r.B = 30 โง t = r)}
B. {t | โr โ R (r.B = 30)}
C. {t | ยฌโr โ R (r.B โ 30)}
D. {t | tโR โง t.B = 30}
โ
Answer: D
๐ก Solution:
Direct existential membership satisfying predicate B = 30.
Q51.
Relation: Book(BID, Title, Year, Pages).
Which TRC expression returns BIDs of books published after 2010 with more than 300 pages?
A. {t | โb โ Book (t.BID = b.BID โง b.Year > 2010 โง b.Pages > 300)}
B. {t | t.Year > 2010 โง t.Pages > 300}
C. {t | โb โ Book (b.Year > 2010 โง b.Pages > 300)}
D. {t | ยฌโb โ Book (b.Year โค 2010 โจ b.Pages โค 300)}
โ
Answer: A
๐ก Solution: A binds b to tuples of Book and projects BID when both predicates hold. B lacks relation binding for t and is unsafe.
Q52.
Let Sale(SID, Prod, Qty) and Prod(PID, Category).
TRC: {t | โs โ Sale, p โ Prod (s.Prod = p.PID โง p.Category = 'Gadgets' โง t.SID = s.SID)} โ what does it produce?
A. Sale IDs for sales of products in category ‘Gadgets’
B. Product IDs in Gadgets
C. All sales tuples not in Gadgets
D. Empty set
โ
Answer: A
๐ก Solution: Existential quantifiers join Sale and Prod on product id and project sale id.
Q53.
Which DRC formula corresponds to selection ฯ(Price < 100)(Item)?
A. {<i,p> | Item(i,p) โง p < 100}
B. {<i,p> | Item(i,p) โจ p < 100}
C. {<i> | โp Item(i,p)}
D. {<p> | p < 100}
โ
Answer: A
๐ก Solution: DRC expresses attribute values; include predicate p<100 with relation atom.
Q54.
Consider TRC: {t | t โ Emp โง ยฌโm โ Emp (m.Mgr = t.EID)}. What does it return?
A. Employees who are not managers of anyone (no direct reports)
B. Managers only
C. All employees (unsafe)
D. Employees with no manager assigned
โ
Answer: A
๐ก Solution: ยฌโm (m.Mgr = t.EID) means no tuple m has t as manager โ t has no direct reports.
Q55.
Which TRC expression correctly captures: โFind students who took every course offered in 2022โ? (Relations Student(SID, Name), Offer(CID, Year), Enroll(SID, CID))
A. {t | t โ Student โง โc โ Offer (c.Year=2022 โ โe โ Enroll (e.SID = t.SID โง e.CID = c.CID))}
B. {t | t โ Student โง โc โ Offer (c.Year=2022 โ โe โ Enroll ... )}
C. {t | โe โ Enroll (e.SID = t.SID)}
D. {t | โe โ Enroll (e.SID = t.SID)}
โ
Answer: A
๐ก Solution: For all courses in 2022, there must exist a corresponding enrollment for that student โ universalโexistential structure implements division.
Q56.
Is the TRC query {t | โx (R(x) โง t.A = x)} safe if x ranges over R?
A. Yes โ x is range-restricted by relation R.
B. No โ free variable t is not bound.
C. No โ existential makes it unsafe.
D. Yes only if R finite.
โ
Answer: A
๐ก Solution: x is bounded to finite relation R, and t is defined in terms of x so it’s safe.
Q57.
Which TRC expression is equivalent to relational algebra ฯ(Name)(Student โ Enroll โ Course WHERE Course.Sem='S1')? (Course(CID, Sem))
A. {t | โs โ Student, e โ Enroll, c โ Course (s.SID = e.SID โง e.CID = c.CID โง c.Sem='S1' โง t.Name = s.Name)}
B. {t | โs โ Student (t.Name = s.Name)}
C. {t | t.Sem = 'S1'}
D. {t | โc โ Course (c.Sem = 'S1')}
โ
Answer: A
๐ก Solution: Joins via equalities and project Name via t.Name binding.
Q58.
Which TRC form is unsafe?
A. {t | โx (ยฌR(x) โง t = x)} where R is a relation
B. {t | โx (R(x) โง t.A = x.A)}
C. {t | t โ R โง t.B > 5}
D. {t | โr โ R (t.A = r.A โง r.B>0)}
โ
Answer: A
๐ก Solution: ยฌR(x) is not range restricting; x can be any value from infinite domain โ unsafe.
Q59.
Translate to TRC: โFind product ids ordered by at least two distinct customers.โ (Order(PID, CustID))
A. {t | โo1,o2 โ Order (o1.PID=o2.PID โง o1.CustIDโ o2.CustID โง t.PID=o1.PID)}
B. {t | โo โ Order (t.PID=o.PID)}
C. {t | โo โ Order (o.PID=t.PID)}
D. {t | ยฌโo โ Order (o.PID โ t.PID)}
โ
Answer: A
๐ก Solution: Two distinct order tuples with same PID but different CustID ensures at least two customers ordered it.
Q60.
Given TRC: {t | tโR โง โs โ S (s.X = t.X โ s.Y = t.Y)} โ what does it express?
A. For each t in R, all S tuples matching on X must have same Y as t (consistency condition)
B. R subset of S
C. S subset of R
D. Always true
โ
Answer: A
๐ก Solution: Universal quantification enforces that any S tuple with same X shares Y with t.
Q61.
Which DRC query gives the set of x such that x appears in relation R but not in S (R(A) and S(A)) ?
A. {<x> | R(x) โง ยฌS(x)}
B. {<x> | R(x) โจ S(x)}
C. {<x> | ยฌR(x)}
D. {<x> | โy R(y)}
โ
Answer: A
๐ก Solution: Conjunction with negation expresses set difference R โ S.
Q62.
Which TRC expression is equivalent to algebra R โ S when R(A,B) and S(B,C)?
A. {t | โr โ R, s โ S (r.B = s.B โง t.A = r.A โง t.B = r.B โง t.C = s.C)}
B. {t | t โ R}
C. {t | โr โ R (r.B = t.B)}
D. {t | r.B = s.B}
โ
Answer: A
๐ก Solution: Existential bind both relations and equate join attribute; project combined attributes.
Q63.
Which calculus pattern yields the intersection of R(A) and S(A)?
A. {<x> | R(x) โง S(x)}
B. {<x> | R(x) โจ S(x)}
C. {<x> | R(x) โง ยฌS(x)}
D. {<x> | ยฌR(x)}
โ
Answer: A
๐ก Solution: AND requires x to be in both relations.
Q64.
Which of these TRC forms correctly represents: โCustomers who did not buy product P9 in year 2023โ? (Order(cust,pid,odate))
A. {t | t โ Customer โง ยฌโo โ Order (o.Cust = t.Cust โง o.PID='P9' โง EXTRACT(YEAR FROM o.odate)=2023)}
B. {t | โo โ Order (o.PID='P9')}
C. {t | t.Cust='P9'}
D. {t | โo โ Order (o.PID='P9')}
โ
Answer: A
๐ก Solution: Negated existential prevents any 2023 order of P9 for the customer.
Q65.
Which DRC expression is unsafe?
A. {<x> | โy (R(x,y) โง y>0)}
B. {<x> | x>0}
C. {<x> | R(x,y) โง S(y)} if y is properly quantified
D. {<x> | โy (R(x,y))}
โ
Answer: B
๐ก Solution: x>0 with no relation atom bounding x is unbounded โ infinite domain โ unsafe.
Q66.
Express in TRC: โFind employees who report (directly) to a manager in Dept 30.โ (Emp(EID,MID,Dept))
A. {t | tโEmp โง โm โ Emp (m.EID = t.MID โง m.Dept = 30)}
B. {t | t.Dept = 30}
C. {t | โm โ Emp (m.Dept = 30)}
D. {t | t.MID = 30}
โ
Answer: A
๐ก Solution: Existentially find manager tuple m whose Dept=30, equate manager id.
Q67.
Which TRC query returns A values from R(A,B) that pair with all B values present in S(B)?
A. {t | โr โ R (t.A = r.A โง โs โ S โr2 โ R (r2.A = r.A โง r2.B = s.B))}
B. {t | โr โ R (t.A = r.A)}
C. {t | โr โ R (r.B = t.A)}
D. {t | ยฌโs โ S (s.B = t.A)}
โ
Answer: A
๐ก Solution: Nested universal-existential captures division: for every s in S there exists R tuple linking that A to s.B.
Q68.
Which TRC expression is logically equivalent to {t | tโR โง ยฌโsโS (s.K = t.K)} ?
A. {t | tโR โง โsโS (s.K โ t.K)}
B. {t | tโR โจ โsโS (s.K โ t.K)}
C. {t | โs โ S (s.K = t.K)}
D. {t | ยฌtโR}
โ
Answer: A
๐ก Solution: Negated existential equals universal non-equality (De Morgan on quantifiers).
Q69.
Given R(A,B) and S(A,B), which TRC query describes R โ S (symmetric difference)?
A. {t | (t โ R โง ยฌโsโS (s.A=t.A โง s.B=t.B)) โจ (t โ S โง ยฌโrโR (r.A = t.A โง r.B = t.B))}
B. {t | t โ R}
C. {t | t โ S}
D. {t | โu (u.A = t.A)}
โ
Answer: A
๐ก Solution: Symmetric difference = tuples in R but not S OR in S but not R.
Q70.
Which TRC expression is safe and returns the Name of students who share a mark with at least one other student? (Student(SID,Name,Marks))
A. {t | โs1,s2 โ Student (s1.SID โ s2.SID โง s1.Marks = s2.Marks โง t.Name = s1.Name)}
B. {t | โs โ Student (t.Name = s.Name)}
C. {t | โs1,s2 (s1.Marks = s2.Marks)}
D. {t | ยฌโs (s.Marks = t.Marks)}
โ
Answer: A
๐ก Solution: Two different students with same Marks; project the name for one of them. Variables are range-restricted.
Q71.
Is the TRC {t | โs โ R (t.A = s.A) โง โu (u > 5)} safe?
A. No โ u is unbounded by any relation
B. Yes โ both quantifiers existential make it safe
C. Yes โ because u>5 restricts it
D. No โ s is unbounded
โ
Answer: A
๐ก Solution: The variable u has no relation atom bounding it, so domain is unbounded โ unsafe.
Q72.
Which TRC expression computes projection ฯ(B)(R) for R(A,B,C)?
A. {t | โr โ R (t.B = r.B)}
B. {t | โr โ R (t.B = r.B)}
C. {t | t โ R}
D. {t | โr โ R (t.A = r.A)}
โ
Answer: A
๐ก Solution: Existentially bind a tuple and project its B component.
Q73.
Given TRC {t | โr โ R (t.A = r.A โง r.B < 0) โง ยฌโs โ S (s.C = r.A)}, which English description is correct?
A. Tuples t whose A appears in R with negative B and that A does not appear as C in S
B. All tuples of R with negative B
C. Tuples t in S with C negative
D. None
โ
Answer: A
๐ก Solution: Conjunction of existence in R with negative B and non-existence in S describes the stated set.
Q74.
Which of the following DRC queries is unsafe? Assume R(x) and S(y) exist.
A. {<x> | R(x) โจ S(x)}
B. {<x> | x > 1000}
C. {<x> | โy (R(y) โง x = y)}
D. {<x> | R(x) โง ยฌS(x)}
โ
Answer: B
๐ก Solution: x>1000 without relation bound allows infinitely many domain values โ unsafe.
Q75.
Which TRC pattern correctly expresses: โThere exists an author who wrote books in both 2018 and 2022โ? (Book(BID, Author, Year))
A. {t | โb1, b2 โ Book (b1.Author = b2.Author โง b1.Year = 2018 โง b2.Year = 2022 โง t.Author = b1.Author)}
B. {t | โb (b.Year = 2018 โง b.Year = 2022)}
C. {t | โb (b.Year = 2018 โจ b.Year = 2022)}
D. {t | ยฌโb (b.Year = 2018 โง b.Year = 2022)}
โ
Answer: A
๐ก Solution: Needs two Book tuples with same Author but different Year values; existential pair enforces that.
Q76.
Relation Movie(MID, Title, Year, Rating).
Which TRC expression returns MIDs of movies rated โฅ 8.5 released after 2015?
A. {t | โm โ Movie (t.MID = m.MID โง m.Rating >= 8.5 โง m.Year > 2015)}
B. {t | โm โ Movie (m.Rating >= 8.5 โง m.Year > 2015)}
C. {t | ยฌโm โ Movie (m.Rating < 8.5)}
D. {t | t.Rating >= 8.5}
โ
Answer: A
๐ก Solution: Existentially bind m to Movie and project MID when both predicates hold; other forms are unsafe or incorrect.
Q77.
Given A(X,Y) and B(Y,Z), which TRC describes ฯ_X(A โ B)?
A. {t | โa โ A, b โ B (a.Y = b.Y โง t.X = a.X)}
B. {t | โa โ A (t.X = a.X)}
C. {t | โb โ B (t.X = b.Z)}
D. {t | t โ A}
โ
Answer: A
๐ก Solution: Existential join binds A and B by Y, and projects A.X.
Q78.
Which TRC expression is equivalent to relational algebra R โ S when both have (A,B)?
A. {t | t โ R โง ยฌโs โ S (s.A = t.A โง s.B = t.B)}
B. {t | t โ S โง ยฌโr โ R (r.A = t.A)}
C. {t | โs โ S (s.A != t.A)}
D. {t | t โ R โจ t โ S}
โ
Answer: A
๐ก Solution: Negated existential excludes any tuple that also occurs in S.
Q79.
TRC: {t | โrโR (t.A = r.A) โง โsโS (s.B โ t.A)} โ is it safe?
A. Yes, if domains of R and S are finite (they are relations) and t is range-restricted via r
B. No โ universal quantifier makes it unsafe always
C. No โ t not bound to S
D. Yes only if S empty
โ
Answer: A
๐ก Solution: t is tied to rโR so range-restricted; universal on S is okay because S finite; expression is safe.
Q80.
Which DRC query yields elements present in exactly one of R(A) or S(A) (symmetric difference)?
A. {<x> | (R(x) โง ยฌS(x)) โจ (S(x) โง ยฌR(x))}
B. {<x> | R(x) โง S(x)}
C. {<x> | R(x) โจ S(x)}
D. {<x> | ยฌR(x)}
โ
Answer: A
๐ก Solution: XOR logic via (R and not S) OR (S and not R) implements symmetric difference.
Q81.
Which TRC expression returns Dept values that have at least one employee with salary > 1,00,000? (Emp(EID, Dept, Sal))
A. {t | โe โ Emp (e.Dept = t.Dept โง e.Sal > 100000)}
B. {t | โe โ Emp (e.Sal > 100000)}
C. {t | t.Dept = 'HR'}
D. {t | ยฌโe โ Emp (e.Sal > 100000)}
โ
Answer: A
๐ก Solution: Existential quantifier finds existence of at least one high-salary employee per department and projects Dept.
Q82.
Translate to TRC: โFind student IDs who took no course offered in Semester = ‘S2’.โ (Offer(CID, Sem), Enroll(SID,CID))
A. {t | t โ Student โง ยฌโc โ Offer (c.Sem='S2' โง โe โ Enroll (e.SID = t.SID โง e.CID = c.CID))}
B. {t | โc โ Offer (c.Sem='S2' โง ยฌโe โ Enroll (e.SID = t.SID โง e.CID = c.CID))}
C. {t | โe โ Enroll (e.SID = t.SID)}
D. {t | t.Sem = 'S2'}
โ
Answer: A
๐ก Solution: For each Student t, ensure no Offer in S2 exists such that the student enrolled in it (negated existential over nested existential achieves anti-membership).
Q83.
Which TRC form correctly expresses: โThere exists an author who has written at least three distinct booksโ? (Book(BID, Author))
A. {t | โb1,b2,b3 โ Book (b1.Author = b2.Author โง b2.Author = b3.Author โง b1.BID โ b2.BID โง b1.BID โ b3.BID โง b2.BID โ b3.BID โง t.Author = b1.Author)}
B. {t | โb โ Book (t.Author = b.Author)}
C. {t | โb โ Book (b.Author = t.Author)}
D. {t | ยฌโb โ Book (b.Author = t.Author)}
โ
Answer: A
๐ก Solution: Three existentially bound book tuples with same Author but pairwise distinct BIDs implement “at least three distinct books.”
Q84.
Given TRC {t | t โ R โง โs โ S (s.X = t.X)} โ which algebraic operation does it map to?
A. Projection of R after semi-join with S on X (i.e., semijoin R โ S projected as R rows with match)
B. Cartesian product R ร S
C. Difference R โ S
D. Union R โช S
โ
Answer: A
๐ก Solution: Existence of matching s in S selects R tuples having counterpart in S โ semijoin behavior.
Q85.
Which TRC query is equivalent to DRC {<a> | โb (R(a,b) โง S(b))}?
A. {t | โr โ R, s โ S (r.A = t.a โง r.B = s.B)} (with appropriate attribute naming)
B. {t | โr โ R (r.A = t.a โง r.B = s.B)}
C. {t | โr โ R (r.A = t.a)}
D. {t | t.A > 0}
โ
Answer: A
๐ก Solution: Convert domain quantification into tuple quantifiers binding R and S, matching attributes accordingly.
Q86.
Is {t | โr โ R (t.A = r.A) โง โs โ S (t.A = s.B)} equivalent to {t | โr โ R, s โ S (t.A = r.A โง r.A = s.B)}?
A. Yes โ conjunction of two existentials can be combined into single existential over both relations.
B. No โ they differ in semantics
C. Only if R and S disjoint
D. None
โ
Answer: A
๐ก Solution: Independent exists can be merged into a single existential binding both variables (scoping unchanged), giving same meaning.
Q87.
Which TRC expression returns authors who did not write any book in 2020? (Book(BID,Author,Year))
A. {t | t โ Author โง ยฌโb โ Book (b.Author = t.Author โง b.Year = 2020)}
B. {t | โb โ Book (b.Year โ 2020)}
C. {t | โb โ Book (b.Year = 2020)}
D. {t | t.Year โ 2020}
โ
Answer: A
๐ก Solution: Negated existential over Book with Year = 2020 ensures authors without 2020 books.
Q88.
Given R(A,B) and S(A), which TRC query finds A values in R that are not in S?
A. {t | โr โ R (t.A = r.A โง ยฌS(r.A))} (tweak: use ยฌโsโS(s.A = r.A))
B. {t | โr โ R (t.A = r.A โง ยฌโs โ S (s.A = r.A))}
C. {t | โs โ S (t.A = s.A)}
D. {t | t โ S}
โ
Answer: B
๐ก Solution: Need to check non-existence in S for same A; B is correct safe pattern (A form is shorthand but must formalize ยฌโs).
Q89.
Which TRC expression corresponds to the algebra ฯ(A)(R โ S) when R(A,B) and S(B)?
A. {t | โr โ R, s โ S (r.B = s.B โง t.A = r.A)}
B. {t | t.A โ R.A}
C. {t | โs โ S (r.B = s.B)}
D. {t | t โ S}
โ
Answer: A
๐ก Solution: Existentially join and project A.
Q90.
Which of the following TRC forms is safe?
A. {t | โx (x > 0 โง t.A = x)} with x unbounded
B. {t | โr โ R (t.A = r.A)}
C. {t | ยฌโx (x > 5)}
D. {t | โx t.A = x}
โ
Answer: B
๐ก Solution: B range-restricts variable via R; others include unbounded variables or impossible universal constraints.
Q91.
Which TRC query represents โFind students who have taken no course more than onceโ? (Enroll(SID,CID))
A. {t | t โ Student โง ยฌโc โ Course (โe1,e2 โ Enroll (e1.SID = t.SID โง e2.SID = t.SID โง e1.CID = c.CID โง e2.CID = c.CID โง e1.EID โ e2.EID))} (note: e rows identification by rowid)
B. {t | โe โ Enroll (e.SID = t.SID)}
C. {t | โc โ Course (โe โ Enroll (e.SID = t.SID โง e.CID = c.CID โง COUNT(e)>1))} (COUNT not allowed in pure calculus)
D. {t | t.SID = 1}
โ
Answer: A
๐ก Solution: Use negated existential over existence of two distinct enrollments (distinct rows) for same student and course; pure relational calculus models row distinctness via multiple tuple variables.
Q92.
Which DRC expression is equivalent to ฯ(B=10)(R) for relation R(A,B,C)?
A. {<a,c> | R(a,10,c)}
B. {<a,b> | R(a,b,c) โง b=10}
C. {<a,b,c> | b=10}
D. {<b> | b=10}
โ
Answer: A
๐ก Solution: DRC returns attribute lists; specify the constant in the relation atom and include the attributes to be returned (A and C after selection on B).
Q93.
Which TRC query finds managers who manage exactly one employee? (Emp(EID, MgrID))
A. {t | โm โ Emp (m.EID = t.EID โง โe1,e2 โ Emp (e1.MgrID = m.EID โง e2.MgrID = m.EID โง e1.EID โ e2.EID) โ false)} โ complex
B. {t | โm โ Emp (m.EID = t.EID โง โe โ Emp (e.MgrID = m.EID) โง ยฌโe2 โ Emp (e2.MgrID = m.EID โง e2.EID โ e.EID))}
C. {t | โe1,e2 โ Emp (e1.MgrID = t.EID โง e2.MgrID = t.EID โง e1.EID โ e2.EID)}
D. {t | t.EID = 1}
โ
Answer: B
๐ก Solution: B asserts existence of one report and denies existence of a second distinct report; C finds managers with at least two reports (wrong).
Q94.
Which TRC expression returns A values in R that pair with all B values that appear in R? (R(A,B)) โ i.e., A values associated with every B in R.
A. {t | โr โ R (t.A = r.A โง โb (โs โ R (s.B = b) โ โs2 โ R (s2.A = r.A โง s2.B = b)))}
B. {t | โr โ R (t.A = r.A)}
C. {t | โb โ R (t.A = b)}
D. {t | t.A โ ฯ_A(R)}
โ
Answer: A
๐ก Solution: For every B that appears anywhere in R, there must exist an R-tuple linking the candidate A to that B โ nested universalโexistential pattern captures division semantics across same relation.
Q95.
Which TRC pattern correctly expresses: โThere is no student who scored 100 in all subjectsโ? (Marks(SID, Subj, Score))
A. {t | ยฌโs โ Student (โm โ Marks (m.SID = s.SID โ m.Score = 100))}
B. {t | โs โ Student (โm โ Marks (m.SID = s.SID โ m.Score = 100))}
C. {t | โs โ Student (โm โ Marks (m.Score โ 100))}
D. {t | โm โ Marks (m.Score โ 100)}
โ
Answer: A
๐ก Solution: Negated existence of a student satisfying universal all-scores=100 expresses “no student has 100 in all subjects.”
Q96.
Given R(A,B,C) and TRC {t | โr โ R (t.A = r.A โง r.B + r.C > 50)} โ which algebraic expression is equivalent?
A. ฯ_A(ฯ(B + C > 50)(R))
B. ฯ(B + C > 50)(ฯ_A(R))
C. ฯ_A(R)
D. R
โ
Answer: A
๐ก Solution: Project A from R after selecting tuples where B+C>50.
Q97.
Which TRC query is unsafe due to an unbounded free variable?
A. {t | โr โ R (t.A = r.A โง x > 100)} where x not range-restricted
B. {t | โr โ R (t.A = r.A โง r.B > 0)}
C. {t | t โ R โง t.B < 50}
D. {t | โr โ R (t.A = r.A)}
โ
Answer: A
๐ก Solution: Variable x is not bound by any relation atom โ domain-unbounded โ unsafe.
Q98.
Which DRC query denotes the set of pairs <a,b> where R(a,b) holds and there does not exist c with S(b,c)?
A. {<a,b> | R(a,b) โง ยฌโc S(b,c)}
B. {<a,b> | R(a,b) โจ โc S(b,c)}
C. {<a> | โb R(a,b)}
D. {<b,c> | S(b,c)}
โ
Answer: A
๐ก Solution: Conjoin R and negated existential on S to ensure no related c exists.
Q99.
Which TRC expression returns departments that have exactly two employees? (Emp(EID,Dept))
A. {t | โe1,e2 โ Emp (e1.Dept = t.Dept โง e2.Dept = t.Dept โง e1.EID โ e2.EID โง ยฌโe3 โ Emp (e3.Dept = t.Dept โง e3.EID โ e1.EID โง e3.EID โ e2.EID))}
B. {t | โe1,e2,e3 โ Emp (...)} โ excessive
C. {t | โe โ Emp (t.Dept = e.Dept)}
D. {t | t.Dept = 'D1'}
โ
Answer: A
๐ก Solution: Existentially assert two distinct employees and negate existence of any third distinct employee in same dept; implements exact-count semantics using pure calculus.
Q100.
Which TRC expression corresponds to SQL SELECT DISTINCT A FROM R WHERE NOT EXISTS (SELECT 1 FROM S WHERE S.B = R.B) (i.e., A values from R whose B not present in S)?
A. {t | โr โ R (t.A = r.A โง ยฌโs โ S (s.B = r.B))}
B. {t | โr โ R (t.A = r.A โง โs โ S (s.B = r.B))}
C. {t | โr โ R (t.A = r.A)}
D. {t | ยฌโr โ R (r.A = t.A)}
โ
Answer: A
๐ก Solution: Bind to R to project A and ensure there is no S with same B via negated existential โ direct calculus translation of the SQL anti-join.
