Safety of Expressions & Power MCQs: 10 Solved Relational Calculus Questions
Practise the active-domain test, De Morgan rewrites and the equivalence of relational algebra, safe TRC and safe DRC through ten fully explained questions.
KnowledgeGate Team
Exam prep & CS education

Relational-calculus questions often mix two tests that look similar. One asks whether every output value is range-restricted to the active domain. The other asks which safe calculus language has the same expressive power as relational algebra. Confuse safety with logical validity, and several options can look plausible.
Attempt each question before reading its answer. Apply the active-domain test first, then check whether a power claim names safe calculus. For the wider DBMS sequence, use CS Fundamentals for Exams & Placements.
1. Safety of expressions: calibrate the active-domain test
A safe expression returns only values from the finite active domain of the input database or constants written in the expression. It is also domain-independent: enlarging the surrounding domain, without changing any stored relation, does not change the result.
Take R(A) = {1, 2} and S(A) = {2, 3}. Their active domain is {1, 2, 3}. The bounded difference query {t | S(t) ∧ ¬R(t)} first takes candidates from S, then removes values in R, so it returns {3}. If the ambient domain grows to {1, 2, 3, 4, 5}, the stored relations remain unchanged and the answer is still {3}.
Now consider {t | ¬R(t)}. Over ambient domain {1, 2, 3}, it returns {3}. Over {1, 2, 3, 4, 5}, it returns {3, 4, 5}. The answer depends on unrelated domain values, so the expression is unsafe.
Use this four-check routine:
Identify every free or output variable.
Find a positive relational atom that bounds each one.
Inspect negation, implication and universal quantification for vacuous truth.
Enlarge the ambient domain and check whether the result changes.
2. Questions 1-2: find the unbounded complement
Question 1: GATE 2001 unsafe relational calculus expression
Question: Which of the following relational calculus expressions is not safe?
A.
{t | ∃u ∈ R1 (t[A] = u[A]) ∧ ¬∃s ∈ R2 (t[A] = s[A])}B.
{t | ∀u ∈ R1 (u[A] = "x" ⇒ ∃s ∈ R2 (t[A] = s[A] ∧ s[A] = u[A]))}C.
{t | ¬(t ∈ R1)}D.
{t | ∃u ∈ R1 (t[A] = u[A]) ∧ ∃s ∈ R2 (t[A] = s[A])}
Correct answer: C. C is unconditionally unsafe: it takes the complement of R1 without restricting t to a finite relation, so ambient-domain values enter the answer. A draws t[A] from R1, while D draws it from both relations. B has a strict domain-independence caveat: if no tuple in R1 has A = x, its implication is vacuously true and t is unbounded. The GATE key treats C as the expression that is unsafe for every database instance; B becomes unsafe only for that data-dependent edge case.
Question 2: unsafe query caused by outer negation
Question: Which one of the following is the example of unsafe query?
A.
{E.ename | E ∈ Employees ∧ ∃C ∈ Certified (∃A ∈ Aircraft ¬ (A.aid = C.aid ∧ A.aname = ‘Boeing’ ∧ E.eid = C.eid))}B.
{t | ∃u ∈ EMP (t[EmpName] = u[EmpName] ∧ ∃v ∈ DEPT (t[DeptId] ≠ v[DeptId]))}C.
{t | ∃u ∈ R1 (t[A] = u[A]) ∧ ¬∃s ∈ R2 (t[A] = s[A])}D.
{E.ename | ¬ (E ∈ Employees ∧ ∃C ∈ Certified (∃A ∈ Aircraft ¬ (A.aid = C.aid ∧ A.aname = ‘Boeing’ ∧ E.eid = C.eid)))}
Correct answer: D. In A, E ∈ Employees bounds E before the nested test. D negates membership, so tuples outside Employees can satisfy the complement. C is a safe difference because its output comes from R1.
3. Questions 3-4: use De Morgan's laws on predicates and quantifiers
Question 3: conjunction through De Morgan's law
Question: Which of the following tuple relational calculus expression(s) is/are equivalent to P1 ∧ P2?
A.
(¬ (P1) ∨¬ (P2))B.
¬ (¬ (P1) ∧ ¬ (P2))C.
¬ (¬ (P1) ∨¬ (P2))D.
(¬ (P1) ∧ ¬ (P2))
Correct answer: C. De Morgan's law gives ¬(¬P1 ∨ ¬P2) = P1 ∧ P2. With P1 = true and P2 = false, the target is false, and C evaluates to ¬(false ∨ true) = false. B instead simplifies to P1 ∨ P2.
Question 4: GATE 2008 universal quantifier rewrite
Question: Which of the following tuple relational calculus expression(s) is/are equivalent to ∀t ∈ r (P(t))?
I. ¬∃t ∈ r (P(t))
II. ∃t ∉ r (P(t))
III. ¬∃t ∈ r (¬P(t))
IV. ∃t ∉ r (¬P(t))
A. I only
B. II only
C. III only
D. III and IV only
Correct answer: C. The identity ∀x φ(x) ≡ ¬∃x ¬φ(x) makes III equivalent to the target. For r = {a, b}, with P(a) = true and P(b) = true, no tuple in r makes ¬P true, so III holds. This is exactly what it means for P to hold for every member of r. I says that no tuple satisfies P, while II and IV quantify outside r.
4. Questions 5-6: compare safe TRC, safe DRC and relational algebra
Question 5: GATE 2002 expressive power
Question: 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
Correct answer: C. Relational algebra, safe TRC and safe DRC have equivalent expressive power for finite relational queries. Safe is decisive because unrestricted calculus can describe domain-dependent, potentially infinite complements that relational algebra cannot produce.
Question 6: safe TRC versus safe DRC
Question: With regard to the expressive power of the formal relational query languages, which of the following statements is true?
A. Tuple relational calculus is more powerful than domain relational calculus
B. Safe Tuple relational calculus is same powerful as safe domain relational calculus
C. Unsafe Tuple relational calculus is more powerful as safe domain relational calculus
D. Safe Tuple relational calculus is more powerful as unsafe domain relational calculus
Correct answer: B. Safe TRC ranges over tuples and safe DRC over attribute values, but both express finite, domain-independent queries. Remember relational algebra = safe TRC = safe DRC. For the broader procedural-versus-declarative distinction and operator family, use Introduction to Query Languages MCQs. Active-domain safety is the narrower condition that makes relational algebra equivalent to safe TRC and safe DRC.
5. Questions 7-8: recognise the three-language equivalence
Question 7: GATE 2006 relational query languages
Question: Which of the following relational query languages have the same expressive power?
I. Relational algebra
II. Tuple relational calculus restricted to safe expressions
III. Domain relational calculus restricted to safe expressions
A. II and III only
B. I and II only
C. I and III only
D. I, II and III
Correct answer: D. Check all three against the equivalence theorem instead of comparing them pairwise. Both calculus forms are explicitly restricted to safe expressions, so I, II and III have the same expressive power. Removing safe would make that claim too broad.
Question 8: UGC NET 2019 safe-expression pairs
Question: Which of the following has same expressive power with regard to relational query language? (a) Rational algebra and domain relational calculus (b) Relational algebra and tuples relational calculus (c) Relational algebra and domain relational calculus restricted to safe expression (d) Relational algebra and tuples 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
Correct answer: B. Only (c) and (d) explicitly restrict the calculus language to safe expressions. Those two pairs give the defensible equivalences with relational algebra; (a) and (b) omit the restriction.
6. Question 9: bind both tuple variables in a maximum query
Question 9: highest-grade TRC expression
Question: Given relational schema Students (id, grade). Which of the following is the TRC expression for “find the id’s of all students who scored the highest grade”?
A.
{s2.id | ∃ s1 ∈ students ∧ (¬∃ s2 ∈ students (s2.grade > s1.grade))}B.
{s1.id | ∃ s1 ∈ students ∧ (¬∃ s2 ∈ students (s2.grade > s1.grade))}C.
{s1.id | ∃ s1 ∈ students ∧ ∃ s2 ∈ students (s2.grade < s1.grade)}D. None of the above
Correct answer: B. For Students = {(1,82), (2,91), (3,91), (4,67)}, test each bound s1. For (2,91) and (3,91), no s2 has a higher grade, while 82 and 67 each have a greater tuple, giving {2,3}. A projects s2.id outside its binding; C accepts anyone above some lower scorer, including non-maximal rows.
7. Question 10: match SQL, relational algebra and TRC
Question 10: three equivalent query forms
Question: Consider the following relational schema: Student(Roll-no, Student-name, city, phone_no), Subject(Sub_id, Sub_name), Enrollment(Roll-no, Sub_id, department-id, percentage). Which of the following queries is equivalent to this English query? “Find the distinct names of all students who scored less than 50% in the course id 16A”.
A.
Select distinct S.Student-name from Student as S, Enrollment as E where E.Roll-no = S.Roll-no AND E.Sub_id = '16A' AND E.percentage < 50B.
Π Student-name (σ Sub_id = '16A' ∧ percentage < 50 (Enrollment ⋈ Student))C.
{T | ∃S ∈ Student, ∃E ∈ Enrollment (E.Roll-no = S.Roll-no ∧ E.Sub_id = '16A' ∧ E.percentage < 50 ∧ T.Student-name = S.Student-name)}D.
{SN | ∃Sr ∃Ep (<Sr, SN> ∈ Student ∧ <Sr, '16A', Ep> ∈ Enrollment ∧ Ep >= 50)}
Correct answers: A, B and C. A uses SQL distinct; B and C express the same filtering and name projection in algebra and calculus. With Student = {(1,Ana), (2,Ben), (3,Cia)} and Enrollment = {(1,16A,47), (2,16A,73), (3,16A,42)}, each returns {Ana,Cia}. D uses Ep >= 50, the opposite threshold. Use SQL Query MCQs: 12 Solved (SELECT, Joins, Subqueries) for SQL practice.
8. Safety of expressions: score check and next step
Keep this rapid check beside your next attempt:
Positive relation atoms bind output variables.
A naked complement is unsafe.
∀x P(x)equals¬∃x ¬P(x).Safe TRC and safe DRC have the same power.
Both match relational algebra.
A score of 9-10 means move to mixed DBMS questions. At 6-8, redo the unsafe-query and quantifier pairs. At 0-5, rerun the two finite worked instances before proceeding. This guides practice, not an exam-score prediction.
For a structured GATE path, use GATE Guidance by Sanchit Sir. For placement-focused study, continue with CS Fundamentals for Placements by Sanchit Sir.
Keep learning

Introduction to Query Languages MCQs: 8 Solved MCQs and 2 Concept Checks
Attempt eight published query-language MCQs, check each answer with a focused explanation, then use two written prompts to test recall of relational algebra.

Functional Dependencies and Armstrong's Axioms MCQs: 12 Solved Questions with Explanations
Solve 12 functional-dependency questions with exact options, step-by-step closure checks, Armstrong rule proofs, counterexamples and a useful-FD count.

SQL Datatypes, Operators and NULL MCQs: 12 Solved Questions with Explanations
Solve 12 SQL questions on datatypes, operators and NULL, then use one three-row trace to see exactly how TRUE, FALSE and UNKNOWN affect a WHERE clause.

SQL Library Functions MCQs: 12 Solved Math, Aggregate, String and Date Questions
Practise 12 solved SQL library function MCQs with inside-out calculations, exact intermediate values and clear explanations of the common traps.