Browse papers
A

Section A: Long Answer Questions

Attempt any TWO questions.

3 questions·10 marks each
1long10 marks

Explain database recovery. Discuss log-based recovery techniques, deferred and immediate database modification, and the concept of checkpoints.

Database Recovery

Recovery is the process of restoring a database to a correct (consistent) state after a failure (system crash, transaction failure, or media failure), ensuring the atomicity and durability of transactions. The recovery manager uses a log (an append-only file written to stable storage) that records every update before it is applied.

Log-Based Recovery

For every write the log stores a record of the form:

Ti, X, Vold, Vnew\langle T_i,\ X,\ V_{old},\ V_{new}\rangle

meaning transaction TiT_i changed data item XX from old value VoldV_{old} to new value VnewV_{new}. Other records are Ti start\langle T_i\ \text{start}\rangle, Ti commit\langle T_i\ \text{commit}\rangle and Ti abort\langle T_i\ \text{abort}\rangle. The Write-Ahead Logging (WAL) rule requires the log record to reach stable storage before the corresponding data block.

Deferred Database Modification

  • Updates are not written to the database until the transaction reaches its commit point; they are only recorded in the log.
  • On failure, only redo is needed (no undo), because no uncommitted change ever reached the database.
  • Recovery: redo(T) for every TT that has both start and commit in the log; ignore the rest.

Immediate Database Modification

  • Updates are written to the database while the transaction is still active (before commit).
  • The log must store both old and new values, so recovery needs both undo and redo.
  • Recovery: undo(T) for transactions with start but no commit; redo(T) for transactions with start and commit.

Checkpoints

Without checkpoints, recovery would have to scan the entire log. A checkpoint is a point at which:

  1. All log records in main memory are flushed to stable storage.
  2. All modified buffer blocks are written to disk.
  3. A checkpoint L\langle \text{checkpoint } L\rangle record (listing active transactions) is written.

During recovery the log is scanned backwards to the most recent checkpoint: transactions that committed before the checkpoint are already safe and can be skipped, drastically reducing recovery time.

Summary: WAL + log records enable redo/undo; deferred modification needs only redo, immediate modification needs undo + redo, and checkpoints limit how much of the log must be processed.

recoverylogging
2long10 marks

Explain indexing in databases. Differentiate between primary, secondary, and clustering indexes, and explain the structure of a B+ tree index.

Indexing in Databases

An index is an auxiliary data structure (a file of search-key, pointer\langle \text{search-key},\ \text{pointer}\rangle entries) built on one or more attributes to speed up record retrieval, avoiding a full linear scan. The attribute on which the index is built is the search key. An index trades extra storage and update cost for faster queries.

Ordered (Single-Level) Index Types

IndexBuilt onData file orderDense/SparsePer relation
Primary (clustering on key)ordering field that is a keysorted on this fieldusually sparseone
Clusteringordering non-key field (duplicates allowed)sorted on this fieldone entry per distinct valueone
Secondarynon-ordering field (key or non-key)not sorted on this fieldmust be densemany possible
  • A primary index orders the data file on a key attribute; only one is possible because a file can be physically sorted on only one field.
  • A clustering index is like a primary index but the ordering field is not a candidate key, so several records share an index entry.
  • A secondary index is defined on a field that does not determine the physical order, so it must contain an entry for every record (dense). Multiple secondary indexes can exist on one table.

Structure of a B+ Tree Index

A B+ tree is a balanced, multi-level, dynamic index that keeps performance stable under insertions/deletions. For order nn:

  • Internal (index) nodes hold up to n1n-1 search-key values and nn child pointers; they only guide the search.
  • Leaf nodes hold the actual search keys together with record/block pointers, and are linked in a doubly linked list for efficient range and sequential scans.
  • All leaves are at the same level (perfectly balanced); every node except the root is at least half full.
  • Search, insert and delete all take O(logn/2N)O(\log_{\lceil n/2\rceil} N) I/O.

Key advantages: all data pointers reside in the leaves (uniform access cost), the linked leaf list makes range queries efficient, and the tree self-balances so query cost stays predictable as the database grows.

indexingb-tree
3long10 marks

Discuss functional dependency and its inference rules (Armstrong's axioms). Explain how to compute the closure of a set of attributes with an example.

Functional Dependency (FD)

A functional dependency XYX \rightarrow Y on a relation RR means that whenever two tuples agree on the attributes in XX, they must also agree on the attributes in YY. XX is the determinant; YY is functionally determined by XX. Example: in Student(RollNo, Name, Address), RollNoName, Address\text{RollNo} \rightarrow \text{Name},\ \text{Address}. FDs express integrity constraints and are the basis of normalization.

Armstrong's Axioms (Inference Rules)

The three primary (sound and complete) rules:

  1. Reflexivity: if YXY \subseteq X then XYX \rightarrow Y.
  2. Augmentation: if XYX \rightarrow Y then XZYZXZ \rightarrow YZ.
  3. Transitivity: if XYX \rightarrow Y and YZY \rightarrow Z then XZX \rightarrow Z.

Derived (secondary) rules: Union (XY, XZXYZX\rightarrow Y,\ X\rightarrow Z \Rightarrow X\rightarrow YZ), Decomposition (XYZXYX\rightarrow YZ \Rightarrow X\rightarrow Y), and Pseudotransitivity (XY, WYZWXZX\rightarrow Y,\ WY\rightarrow Z \Rightarrow WX\rightarrow Z).

Computing the Closure of an Attribute Set

The closure X+X^{+} is the set of all attributes functionally determined by XX under a set of FDs FF.

Algorithm Closure(X, F):
    result := X
    repeat
        for each FD  A -> B  in F:
            if A ⊆ result then
                result := result ∪ B
    until result does not change
    return result

Example

Let R(A,B,C,D,E)R(A,B,C,D,E) with

F={AB,BC,CDE}.F = \{\,A \rightarrow B,\quad B \rightarrow C,\quad CD \rightarrow E\,\}.

Compute {A,D}+\{A,D\}^{+}:

  1. Start: {A,D}\{A, D\}.
  2. ABA \rightarrow B applies ⇒ add BB{A,B,D}\{A, B, D\}.
  3. BCB \rightarrow C applies ⇒ add CC{A,B,C,D}\{A, B, C, D\}.
  4. CDECD \rightarrow E applies (both C,DC, D present) ⇒ add EE{A,B,C,D,E}\{A, B, C, D, E\}.
  5. No new attribute ⇒ stop.

Result: {A,D}+={A,B,C,D,E}\{A,D\}^{+} = \{A,B,C,D,E\}. Since this equals all attributes of RR, ADAD is a candidate key. Closures are used to test key candidates and to check whether an FD XYX \rightarrow Y holds (true iff YX+Y \subseteq X^{+}).

functional-dependencyarmstrong-axioms
B

Section B: Short Answer Questions

Attempt any EIGHT questions.

9 questions·5 marks each
4short5 marks

What are the different types of database users?

Different categories of database users interact with a DBMS in different ways:

  • Database Administrator (DBA): central control of the database; grants/revokes access, defines schema and storage structure, handles backup, recovery, and performance tuning.
  • Database Designers: identify the data and relationships to be stored and design the schema (conceptual/logical/physical).
  • Naive / End Users: interact through ready-made application programs or menus (e.g., a bank teller, ticket clerk) without knowing SQL.
  • Sophisticated Users: analysts, scientists, and engineers who write their own ad-hoc queries (SQL, query tools) to meet complex needs.
  • Application Programmers: write the application programs (in host languages with embedded SQL) used by naive users.
  • Specialized / Standalone Users: maintain complex applications such as CAD, knowledge-base, or expert systems that do not fit the traditional data-processing model.
dbms
5short5 marks

Differentiate between primary key, candidate key, and foreign key.

Keys in the relational model:

  • Candidate Key: a minimal set of attributes that uniquely identifies each tuple in a relation. A relation can have several candidate keys, and no proper subset of a candidate key is itself unique. Example in Student(RollNo, RegNo, Name): both RollNo and RegNo are candidate keys.

  • Primary Key: the one candidate key chosen by the designer to be the principal identifier of the relation. It cannot be NULL and must be unique (entity integrity). Example: RollNo chosen as the primary key.

  • Foreign Key: an attribute (or set) in one relation that references the primary key of another (or the same) relation, enforcing referential integrity. It may be NULL and may repeat. Example: DeptID in Student referencing DeptID in Department.

FeaturePrimary KeyCandidate KeyForeign Key
UniquenessYesYesNo (may repeat)
NULL allowedNoNoYes
Number per tableOneOne or moreZero or more
PurposeIdentify tuplePossible identifierLink two tables
keysrelational-model
6short5 marks

Explain the concept of a weak entity set with an example.

Weak Entity Set

A weak entity set is an entity set that does not have a sufficient attribute of its own to form a primary key; its existence depends on another (strong/owner) entity set through an identifying (or supporting) relationship.

Key points:

  • It has a partial key (discriminator) — attributes that distinguish weak entities belonging to the same owner entity.
  • Its full primary key = primary key of the owner entity + its own partial key.
  • It participates in the identifying relationship with total participation.
  • In an ER diagram, the weak entity is drawn with a double rectangle, the identifying relationship with a double diamond, and the partial key is underlined with a dashed line.

Example

Consider a Payment entity for a Loan. A payment is identified only by a payment_number which restarts from 1 for each loan, so payment_number alone is not unique across all payments.

  • Strong entity: Loan(loan_number, amount)
  • Weak entity: Payment(payment_number, date, amount)payment_number is the partial key.
  • Identifying relationship: Loan–Payment.
  • Primary key of Payment = {loan_number, payment_number}.

Thus a Payment cannot exist without the Loan that owns it.

er-model
7short5 marks

What is a view in SQL? Explain its advantages.

View in SQL

A view is a virtual (logical) table derived from one or more base tables (or other views) by a stored SELECT query. It does not store data itself (unless materialized); its rows are computed when the view is referenced.

CREATE VIEW HighPaid AS
SELECT emp_id, name, salary
FROM   Employee
WHERE  salary > 50000;

It can then be queried like a table: SELECT * FROM HighPaid;

Advantages

  1. Security / Access control: expose only selected columns/rows, hiding sensitive data from users.
  2. Simplicity / Abstraction: complex joins and aggregations are pre-defined, so users write simple queries against the view.
  3. Logical data independence: the view shields applications from changes to the underlying base-table structure.
  4. Customized presentation: different users see different tailored views of the same data.
  5. Reusability & consistency: a frequently used query is written once and reused, ensuring consistent results.
sqlview
8short5 marks

Differentiate between the DELETE, DROP, and TRUNCATE commands.

DELETE vs DROP vs TRUNCATE

FeatureDELETETRUNCATEDROP
CategoryDMLDDLDDL
RemovesSelected rows (or all)All rowsEntire table (rows + structure)
WHERE clauseYesNoNo
Table structure remainsYesYesNo
Logs each row / rollbackYes (can ROLLBACK)Minimal logging; auto-commitCannot rollback
SpeedSlow (row-by-row)FastFast
Fires triggersYesNoNo
Resets identity/auto-incrementNoYes(table gone)

DELETE – removes specific rows matching a condition; the table and schema stay:

DELETE FROM Student WHERE marks < 40;

TRUNCATE – removes all rows quickly, keeps the empty table structure:

TRUNCATE TABLE Student;

DROP – removes the whole table including its data, structure, indexes and constraints:

DROP TABLE Student;
sql
9short5 marks

Explain aggregate functions in SQL with examples.

Aggregate Functions in SQL

Aggregate functions operate on a set (group) of rows and return a single summary value. They are commonly used with the GROUP BY clause and filtered with HAVING.

FunctionPurpose
COUNT()Number of rows / non-null values
SUM()Total of a numeric column
AVG()Arithmetic mean
MAX()Largest value
MIN()Smallest value

Examples

-- Total number of employees
SELECT COUNT(*) FROM Employee;

-- Highest and lowest salary
SELECT MAX(salary), MIN(salary) FROM Employee;

-- Average salary per department
SELECT dept_id, AVG(salary) AS avg_sal
FROM   Employee
GROUP BY dept_id
HAVING AVG(salary) > 40000;

Note: all aggregate functions ignore NULL values (except COUNT(*), which counts every row).

sql
10short5 marks

What is a trigger? Explain with an example.

Trigger

A trigger is a stored procedure that is automatically executed (fired) by the DBMS in response to a specified event — an INSERT, UPDATE, or DELETE — on a particular table. It enforces business rules, complex integrity constraints, auditing, and automatic derivations without explicit user calls.

A trigger is defined by:

  • Event – the DML operation that activates it.
  • TimingBEFORE or AFTER (or INSTEAD OF for views).
  • GranularityFOR EACH ROW (row-level) or statement-level.
  • Action – the SQL/PLSQL body to execute, optionally guarded by a condition (WHEN).

Example (audit log on salary update)

CREATE TRIGGER trg_salary_audit
AFTER UPDATE OF salary ON Employee
FOR EACH ROW
BEGIN
    INSERT INTO Salary_Audit(emp_id, old_sal, new_sal, changed_on)
    VALUES (:OLD.emp_id, :OLD.salary, :NEW.salary, SYSDATE);
END;

Whenever an employee's salary is updated, the trigger automatically records the old and new values in the audit table.

sqltrigger
11short5 marks

Differentiate between relational algebra and relational calculus.

Relational Algebra vs Relational Calculus

Both are formal query languages for the relational model and are equivalent in expressive power, but they differ in approach.

AspectRelational AlgebraRelational Calculus
NatureProcedural — specifies how to obtain the resultNon-procedural (declarative) — specifies what result is wanted
BasisA sequence of operations (σ,π,×,,,\sigma, \pi, \times, \bowtie, \cup, -)Predicate logic (formulas with quantifiers ,\forall, \exists)
Query expressed asAn expression / order of operatorsA predicate describing the desired tuples
TypesSingle language (operator set)Tuple relational calculus (TRC) and Domain relational calculus (DRC)
User controlUser must give the evaluation orderDBMS decides how to evaluate
Relation to SQLCloser to the execution engine / query planCloser to declarative query writing

Example – select students with marks > 80:

  • Algebra: σmarks>80(Student)\sigma_{marks>80}(\text{Student})
  • Tuple calculus: {ttStudentt.marks>80}\{\,t \mid t \in \text{Student} \wedge t.marks > 80\,\}

Thus algebra tells the system how to compute, while calculus only states what is required.

relational-algebrarelational-calculus
12short5 marks

Explain lossless join and dependency-preserving decomposition.

When a relation RR is decomposed into R1,R2,R_1, R_2, \dots, the decomposition should preserve information and constraints. Two desirable properties are:

Lossless (Non-Loss) Join Decomposition

A decomposition of RR into R1R_1 and R2R_2 is lossless if joining them back reproduces exactly the original relation — no spurious (extra) tuples are generated:

R1R2=R.R_1 \bowtie R_2 = R.

Test (binary case): the decomposition of RR into R1,R2R_1, R_2 is lossless iff their common attributes form a superkey of at least one of them:

(R1R2)R1or(R1R2)R2.(R_1 \cap R_2) \rightarrow R_1 \quad\text{or}\quad (R_1 \cap R_2) \rightarrow R_2.

This property is mandatory for any correct decomposition.

Dependency-Preserving Decomposition

A decomposition is dependency-preserving if the set of functional dependencies that can be enforced on the individual decomposed relations is equivalent to the original set:

(F1F2)+=F+.(F_1 \cup F_2 \cup \dots)^{+} = F^{+}.

This ensures every original FD can be checked on a single relation without performing a join, so constraints stay efficiently enforceable.

Example: R(A,B,C)R(A,B,C) with F={AB, BC}F=\{A\rightarrow B,\ B\rightarrow C\} decomposed into R1(A,B)R_1(A,B) and R2(B,C)R_2(B,C). Common attribute BB is a key of R2R_2lossless; ABA\rightarrow B holds in R1R_1 and BCB\rightarrow C in R2R_2dependency-preserving. A good (e.g. BCNF/3NF) design always aims for losslessness, and 3NF additionally guarantees dependency preservation.

normalizationdecomposition

Frequently asked questions

Where can I find the BSc CSIT (TU) Database Management System (BSc CSIT, CSC260) question paper 2079?
The full BSc CSIT (TU) Database Management System (BSc CSIT, CSC260) 2079 (regular) question paper is available free on Kekkei. You can read every question online and attempt the paper under timed exam conditions.
Does the Database Management System (BSc CSIT, CSC260) 2079 paper come with solutions?
Yes. Every question on this Database Management System (BSc CSIT, CSC260) past paper includes a step-by-step solution, plus instant AI feedback when you attempt it on Kekkei.
How many marks is the BSc CSIT (TU) Database Management System (BSc CSIT, CSC260) 2079 paper?
The BSc CSIT (TU) Database Management System (BSc CSIT, CSC260) 2079 paper carries 60 full marks and is meant to be completed in 180 minutes, across 12 questions.
Is practising this Database Management System (BSc CSIT, CSC260) past paper free?
Yes — reading and attempting this Database Management System (BSc CSIT, CSC260) past paper on Kekkei is completely free.