BSc CSIT (TU) Science Database Management System (BSc CSIT, CSC260) Question Paper 2078 Nepal
This is the official BSc CSIT (TU) (Science stream) Database Management System (BSc CSIT, CSC260) question paper for 2078, 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 2078 paper is a great way to practise under real exam conditions.
Section A: Long Answer Questions
Attempt any TWO questions.
What is relational algebra? Explain the fundamental operations of relational algebra (selection, projection, union, set difference, Cartesian product, and join) with examples.
Relational Algebra
Relational algebra is a procedural query language that takes one or two relations as input and produces a new relation as output. It is the theoretical foundation of SQL and specifies how to obtain a result through a sequence of operations.
Consider the relations:
Employee(eid, name, dept, salary) and Department(dept, location).
1. Selection ()
Selects rows (tuples) that satisfy a given predicate.
Returns all employees earning more than 30000.
2. Projection ()
Selects specified columns (attributes) and removes duplicates.
Returns only the name and salary columns.
3. Union ()
Combines tuples of two union-compatible relations (same arity and domains), removing duplicates.
Returns names of employees in IT or HR.
4. Set Difference ()
Returns tuples present in the first relation but not in the second (relations must be union-compatible).
Returns ids of all employees not in IT.
5. Cartesian Product ()
Combines every tuple of the first relation with every tuple of the second. If has tuples and has tuples, has tuples.
6. Join ()
Combines related tuples from two relations based on a condition; it is effectively a Cartesian product followed by a selection.
- Theta join:
- Natural join (matches common attributes automatically):
Returns each employee combined with the location of their department.
Summary
The fundamental (primitive) operations are plus rename (); join and intersection are derived operations expressible using these primitives.
Explain SQL with examples. Write SQL queries to create tables, insert data, and perform join, group by, and nested subquery operations on a given schema.
SQL (Structured Query Language)
SQL is the standard declarative language for defining, manipulating, and querying data in a relational DBMS. Its sub-languages are DDL (CREATE, ALTER, DROP), DML (INSERT, UPDATE, DELETE, SELECT), DCL (GRANT, REVOKE) and TCL (COMMIT, ROLLBACK).
Assume the schema:
CREATE TABLE Department (
dept_id INT PRIMARY KEY,
dname VARCHAR(30) NOT NULL
);
CREATE TABLE Employee (
emp_id INT PRIMARY KEY,
name VARCHAR(50) NOT NULL,
salary DECIMAL(10,2),
dept_id INT,
FOREIGN KEY (dept_id) REFERENCES Department(dept_id)
);
Inserting data
INSERT INTO Department VALUES (1, 'IT'), (2, 'HR');
INSERT INTO Employee VALUES (101, 'Ram', 45000, 1),
(102, 'Sita', 38000, 1),
(103, 'Hari', 30000, 2);
Join operation
List each employee with their department name:
SELECT e.name, e.salary, d.dname
FROM Employee e
JOIN Department d ON e.dept_id = d.dept_id;
GROUP BY operation
Find the number of employees and average salary per department:
SELECT d.dname, COUNT(*) AS num_emp, AVG(e.salary) AS avg_sal
FROM Employee e
JOIN Department d ON e.dept_id = d.dept_id
GROUP BY d.dname
HAVING AVG(e.salary) > 30000;
Nested subquery
Find employees who earn more than the average salary of all employees:
SELECT name, salary
FROM Employee
WHERE salary > (SELECT AVG(salary) FROM Employee);
A correlated subquery example — employees earning above their own department's average:
SELECT name, salary
FROM Employee e
WHERE salary > (SELECT AVG(salary)
FROM Employee
WHERE dept_id = e.dept_id);
These queries demonstrate table creation (DDL), data insertion (DML), and the join, aggregation, and nested-query capabilities of SQL.
Explain database recovery. Discuss log-based recovery techniques, deferred and immediate database modification, and the concept of checkpoints.
Database Recovery
Database recovery is the process of restoring the database to the most recent consistent state that existed before a failure (transaction failure, system crash, or media failure), so that the atomicity and durability properties of transactions are preserved.
Log-Based Recovery
The system maintains a log (an append-only sequence of records on stable storage) recording every database modification. A typical update log record is:
meaning transaction changed data item from old value to new value . Other records include and . The Write-Ahead Logging (WAL) rule requires the log record to be written to stable storage before the corresponding data is written to disk.
1. Deferred Database Modification
- All updates are recorded only in the log; the actual database is not modified until the transaction commits.
- During recovery, only redo is needed:
- REDO every that has both and in the log (using ).
- Transactions with no commit record are simply ignored (their changes never reached the database).
- No UNDO is required.
2. Immediate Database Modification
- Updates are written to the database while the transaction is still active, after the log record is written (WAL).
- During recovery, both operations are needed:
- UNDO (restore ) every that has a start but no commit record.
- REDO (apply ) every that has both start and commit records.
- Undo must be done before redo, processing the log backward then forward.
3. Checkpoints
Scanning the entire log after a crash is expensive. A checkpoint is periodically written after flushing all log records and modified buffer blocks to disk, where is the list of active transactions.
During recovery the system scans backward only until the most recent checkpoint:
- Transactions that committed before the checkpoint need no action.
- Only transactions active at, or started after, the checkpoint need to be redone/undone.
This dramatically reduces recovery time and limits the portion of the log that must be examined.
Section B: Short Answer Questions
Attempt any EIGHT questions.
What is a deadlock in a database? How is it handled?
Deadlock in a Database
A deadlock is a situation in which two or more transactions are each waiting for a lock held by another, so that none of them can ever proceed — they wait for each other in a cycle. For example, holds a lock on and waits for , while holds a lock on and waits for .
Handling Deadlocks
1. Deadlock Prevention — ensure the system never enters a deadlock:
- Acquire all required locks at once, or impose a total ordering on data items and lock them in that order.
- Timestamp-based schemes such as Wait-Die (older transaction waits, younger is rolled back) and Wound-Wait (older wounds/rolls back younger, younger waits).
2. Deadlock Detection — allow deadlocks but detect them using a Wait-For Graph (WFG), where an edge means is waiting for . A cycle in the WFG indicates a deadlock.
3. Deadlock Recovery — once detected, select a victim transaction (usually the one with least cost/work done) and roll it back (full or partial), releasing its locks so others can continue. Starvation is avoided by limiting how often the same transaction is chosen as victim.
4. Timeout — a simpler scheme where a transaction waiting longer than a threshold is assumed deadlocked and rolled back.
Define schedule. Differentiate between serial and serializable schedules.
Schedule
A schedule is a chronological ordering of the operations (read, write, commit, abort) of a set of concurrent transactions, preserving the relative order of operations within each individual transaction.
Serial vs Serializable Schedule
| Basis | Serial Schedule | Serializable Schedule |
|---|---|---|
| Definition | Transactions execute one after another, with no interleaving of operations | Operations of transactions may interleave, but the result is equivalent to some serial schedule |
| Concurrency | No concurrency; only one transaction runs at a time | Allows concurrent execution |
| Performance | Low resource utilization, poor throughput | High concurrency and throughput |
| Consistency | Always consistent (correct by definition) | Consistent because it is equivalent to a serial schedule |
| Relationship | Every serial schedule is also serializable | Every serializable schedule is not necessarily serial |
A serializable schedule gives the same final result as if the transactions had run serially, so it preserves database consistency while still allowing concurrency. Serializability is commonly tested via conflict serializability (an acyclic precedence/serialization graph) or view serializability.
Explain the concept of a stored procedure.
Stored Procedure
A stored procedure is a named, precompiled set of one or more SQL statements (and procedural logic) that is stored in the database and executed on the server as a single unit by calling its name. It may accept input/output parameters and can include control structures such as loops, conditionals, and exception handling (e.g. PL/SQL, T-SQL).
Example
CREATE PROCEDURE GetEmpByDept (IN p_dept INT)
BEGIN
SELECT emp_id, name, salary
FROM Employee
WHERE dept_id = p_dept;
END;
-- Invocation
CALL GetEmpByDept(1);
Advantages
- Performance: parsed and compiled once, so repeated execution is faster; reduces network traffic (one call instead of many statements).
- Reusability & maintainability: business logic is written once and shared by many applications.
- Security: users can be granted permission to execute the procedure without direct access to the underlying tables.
- Consistency: centralizes rules so all applications behave the same way.
What is data redundancy? How does normalization reduce it?
Data Redundancy and Normalization
Data redundancy is the unnecessary repetition of the same data in multiple places within a database. Storing data redundantly (e.g. repeating a customer's address in every order row) wastes storage and causes anomalies:
- Insertion anomaly — cannot add data without other unrelated data.
- Update anomaly — a change must be made in many rows; missing one leaves the data inconsistent.
- Deletion anomaly — deleting one row unintentionally removes other useful information.
How Normalization Reduces Redundancy
Normalization is the process of decomposing relations into smaller, well-structured relations based on functional dependencies, organizing data to minimize redundancy and avoid anomalies. It is applied through a series of normal forms:
- 1NF — atomic (single-valued) attributes, no repeating groups.
- 2NF — 1NF + no partial dependency (non-key attributes fully depend on the whole primary key).
- 3NF — 2NF + no transitive dependency (non-key attributes do not depend on other non-key attributes).
- BCNF — stricter 3NF where every determinant is a candidate key.
By splitting a table so that each fact is stored exactly once and linking the resulting tables through primary key / foreign key relationships, normalization removes duplicated data and thus eliminates the update, insertion, and deletion anomalies.
Explain the multivalued dependency and 4NF in brief.
Multivalued Dependency (MVD) and 4NF
Multivalued Dependency
A multivalued dependency holds in a relation when, for each value of , there is a set of values of that is independent of all other attributes . In other words, and are independent multivalued facts about .
Example: A relation Course(course, instructor, textbook) where a course has several instructors and several textbooks independently. Then:
Storing all combinations forces redundant rows (every instructor paired with every textbook), causing update anomalies even though there is no functional dependency among them.
Fourth Normal Form (4NF)
A relation is in 4NF if it is in BCNF and contains no non-trivial multivalued dependency unless is a superkey.
To achieve 4NF the relation is decomposed to separate independent multivalued facts. The example becomes:
Course_Instructor(course, instructor)Course_Textbook(course, textbook)
This removes the cross-product redundancy while preserving all information (a lossless decomposition).
What is a join? Explain inner join and outer join.
Join
A join is a relational/SQL operation that combines rows from two or more tables based on a related column (usually a primary key–foreign key relationship), producing a single result set.
Inner Join
Returns only the matching rows — rows that satisfy the join condition in both tables. Unmatched rows are excluded.
SELECT e.name, d.dname
FROM Employee e
INNER JOIN Department d ON e.dept_id = d.dept_id;
Outer Join
Returns matching rows plus unmatched rows from one or both tables; missing columns are filled with NULL. There are three types:
- LEFT OUTER JOIN — all rows from the left table + matching rows from the right (NULLs where no match). e.g. all employees, even those with no department.
- RIGHT OUTER JOIN — all rows from the right table + matching rows from the left.
- FULL OUTER JOIN — all rows from both tables, matched where possible, NULLs elsewhere.
SELECT e.name, d.dname
FROM Employee e
LEFT OUTER JOIN Department d ON e.dept_id = d.dept_id;
Key difference: an inner join keeps only matched tuples, whereas an outer join preserves unmatched tuples from one or both relations using NULLs.
Explain the difference between a strong and a weak entity.
Strong vs Weak Entity
| Basis | Strong Entity | Weak Entity |
|---|---|---|
| Key | Has its own primary key that uniquely identifies its instances | Has no sufficient primary key; identified by a partial (discriminator) key combined with the owner's key |
| Existence | Exists independently | Existence-dependent on a strong (owner) entity; cannot exist without it |
| Relationship | Connected through ordinary relationships | Connected to its owner through an identifying relationship |
| ER notation | Single rectangle (key underlined with solid line) | Double rectangle; identifying relationship shown by double diamond; partial key underlined with a dashed line |
Example: Employee(emp_id, name) is a strong entity. Dependent(name, relation) is a weak entity that exists only with respect to an employee; it is identified by combining emp_id (owner key) with name (partial key) → composite key (emp_id, name).
Differentiate between a file system and a DBMS.
File System vs DBMS
| Basis | File System | DBMS |
|---|---|---|
| Data redundancy | High; same data duplicated across files | Controlled/minimized through normalization |
| Data consistency | Hard to maintain; updates may be inconsistent | Enforced via constraints and a single integrated store |
| Data access | Application programs must contain access logic; weak query support | Powerful declarative query language (SQL) |
| Concurrency | Poor or no concurrent multi-user control | Built-in concurrency control (locking, transactions) |
| Security | File-level only, coarse | Fine-grained (user/role, view-level) authorization |
| Integrity | Constraints coded in each application | Centralized integrity constraints (PK, FK, CHECK) |
| Recovery | No automatic backup/recovery | Backup, logging, and crash recovery provided |
| Data independence | Programs tightly coupled to file structure | Logical and physical data independence |
Summary: A file system stores data in independent OS files with logic embedded in applications, leading to redundancy and inconsistency, whereas a DBMS provides a centralized, controlled environment offering data integrity, security, concurrency, recovery, and data independence.
Explain the roles of a Database Administrator (DBA).
Roles of a Database Administrator (DBA)
The DBA is the person responsible for the overall management, control, and integrity of the database system. The main roles are:
- Schema definition — designs the database schema (tables, relationships) and writes the DDL definitions and storage structure.
- Storage structure and access-method definition — decides physical organization and indexes for efficient access.
- Schema and physical modification — alters the schema and physical organization as requirements change.
- Granting authorization / security — controls user access by granting and revoking privileges and enforcing data security.
- Integrity constraint specification — defines and maintains constraints (primary keys, foreign keys, checks) to preserve data integrity.
- Backup and recovery — schedules backups and restores the database to a consistent state after failures.
- Performance monitoring and tuning — monitors usage, tunes queries and indexes, and manages disk space.
- Concurrency and routine maintenance — manages multi-user access, applies patches/upgrades, and handles day-to-day administration.
Frequently asked questions
- Where can I find the BSc CSIT (TU) Database Management System (BSc CSIT, CSC260) question paper 2078?
- The full BSc CSIT (TU) Database Management System (BSc CSIT, CSC260) 2078 (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) 2078 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) 2078 paper?
- The BSc CSIT (TU) Database Management System (BSc CSIT, CSC260) 2078 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.