CS Atlas GATE 2027
DBMS course
0 / 119 complete

DBMS/Phase 3 · Query Languages

Checkpoint CP-3 · Item 59 of 119

Phase 3 Checkpoint (15 questions)

Read at your own pace. Try the questions before opening the answers.

On this page

Running data: STUDENT with 5 rows (Esha's cgpa is NULL, she has no enrolments), COURSE C1–C4, ENROLL with 7 rows. Relational algebra and calculus questions use set semantics; SQL questions use SQL semantics.

15 questions · 25 marks · 45 minutes. Negative marking on MCQ only: −1/3 mark for a wrong 1-mark MCQ, −2/3 for a wrong 2-mark MCQ. No negative marking for MSQ or NAT; MSQ has no partial credit.

Q1 · NAT · 1 mark(s) — Projection

How many tuples are in πdept, credits(COURSE)?

Numerical answer: ________

Q2 · NAT · 2 mark(s) — Natural join

How many tuples are in ENROLL ⋈ COURSE ⋈ STUDENT (natural joins, 5-row STUDENT)?

Numerical answer: ________

Q3 · MCQ · 2 mark(s) — Division

πroll, cid(ENROLL) ÷ πcid(σdept='CS' ∨ dept='EE'(COURSE)) returns:

  1. (A) {1, 3}
  2. (B) ∅
  3. (C) {1}
  4. (D) {1, 2, 3}

Q4 · NAT · 2 mark(s) — Outer join

R(A, B) = {(1, a), (2, a), (3, b)}, S(B, C) = {(a, x), (c, y)}. How many tuples are in R ⟗ S?

Numerical answer: ________

Q5 · MCQ · 1 mark(s) — Equivalence

Which rewrite is not valid in general?

  1. (A) πA(R ∩ S) = πA(R) ∩ πA(S)
  2. (B) σc(R ∩ S) = σc(R) ∩ σc(S)
  3. (C) σc1(σc2(R)) = σc2(σc1(R))
  4. (D) πA(R ∪ S) = πA(R) ∪ πA(S)

Q6 · MCQ · 2 mark(s) — TRC

{ s.roll | s ∈ STUDENT ∧ ∃c ∈ COURSE (c.dept = 'ME' ⇒ ∃e ∈ ENROLL (e.roll = s.roll ∧ e.cid = c.cid)) } on the 5-row STUDENT returns:

  1. (A) ∅
  2. (B) {1, 2, 3, 4}
  3. (C) {4}
  4. (D) all five rolls

Q7 · MCQ · 1 mark(s) — Safety

Which TRC expression is unsafe?

  1. (A) { t | t ∈ R ∨ t ∈ S }
  2. (B) { t | t ∈ R ∧ ¬∃s ∈ S (s.A = t.A) }
  3. (C) { t | ¬(t ∈ R) ∧ t.A = 3 }
  4. (D) { t | t ∈ R ∧ t.A > 3 }

Q8 · NAT · 1 mark(s) — DISTINCT

How many rows: SELECT DISTINCT cid FROM ENROLL WHERE roll IN (1, 3);

Numerical answer: ________

Q9 · NAT · 2 mark(s) — NULL logic

How many rows: SELECT * FROM STUDENT WHERE NOT (cgpa >= 8 OR dept = 'EE');

Numerical answer: ________

Q10 · NAT · 2 mark(s) — Aggregates

SELECT SUM(credits) FROM COURSE C JOIN ENROLL E ON C.cid = E.cid WHERE E.roll = 1;

Numerical answer: ________

Q11 · MCQ · 2 mark(s) — Outer join count

SELECT S.name, COUNT(E.cid) FROM STUDENT S LEFT JOIN ENROLL E ON S.roll = E.roll AND E.grade = 'A' GROUP BY S.name; gives Bhavin:

  1. (A) 0
  2. (B) 1
  3. (C) NULL
  4. (D) no row

Q12 · NAT · 2 mark(s) — Set ops

R = {5, 5, 5, 6}, S = {5, 6, 6}. How many rows in R EXCEPT ALL S plus rows in R INTERSECT ALL S?

Numerical answer: ________

Q13 · NAT · 2 mark(s) — Subquery

How many rows: SELECT name FROM STUDENT WHERE cgpa < ALL (SELECT cgpa FROM STUDENT WHERE dept = 'CS' AND cgpa IS NOT NULL);

Numerical answer: ________

Q14 · MCQ · 2 mark(s) — Correlated

SELECT C.title FROM COURSE C WHERE NOT EXISTS (SELECT * FROM STUDENT S WHERE S.dept = C.dept AND NOT EXISTS (SELECT * FROM ENROLL E WHERE E.roll = S.roll AND E.cid = C.cid)); returns:

  1. (A) Circuits, Thermo
  2. (B) no rows
  3. (C) DBMS, Networks, Circuits, Thermo
  4. (D) Circuits only

Q15 · MCQ · 1 mark(s) — Views

Which statement about views is false?

  1. (A) A normal view stores its rows on disk.
  2. (B) A view can hide columns from users.
  3. (C) A view with GROUP BY is generally not updatable.
  4. (D) Views support logical data independence.

✓Answer Vault

Reveal answers when you’re ready

Q1 Answer: 4 · 1 mark(s)

(CS, 4), (CS, 3), (EE, 4), (ME, 3): all different.

Re-read: Lesson 3.1.1 — Selection, projection, rename; composing operations

Q2 Answer: 6 · 2 mark(s)

Match on cid, then roll and dept: Asha's Circuits (EE) is lost; Esha has no enrolment.

Re-read: Lesson 3.1.3 — Cartesian product, theta join, equijoin, natural join

Q3 Answer: (C) · 2 mark(s)

Courses C1, C2, C3: only roll 1 took all three.

  • (A) is wrong: Roll 3 lacks C3.
  • (B) is wrong: Roll 1 qualifies.
  • (D) is wrong: Roll 2 lacks C1, C2.

Re-read: Lesson 3.1.5 — Division and for-all queries

Q4 Answer: 4 · 2 mark(s)

Matches (1, a, x), (2, a, x); unmatched R (3, b); unmatched S (c, y).

Re-read: Lesson 3.1.4 — Outer joins: left, right, full

Q5 Answer: (A) · 1 mark(s)

π does not distribute over ∩.

  • (B) is wrong: Valid.
  • (C) is wrong: Valid.
  • (D) is wrong: Valid.

Re-read: Lesson 3.1.6 — Equivalent expressions; min/max tuples in a result; extended RA (aggregation)

Q6 Answer: (D) · 2 mark(s)

Any non-ME course makes the implication vacuously true.

  • (A) is wrong: No.
  • (B) is wrong: Esha also passes vacuously.
  • (C) is wrong: That is the intended "took every ME course" with ∀.

Re-read: Lesson 3.2.2 — Exists and for-all queries; translating between TRC and RA

Q7 Answer: (C) · 1 mark(s)

t is not range-restricted.

  • (A) is wrong: Safe.
  • (B) is wrong: Safe.
  • (D) is wrong: Safe.

Re-read: Lesson 3.2.3 — Safe vs unsafe expressions; relational completeness

Q8 Answer: 3 · 1 mark(s)

C1, C2, C3.

Re-read: Lesson 3.3.3 — SELECT–FROM–WHERE, DISTINCT, aliases, LIKE, BETWEEN, ORDER BY; bags vs sets

Q9 Answer: 1 · 2 mark(s)

Asha: T → F. Bhavin: F OR T = T → F. Chirag: T → F. Diya: F OR F = F → T. Esha: U OR F = U → U. Only Diya.

Re-read: Lesson 3.3.4 — NULL in SQL: three-valued logic, IS NULL, comparisons

Q10 Answer: 11 · 2 mark(s)

C1 4 + C2 3 + C3 4.

Re-read: Lesson 3.3.5 — Aggregates, GROUP BY, HAVING; COUNT(*) vs COUNT(col); NULL handling

Q11 Answer: (A) · 2 mark(s)

Bhavin's only grade is B, so the ON condition finds no partner; his padded row has E.cid NULL.

  • (B) is wrong: His C3 row has grade B.
  • (C) is wrong: COUNT is never NULL.
  • (D) is wrong: LEFT JOIN keeps him.

Re-read: Lesson 3.3.6 — Joins in SQL: INNER, NATURAL, LEFT/RIGHT/FULL OUTER

Q12 Answer: 4 · 2 mark(s)

EXCEPT ALL: 5 → 2, 6 → 0: 2 rows. INTERSECT ALL: 5 → 1, 6 → 1: 2 rows. Total 4 (always |R|).

Re-read: Lesson 3.3.7 — UNION / INTERSECT / EXCEPT and their ALL variants

Q13 Answer: 2 · 2 mark(s)

CS values {9.1, 8.4}; cgpa < 8.4: Bhavin, Diya.

Re-read: Lesson 3.3.8 — Nested subqueries: IN, ANY/SOME, ALL, EXISTS, scalar subqueries

Q14 Answer: (A) · 2 mark(s)

Courses taken by every student of their own department: CS courses fail because of Esha; Circuits (EE: Bhavin took it) and Thermo (ME: Diya took it) pass.

  • (B) is wrong: Two courses pass.
  • (C) is wrong: Esha (CS) took nothing.
  • (D) is wrong: Thermo passes too.

Re-read: Lesson 3.3.9 — Correlated subqueries; for-all in SQL; tracing a query on a table instance

Q15 Answer: (A) · 1 mark(s)

A normal view stores only its definition.

  • (B) is wrong: True.
  • (C) is wrong: True.
  • (D) is wrong: True.

Re-read: Lesson 3.3.10 — Views and WITH

Ready for the next idea?

Mark this item complete when you’ve finished reading and working through it.