BSc CSIT (TU) Science Database Management System (BSc CSIT, CSC260) Question Paper 2081 Nepal
This is the official BSc CSIT (TU) (Science stream) Database Management System (BSc CSIT, CSC260) question paper for 2081, as set in the regular annual examination. It carries 60 full marks and a time allowance of 180 minutes, across 12 questions. On Kekkei you can attempt this Database Management System (BSc CSIT, CSC260) past paper online with a timer, get instant AI feedback and step-by-step solutions, and track the topics where you lose marks — completely free. Whether you are revising for your BSc CSIT (TU) Database Management System (BSc CSIT, CSC260) exam or solving previous years' question papers, this 2081 paper is a great way to practise under real exam conditions.
Section A: Long Answer Questions
Attempt any TWO questions.
Explain Boyce-Codd Normal Form (BCNF). Differentiate it from 3NF and decompose a given relation into BCNF with an example.
Boyce-Codd Normal Form (BCNF)
A relation is in BCNF if, for every non-trivial functional dependency that holds on , the determinant is a superkey of . In other words, the left-hand side of every FD must be able to uniquely identify a tuple. BCNF is a stricter version of 3NF that removes all anomalies arising from functional dependencies.
BCNF vs 3NF
| Aspect | 3NF | BCNF |
|---|---|---|
| Condition for | is a superkey OR is a prime attribute (part of some candidate key) | must be a superkey |
| Strictness | Less strict | More strict (every BCNF relation is in 3NF) |
| Dependency preservation | Always achievable | May not be achievable |
| Lossless decomposition | Always achievable | Always achievable |
| Anomalies | May remain when overlapping candidate keys exist | Fully removes FD-based redundancy |
BCNF differs from 3NF only when a non-prime determinant exists, or when candidate keys overlap.
Example: Decomposing into BCNF
Consider the relation:
with the FDs:
- (each teacher teaches exactly one subject)
Candidate keys: and . Prime attributes are Student, Subject, Teacher.
Why it is in 3NF but not BCNF: For the FD , the determinant Teacher is not a superkey, so BCNF is violated. It is still in 3NF because Subject is a prime attribute.
BCNF decomposition — split on the violating FD :
Now:
- In , the only FD is and Teacher is the key → BCNF.
- In , the key is and there are no other FDs → BCNF.
The join on Teacher reconstructs without loss (lossless), though the FD is no longer enforced by a single relation, illustrating that BCNF may sacrifice dependency preservation.
Define a transaction and explain its ACID properties. Discuss the various states of a transaction with a state diagram.
Transaction
A transaction is a logical unit of work that consists of one or more database operations (read/write) executed as a single, indivisible action. It takes the database from one consistent state to another. Example: transferring Rs. 500 from account A to account B (debit A, credit B) is one transaction.
ACID Properties
The four ACID properties guarantee reliable transaction processing:
- A — Atomicity: A transaction is all-or-nothing. Either all its operations are completed and committed, or none are; partial effects are rolled back. (Managed by the recovery/transaction manager.)
- C — Consistency: A transaction transforms the database from one valid (consistent) state to another, preserving all integrity constraints.
- I — Isolation: Concurrently executing transactions do not interfere; intermediate states of one are invisible to others. The result is equivalent to some serial execution.
- D — Durability: Once a transaction commits, its changes are permanent and survive subsequent system failures (ensured via logs/non-volatile storage).
States of a Transaction
A transaction passes through the following states:
- Active — the initial state; the transaction is executing its read/write operations.
- Partially Committed — the final statement has executed, but changes may still be in buffers (not yet written to disk).
- Committed — the transaction completed successfully and all changes are permanently saved; durability is guaranteed.
- Failed — normal execution can no longer proceed (e.g., constraint violation, system error).
- Aborted — the transaction has been rolled back and the database is restored to its state prior to the transaction. It may then be restarted or killed.
State Diagram (described)
+---------+
begin -->| Active |
+----+----+
ok | | error
v v
+------------------+ +--------+
| Partially | | Failed |
| Committed | +---+----+
+---------+--------+ |
| v
v +---------+
+-----------+ | Aborted |
| Committed | +---------+
+-----------+ (restart / kill)
Transitions: Active → Partially Committed → Committed (success path); Active → Failed → Aborted and Partially Committed → Failed → Aborted (failure path). From Aborted a transaction may be restarted (back to Active) or terminated.
Explain concurrency control. Describe the timestamp-based protocol and the two-phase locking (2PL) protocol for concurrency control.
Concurrency Control
Concurrency control is the mechanism by which a DBMS manages the simultaneous execution of multiple transactions so that the database remains consistent and the result is equivalent to some serial execution (serializability). Without it, concurrent access leads to problems such as the lost update, dirty read, and unrepeatable read anomalies.
Timestamp-Based Protocol
Each transaction is assigned a unique timestamp when it starts; older transactions get smaller timestamps. Each data item keeps two values:
- — largest timestamp of a transaction that successfully wrote .
- — largest timestamp of a transaction that successfully read .
The order of conflicting operations is forced to follow timestamp order:
Read by :
- If → is too old to read a value already overwritten → abort and roll back .
- Otherwise execute the read and set .
Write by :
- If or → abort .
- Otherwise execute the write and set .
This protocol guarantees conflict serializability and is deadlock-free (no waiting — conflicts cause rollback), but may cause cascading rollbacks/starvation.
Two-Phase Locking (2PL) Protocol
2PL uses shared (S) locks for reading and exclusive (X) locks for writing. Every transaction acquires and releases locks in two distinct phases:
- Growing phase: the transaction may acquire locks but cannot release any.
- Shrinking phase: the transaction may release locks but cannot acquire any new ones.
The single point at which the last lock is acquired is the lock point. 2PL guarantees conflict serializability of schedules.
Variants:
- Strict 2PL: all exclusive locks are held until commit/abort → prevents cascading rollbacks.
- Rigorous 2PL: all locks (S and X) held until commit/abort.
Limitation: Basic 2PL can lead to deadlocks (two transactions each waiting for a lock held by the other), which must be handled by detection or prevention.
Section B: Short Answer Questions
Attempt any EIGHT questions.
Differentiate between the DELETE, DROP, and TRUNCATE commands.
DELETE vs DROP vs TRUNCATE
| Feature | DELETE | TRUNCATE | DROP |
|---|---|---|---|
| Command type | DML | DDL | DDL |
| Removes | Specific rows (with WHERE) or all rows | All rows only | Entire table (structure + data) |
WHERE clause | Allowed | Not allowed | Not applicable |
| Logging / speed | Logs each row → slower | Minimal logging → fast | Fast |
| Triggers fired | Yes (row triggers) | No | No |
| Rollback | Can be rolled back | Usually cannot (auto-commit) | Cannot be rolled back |
| Resets identity/auto-increment | No | Yes | N/A (table gone) |
| Structure after operation | Table remains | Table remains (empty) | Table removed entirely |
Examples:
DELETE FROM Student WHERE id = 5; -- removes one row, can ROLLBACK
TRUNCATE TABLE Student; -- removes all rows, keeps table
DROP TABLE Student; -- removes table and its definition
Summary: DELETE selectively removes rows and is recoverable; TRUNCATE quickly empties a table but keeps its structure; DROP deletes the table object completely.
Explain aggregate functions in SQL with examples.
Aggregate Functions in SQL
Aggregate functions perform a calculation on a set (group) of values and return a single summary value. They are commonly used with the GROUP BY clause and filtered with HAVING. They ignore NULL values (except COUNT(*)).
| Function | Purpose |
|---|---|
COUNT() | Number of rows / non-null values |
SUM() | Total of a numeric column |
AVG() | Average (mean) of a numeric column |
MIN() | Smallest value |
MAX() | Largest value |
Examples (table Employee(empno, name, dept, salary)):
-- Total number of employees
SELECT COUNT(*) FROM Employee;
-- Total and average salary
SELECT SUM(salary) AS total, AVG(salary) AS avg_sal FROM Employee;
-- Highest and lowest salary
SELECT MAX(salary), MIN(salary) FROM Employee;
-- Average salary per department, only depts averaging above 50000
SELECT dept, AVG(salary) AS avg_sal
FROM Employee
GROUP BY dept
HAVING AVG(salary) > 50000;
Here GROUP BY dept partitions rows by department and AVG(salary) is computed per group, while HAVING filters the aggregated results.
What is a trigger? Explain with an example.
Trigger
A trigger is a special stored procedure that is automatically executed (fired) by the DBMS in response to a specified event (INSERT, UPDATE, or DELETE) on a table or view. Triggers are used to enforce business rules, maintain integrity constraints, audit changes, and automatically update related data.
Classification:
- By timing: BEFORE or AFTER the triggering event.
- By granularity: row-level (
FOR EACH ROW) or statement-level. - Pseudo-records
OLD(existing values) andNEW(new values) reference the affected row.
Example (audit on salary change):
CREATE TRIGGER salary_audit
AFTER UPDATE OF salary ON Employee
FOR EACH ROW
BEGIN
INSERT INTO Salary_Log(empno, old_sal, new_sal, changed_on)
VALUES (:OLD.empno, :OLD.salary, :NEW.salary, SYSDATE);
END;
Whenever an employee's salary is updated, this trigger fires automatically and records the old value, new value, and timestamp in Salary_Log — without any explicit call from the application.
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.
| Aspect | Relational Algebra | Relational Calculus |
|---|---|---|
| Nature | Procedural — specifies how to get the result | Non-procedural / declarative — specifies what is wanted |
| Description | Sequence of operations on relations | Predicate logic describing the desired tuples |
| Order of operations | Programmer specifies the order | No order specified; left to the system |
| Basic constructs | Operators: (select), (project), , , , , | Variables, predicates, quantifiers |
| Types | (single form) | Tuple Relational Calculus (TRC) and Domain Relational Calculus (DRC) |
| Closeness to implementation | Closer to query execution plans | Closer to natural-language/SQL specification |
Example — "names of students in the CS department":
- Algebra (procedural):
- Tuple calculus (declarative):
By Codd's theorem, relational algebra and (safe) relational calculus are equivalent in expressive power.
Explain lossless join and dependency-preserving decomposition.
Lossless Join Decomposition
A decomposition of relation into and is a lossless-join (non-additive) decomposition if joining the decomposed relations reconstructs exactly the original relation — no spurious (extra) tuples are introduced and none are lost:
Condition (for binary decomposition): the decomposition is lossless if the common attributes form a key of at least one of the sub-relations, i.e. one of the following holds:
Losslessness is essential — without it, decomposition would corrupt the data.
Dependency-Preserving Decomposition
A decomposition is dependency-preserving if the set of functional dependencies enforceable on the individual sub-relations is equivalent to (i.e. can derive the closure of) the original set :
This means every FD of the original relation can be checked on a single decomposed relation without performing a join, so constraints are efficiently enforced.
Key Point
- Lossless join is mandatory and is always achievable (e.g., BCNF).
- Dependency preservation is desirable but is not always achievable in BCNF; 3NF, however, guarantees both lossless join and dependency preservation.
What is a deadlock in a database? How is it handled?
Deadlock
A deadlock is a situation in which two or more transactions are each waiting indefinitely for a data item that is locked by another transaction in the set, so none can proceed. For example, holds a lock on and waits for , while holds a lock on and waits for — a circular wait.
The four necessary conditions are mutual exclusion, hold-and-wait, no preemption, and circular wait.
Handling Deadlocks
1. Deadlock Prevention
Design the locking scheme so a deadlock can never occur, typically using transaction timestamps:
- Wait-Die (non-preemptive): an older transaction waits for a younger one; a younger one requesting a resource held by an older one is rolled back ("dies").
- Wound-Wait (preemptive): an older transaction forces ("wounds") a younger holder to roll back; a younger one waits for an older holder.
2. Deadlock Detection and Recovery
Allow deadlocks to occur, then detect and resolve them:
- Maintain a wait-for graph (nodes = transactions, edge means waits for ).
- A cycle in the graph indicates a deadlock.
- Recovery: select a victim transaction (usually the one with least work done or fewest locks) and roll it back to break the cycle.
3. Timeout-Based
If a transaction waits longer than a preset time limit, assume a deadlock and abort it. Simple but may abort transactions unnecessarily.
Define schedule. Differentiate between serial and serializable schedules.
Schedule
A schedule is a chronological (time-ordered) sequence of the operations (read, write, commit, abort) of two or more concurrent transactions, preserving the relative order of operations within each individual transaction. It shows how the operations of the transactions are interleaved during execution.
Serial vs Serializable Schedule
| Aspect | Serial Schedule | Serializable Schedule |
|---|---|---|
| Definition | Transactions execute one completely after another, with no interleaving | Operations of transactions are interleaved, but the final effect is equivalent to some serial schedule |
| Concurrency | No concurrency | Allows concurrency |
| Consistency | Always consistent (by definition) | Consistent because it is equivalent to a serial order |
| Performance | Low resource utilization, no overlap | High throughput / better resource use |
| Types | — | Conflict-serializable, view-serializable |
Key idea: A serializable schedule is the goal of concurrency control — it permits the performance benefits of interleaved execution while guaranteeing the same correctness as if the transactions had run serially. For example, an interleaved schedule of and is serializable if its result equals either the serial order or .
Explain the concept of a stored procedure.
Stored Procedure
A stored procedure is a named, precompiled collection of SQL statements (and optional procedural logic such as variables, loops, and conditionals) stored in the database and executed on the server by calling its name. It is created with CREATE PROCEDURE and invoked with CALL or EXEC.
Key characteristics:
- Accepts input/output parameters.
- Precompiled and stored, so repeated execution is faster (no re-parsing).
- Encapsulates business logic on the server, promoting reusability and modularity.
- Improves security (users can be granted execute rights without direct table access) and reduces network traffic (one call instead of many statements).
Example:
CREATE PROCEDURE GetSalary(IN emp_id INT, OUT sal DECIMAL(10,2))
BEGIN
SELECT salary INTO sal FROM Employee WHERE empno = emp_id;
END;
-- Call it
CALL GetSalary(101, @result);
Advantages: better performance, code reuse, centralized logic, enhanced security, and reduced network load. Disadvantage: logic becomes database-specific and harder to port/version-control.
What is data redundancy? How does normalization reduce it?
Data Redundancy
Data redundancy is the unnecessary repetition of the same data in multiple places within a database. It commonly arises when related data is stored together in a single un-normalized table. Redundancy wastes storage and, more importantly, causes update anomalies:
- Insertion anomaly: cannot insert some data without other (possibly unknown) data.
- Deletion anomaly: deleting one fact unintentionally removes another.
- Update anomaly: a value repeated in many rows must be changed everywhere, risking inconsistency if some copies are missed.
Example: storing the department name and department location in every employee row repeats the location for each employee of that department.
How Normalization Reduces Redundancy
Normalization is the process of decomposing relations based on functional dependencies into smaller, well-structured relations to eliminate redundancy and anomalies, progressing through normal forms (1NF → 2NF → 3NF → BCNF):
- 1NF removes repeating groups / multi-valued attributes (atomic values).
- 2NF removes partial dependencies (non-key attributes depending on part of a composite key).
- 3NF removes transitive dependencies (non-key attributes depending on other non-key attributes).
- BCNF ensures every determinant is a superkey.
By separating each independent fact into its own table and linking tables with foreign keys, each piece of data is stored only once. This eliminates redundant copies, prevents update/insert/delete anomalies, and keeps the database consistent.
Frequently asked questions
- Where can I find the BSc CSIT (TU) Database Management System (BSc CSIT, CSC260) question paper 2081?
- The full BSc CSIT (TU) Database Management System (BSc CSIT, CSC260) 2081 (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) 2081 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) 2081 paper?
- The BSc CSIT (TU) Database Management System (BSc CSIT, CSC260) 2081 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.