Final Term — Spring 2026 (Solved)

CSE 303 · 23.04.2026 · 40 marks. Every question worked out, with the reasoning and the trap for each. Try each one before revealing.

Schema used in Part 1
student (student-id, name, program)
instructor (instructor-id, name, dept, designation, salary)
enrolls (student-id, courseno, secno, semester, year, grade)
teaches (courseno, secno, semester, year, instructor-id)

Part 1 — SQL Basics 8 marks

Q1(a)smallFind the total number of instructors by designation from the CSE department who taught a course in 2025. [3]
Q1(b)smallFind the total number of (distinct) students who have taken course sections taught by the instructor with ID 10101. [3]
Q1(c)smallList all programs along with the number of students in each Program. [2]

Part 2 — Views, Integrity Constraints, Authorization 10 marks

Q2bigGiven faculty (id, name, dept_name), create a view to show the count of faculties for each department. Then use the view to find the largest department (dept name and faculty count) in terms of number of faculties. [3 + 3]
Q3bigWhat is referential integrity? For faculty (id, name, dept_name) and dept (dept_id, dept_name, budget), with a CREATE TABLE SQL example explain how you will implement referential integrity and different cascading integrity for the faculty table. [1 + 3]

Part 3 — Function and Trigger 9 marks

Schema for Q4 & Q5
employee (emp_id, name, salary)
employee_audit (id, emp_id, action, note, action_time) — action is insert/delete/update
salary_log (id, emp_id, old_salary, new_salary, changed_at)
Q4bigWrite a trigger named “emp_after_update” that fires after a salary is updated in the employee table. Insert into salary_log only if the new salary is not the same as the old one, and always insert a row in employee_audit. [5]
Q5bigWrite a SQL function named “get_emp_salary” that finds and returns the salary of an employee identified by the emp_id passed as a parameter. [4]

Part 4 — Storage and File Structure 13 marks

Q6smallMap each RAID level to its elaborated name. [3]
Q7bigIn a RAID system with two disks, MTTF = 50,000 h (each) and MTTR = 5 h. Calculate the MTTDL. What conclusions can you draw in terms of system reliability? [3 + 1.5]
Q8bigData = 968, with 3 disks for data blocks and 1 disk for parity, using RAID Level 4. (a) Binary data block (b) Calculate the parity block P step by step (c) Disk 1 fails — recover it step by step. [1 + 2.5 + 2]
Paper checklist. Q1 — GROUP BY + COUNT(DISTINCT) + the 4-part section key. Q2 — CREATE VIEW then MAX subquery. Q3 — definition + UNIQUE on the referenced column + the five cascade options. Q4 — AFTER UPDATE, FOR EACH ROW, the <> guard, OLD/NEW. Q5 — DECLARE, SELECT INTO, RETURN, distinct parameter name. Q6 — 0=b 1=f 2=g 3=e 4=d 5=a 6=c. Q7 — MTTF²/(2·MTTR) then divide by 8760. Q8 — 4-bit blocks, XOR twice, verify.