Thirty questions covering all phases (45 marks). Set a 90-minute timer and work on paper. For MSQ, record every correct option; for NAT, record a number. When you finish, open the final answer key below to check your work.
Running data used by some questions:
| roll | name | dept | cgpa |
|---|---|---|---|
| 1 | Asha | CS | 9.1 |
| 2 | Bhavin | EE | 7.8 |
| 3 | Chirag | CS | 8.4 |
| 4 | Diya | ME | 6.9 |
| 5 | Esha | CS | NULL |
STUDENT
| cid | title | dept | credits |
|---|---|---|---|
| C1 | DBMS | CS | 4 |
| C2 | Networks | CS | 3 |
| C3 | Circuits | EE | 4 |
| C4 | Thermo | ME | 3 |
COURSE
| roll | cid | grade |
|---|---|---|
| 1 | C1 | A |
| 1 | C2 | B |
| 1 | C3 | A |
| 2 | C3 | B |
| 3 | C1 | B |
| 3 | C2 | A |
| 4 | C4 | C |
ENROLL
30 questions · 45 marks · 90 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 · MCQ · 1 mark(s) — ER notation
In an ER diagram, a dashed ellipse represents:
- (A) a key attribute
- (B) a weak entity
- (C) a multivalued attribute
- (D) a derived attribute
Q2 · NAT · 2 mark(s) — ER to tables
E1 (with 2 multivalued attributes) —1:N— E2 —M:N— E3, and E3 —1:1, both total— E4. Minimum number of tables?
Your answer:
Q3 · NAT · 1 mark(s) — Superkeys
R(A, B, C, D, E) has candidate keys {A, B} and {C}. How many superkeys?
Your answer:
Q4 · NAT · 2 mark(s) — Cascading delete
T(id, parent), parent → T.id ON DELETE CASCADE, holds (1, NULL), (2, 1), (3, 1), (4, 2), (5, 4), (6, 3), (7, 6), (8, NULL), (9, 8). After deleting id 3, how many tuples remain?
Your answer:
Q5 · MSQ · 1 mark(s) — Integrity
ENROLL.roll references STUDENT.roll (no referential actions declared). Which operations can violate referential integrity?
- (A) Inserting into STUDENT
- (B) Inserting into ENROLL
- (C) Deleting from STUDENT
- (D) Deleting from ENROLL
Q6 · NAT · 1 mark(s) — Projection
How many tuples are in πdept(σcgpa > 7(STUDENT))?
Your answer:
Q7 · MCQ · 2 mark(s) — Division
πroll, cid(ENROLL) ÷ πcid(σdept='CS'(COURSE)) is:
- (A) {1, 2, 3}
- (B) {3}
- (C) {1}
- (D) {1, 3}
Q8 · NAT · 2 mark(s) — Natural join
How many tuples are in STUDENT ⋈ COURSE (natural join)?
Your answer:
Q9 · MCQ · 1 mark(s) — TRC safety
Which tuple relational calculus expression is unsafe?
- (A) { t | ¬(t ∈ R) }
- (B) { t | t ∈ R ∧ t.A > 5 }
- (C) { t | t ∈ R ∨ t ∈ S }
- (D) { t | t ∈ R ∧ ¬(t ∈ S) }
Q10 · NAT · 2 mark(s) — NULL logic
SELECT COUNT(*) FROM STUDENT WHERE NOT (cgpa > 8 AND dept = 'CS');
Your answer:
Q11 · NAT · 2 mark(s) — GROUP BY
How many rows: SELECT dept FROM STUDENT GROUP BY dept HAVING AVG(cgpa) > 7;
Your answer:
Q12 · MCQ · 2 mark(s) — Correlated subquery
SELECT S1.name FROM STUDENT S1 WHERE (SELECT COUNT(*) FROM STUDENT S2 WHERE S2.cgpa > S1.cgpa) < 2; returns:
- (A) Asha, Chirag
- (B) Asha
- (C) Asha, Chirag, Esha
- (D) Asha, Bhavin, Chirag
Q13 · NAT · 1 mark(s) — Outer join
SELECT COUNT(*) FROM COURSE C LEFT JOIN ENROLL E ON C.cid = E.cid AND E.grade = 'B';
Your answer:
Q14 · NAT · 1 mark(s) — Bag operations
R holds the values 1, 1, 1, 2, 3 and S holds 1, 2, 2. How many rows are in R EXCEPT ALL S?
Your answer:
Q15 · NAT · 2 mark(s) — Candidate keys
R(A, B, C, D, E, F), F = {AB → C, C → D, D → A, E → F}. How many candidate keys?
Your answer:
Q16 · MCQ · 2 mark(s) — Normal forms
R(A, B, C, D, E), F = {A → BC, C → D, BD → E}. Highest normal form?
- (A) 1NF
- (B) 2NF
- (C) 3NF
- (D) BCNF
Q17 · NAT · 1 mark(s) — Minimal cover
How many FDs are in a minimal cover of {A → BC, B → C, AB → D}?
Your answer:
Q18 · MCQ · 2 mark(s) — Decomposition
R(A, B, C, D), F = {A → B, B → C, C → D}, decomposed into {AB, BC, CD}. It is:
- (A) lossless and dependency preserving
- (B) lossless, not preserving
- (C) lossy, preserving
- (D) lossy, not preserving
Q19 · MSQ · 1 mark(s) — BCNF
Which statements are true?
- (A) Every BCNF relation is in 3NF.
- (B) Every relation with two attributes is in BCNF.
- (C) 3NF allows an FD X → A with X not a superkey if A is prime.
- (D) A lossless BCNF decomposition always preserves dependencies.
Q20 · NAT · 1 mark(s) — Blocking factor
B = 4096 bytes, R = 250 bytes, unspanned. Blocking factor?
Your answer:
Q21 · NAT · 2 mark(s) — Multilevel index
r = 250,000 records, a secondary index on a key field, K = 10, P = 6, B = 1024. Block accesses to fetch one record through the multilevel index?
Your answer:
Q22 · NAT · 2 mark(s) — B+ tree order
B = 2048, K = 14, Pr = 10, P = 6. Order of a B+ tree leaf node (number of key–record-pointer pairs)?
Your answer:
Q23 · NAT · 1 mark(s) — B-tree insertion
A B-tree whose nodes hold at most 2 keys starts empty; insert 1, 2, 3, 4, 5, 6, 7, 8 in order. How many node splits occur?
Your answer:
Q24 · NAT · 1 mark(s) — B-tree bounds
B-tree of order 7 (max children), height 3. Minimum number of keys?
Your answer:
Q25 · MCQ · 2 mark(s) — Conflict serializability
S = R1(X) R2(Z) R1(Z) R3(X) R3(Y) W1(X) W3(Y) R2(Y) W2(Z) W2(Y). Which is true?
- (A) S is conflict equivalent to T2, T3, T1
- (B) S is conflict equivalent to T3, T1, T2
- (C) S is not conflict serializable
- (D) S is conflict equivalent to T1, T2, T3
Q26 · MCQ · 1 mark(s) — Recoverability
W1(A) R2(A) C1 W2(A) C2 is:
- (A) strict
- (B) not recoverable
- (C) recoverable but not cascadeless
- (D) cascadeless but not strict
Q27 · MCQ · 2 mark(s) — View serializability
S = R1(A) W2(A) R3(A) W1(A) W3(A). Which is true?
- (A) S is conflict serializable
- (B) S is view serializable but not conflict serializable
- (C) S is neither
- (D) S is serial
Q28 · MCQ · 1 mark(s) — 2PL
Which statement about basic two-phase locking is false?
- (A) It guarantees conflict serializability.
- (B) The serial order follows the lock points.
- (C) It prevents deadlock.
- (D) It may allow cascading rollbacks.
Q29 · MCQ · 1 mark(s) — Deadlock prevention
Wound-wait. T1 (TS = 10) holds item Q; T2 (TS = 5) requests Q. What happens?
- (A) T2 waits
- (B) T1 is rolled back
- (C) T2 is rolled back
- (D) Both wait
Q30 · NAT · 2 mark(s) — Timestamp ordering
TS(T1) = 1, TS(T2) = 2, TS(T3) = 3. Under basic timestamp ordering, schedule R2(A) W1(A) R3(B) W2(B) W3(A). How many transactions are aborted?
Your answer:
🎓 That is the whole course.
Final answer key
Reveal answers when you’re ready
Stop here until you have finished the 90-minute final test.
🔑 Open the full answer key
Q1 Answer: (D) · 1 mark(s)
Dashed = derived.
- (A) is wrong: Underlined.
- (B) is wrong: Double rectangle.
- (C) is wrong: Double ellipse.
Re-read: Lesson 1.1.2 — Attribute types: simple/composite, single/multivalued, stored/derived, NULL-able, key attribute
Q2 Answer: 6 · 2 mark(s)
E1, E2, E3+E4 merged (3) + M:N (1) + 2 multivalued (2).
Re-read: Lesson 2.4.2 — Mapping 1:1, 1:N, M:N with participation; minimum number of tables
Q3 Answer: 20 · 1 mark(s)
Contain AB: 8. Contain C: 16. Contain ABC: 4. 8 + 16 − 4.
Re-read: Lesson 2.2.1 — Superkey, candidate key, primary key, alternate key; counting superkeys
Q4 Answer: 6 · 2 mark(s)
3 → 6 → 7 are deleted.
Re-read: Lesson 2.3.2 — Referential actions: restrict, cascade, set null; tracing cascading deletes
Q5 Answer: (B) (C) · 1 mark(s)
New child rows and removed parents.
- (A) is wrong: Adding a parent is safe.
- (D) is wrong: Removing a child is safe.
Re-read: Lesson 2.3.1 — Domain, key, entity and referential integrity; which operations violate what
Q6 Answer: 2 · 1 mark(s)
CS and EE (Esha's NULL is UNKNOWN; Diya fails).
Re-read: Lesson 3.1.1 — Selection, projection, rename; composing operations
Q7 Answer: (D) · 2 mark(s)
CS courses C1, C2: rolls 1 and 3 took both.
- (A) is wrong: Roll 2 took neither.
- (B) is wrong: Roll 1 also qualifies.
- (C) is wrong: Roll 3 also took both.
Re-read: Lesson 3.1.5 — Division and for-all queries
Q8 Answer: 8 · 2 mark(s)
The common attribute is dept: CS 3 × 2, EE 1 × 1, ME 1 × 1.
Re-read: Lesson 3.1.3 — Cartesian product, theta join, equijoin, natural join
Q9 Answer: (A) · 1 mark(s)
t is not restricted to any relation.
- (B) is wrong: Safe.
- (C) is wrong: Both branches restrict t.
- (D) is wrong: R restricts t.
Re-read: Lesson 3.2.3 — Safe vs unsafe expressions; relational completeness
Q10 Answer: 2 · 2 mark(s)
Asha, Chirag: TRUE inside → FALSE. Bhavin, Diya: FALSE inside → TRUE. Esha: UNKNOWN AND TRUE = UNKNOWN → UNKNOWN.
Re-read: Lesson 3.3.4 — NULL in SQL: three-valued logic, IS NULL, comparisons
Q11 Answer: 2 · 2 mark(s)
CS 8.75, EE 7.8, ME 6.9.
Re-read: Lesson 3.3.5 — Aggregates, GROUP BY, HAVING; COUNT(*) vs COUNT(col); NULL handling
Q12 Answer: (C) · 2 mark(s)
Asha has 0 above, Chirag 1; for Esha every S2.cgpa > NULL is UNKNOWN, so the count is 0.
- (A) is wrong: Misses Esha.
- (B) is wrong: Chirag has only one above.
- (D) is wrong: Bhavin has two above.
Re-read: Lesson 3.3.9 — Correlated subqueries; for-all in SQL; tracing a query on a table instance
Q13 Answer: 4 · 1 mark(s)
B grades in C1, C2, C3 (one each); C4 is padded.
Re-read: Lesson 3.3.6 — Joins in SQL: INNER, NATURAL, LEFT/RIGHT/FULL OUTER
Q14 Answer: 3 · 1 mark(s)
1: 3 − 1 = 2; 2: 0; 3: 1.
Re-read: Lesson 3.3.7 — UNION / INTERSECT / EXCEPT and their ALL variants
Q15 Answer: 3 · 2 mark(s)
ABE, BCE, BDE.
Re-read: Lesson 4.2.3 — Attribute closure; all candidate keys; prime vs non-prime; counting superkeys
Q16 Answer: (B) · 2 mark(s)
Only key A. C → D: C not a superkey, D non-prime, C not part of a key: transitive.
- (A) is wrong: Single-attribute key: no partial dependency.
- (C) is wrong: C → D violates 3NF.
- (D) is wrong: No.
Re-read: Lesson 4.4.5 — Drill: highest normal form of a given relation
Q17 Answer: 3 · 1 mark(s)
{A → B, B → C, A → D}.
Re-read: Lesson 4.2.5 — Minimal (canonical) cover
Q18 Answer: (A) · 2 mark(s)
Chase succeeds through B → C, C → D; each FD lies in a piece.
- (B) is wrong: All FDs are inside pieces.
- (C) is wrong: It is lossless.
- (D) is wrong: Both hold.
Re-read: Lesson 4.3.2 — Dependency preservation
Q19 Answer: (A) (B) (C) · 1 mark(s)
BCNF may lose dependencies.
- (D) is wrong: Not always.
Re-read: Lesson 4.4.4 — BCNF; 3NF vs BCNF trade-off
Q20 Answer: 16 · 1 mark(s)
⌊4096/250⌋.
Re-read: Lesson 5.1.1 — Storage basics: disk, blocks, block access cost, records, blocking factor, spanned vs unspanned
Q21 Answer: 4 · 2 mark(s)
fo = 64; 64² < 250,000 ≤ 64³ → 3 levels; + 1.
Re-read: Lesson 5.3.3 — Multilevel indexes; fan-out; logarithm primer
Q22 Answer: 85 · 2 mark(s)
24 p_leaf + 6 ≤ 2048 → 85.
Re-read: Lesson 5.6.2 — B+ tree order from block size, key size and pointer size
Q23 Answer: 4 · 1 mark(s)
Same as the 10 … 70 trace for 1 … 7; inserting 8 goes into [7] without a split.
Re-read: Lesson 5.5.2 — B-tree search and insertion with node splits
Q24 Answer: 31 · 1 mark(s)
m = 4: 2·4² − 1.
Re-read: Lesson 5.5.3 — B-tree deletion basics; min/max keys; height bounds
Q25 Answer: (B) · 2 mark(s)
R3(X) before W1(X): T3 → T1. R1(Z) before W2(Z): T1 → T2. W3(Y) before R2(Y) and W2(Y): T3 → T2.
- (A) is wrong: T1 must precede T2.
- (C) is wrong: Acyclic.
- (D) is wrong: T3 must precede T1.
Re-read: Lesson 6.4.2 — Conflict serializability: conflicting ops, precedence graph, equivalent serial orders
Q26 Answer: (C) · 1 mark(s)
T2 reads uncommitted A; T1 commits first.
- (A) is wrong: No.
- (B) is wrong: Commit order is fine.
- (D) is wrong: The read is dirty.
Re-read: Lesson 6.5.1 — Recoverable, cascadeless and strict schedules; how they nest
Q27 Answer: (B) · 2 mark(s)
Cycle between T1 and T2; view equivalent to T1, T2, T3 (T1 reads initial A, T3 reads from T2, T3 writes last).
- (A) is wrong: Cycle.
- (C) is wrong: It is VS.
- (D) is wrong: Interleaved.
Re-read: Lesson 6.4.3 — View serializability; blind writes; relation to conflict serializability
Q28 Answer: (C) · 1 mark(s)
Deadlocks can occur.
- (A) is wrong: True.
- (B) is wrong: True.
- (D) is wrong: True.
Re-read: Lesson 6.6.2 — Two-phase locking: growing/shrinking, lock point, guarantees
Q29 Answer: (B) · 1 mark(s)
Older T2 wounds the younger holder.
- (A) is wrong: Older requesters do not wait in wound-wait.
- (C) is wrong: That would be wait-die for a younger requester.
- (D) is wrong: No.
Re-read: Lesson 6.6.4 — Deadlocks: wait-for graph, wait-die, wound-wait, starvation
Q30 Answer: 2 · 2 mark(s)
W1(A) fails (RTS(A) = 2), W2(B) fails (RTS(B) = 3); W3(A) succeeds.
Re-read: Lesson 6.7.1 — Timestamp ordering protocol; Thomas write rule