47.0 KB · commit 40bb182
| year | 2024 |
|---|---|
| exam | B.Sc. Engineering 2nd Year Even Semester Examination, 2024 |
| course_code | ECE 2215 |
| course_title | Database Systems |
| full_marks | 60 |
| time | 3 Hours |
| layer | exam-style |
← Prev: 2023 | Explanation Layer | Original Question Paper | Next: ClassTestQuestions →
Topic: T01.2 · File system vs DBMS · Section A · 1
Question. A courier tracking company maintains large files for daily parcel updates. The data grows rapidly and requires fast retrieval. Choose between a file based system and a DBMS and justify the decision.
Answer.
Decision: Choose a DBMS (Database Management System).
Justification:
parcel_id). This delivers lookup results in milliseconds instead of scanning large files line by line.Topic: T02.5 · Design a full E-R diagram for a scenario · Section A · 3 (Repeated question: Also asked in 2017 | Solved in T02)
Question. Draw an E-R diagram for RUET student database which can be used to store student’s basic information, course advisor’s information, subject registration, result information.
Answer.
Design Specifications:
roll_no. Attributes: name, dept_name, series.advisor_id. Attributes: name, designation, department.course_code. Attributes: course_title, credits.result_id. Attributes: semester, gpa, cgpa.Relationships:
Advises (1:N): An advisor guides multiple students. Each student has one advisor (total participation of student).Registers (M:N): Students register for multiple courses, and courses have many students. Descriptive attributes: session, semester.Obtains (1:N): Each student obtains multiple semester results (total participation of result).
Figure: RUET Student Database Conceptual E-R Diagram
Short version for 2024 Q.1(b) (2 marks):
Draw the 4 entity rectangles (STUDENT, ADVISOR, COURSE, RESULT) and 3 relationship diamonds (Advises, Registers, Obtains) with primary keys underlined (roll_no, advisor_id, course_code, result_id) and cardinality labels (1:N, M:N, 1:N). Omit secondary descriptive attributes to complete within 2 marks.
Topic: T05.5 · Aggregation queries: GROUP BY + HAVING, CGPA, extremes without LIMIT · Section A · 2
Question.
STUDENT (SID, Name, Age, Major)
COURSE (CID, Title, Credits)
ENROLLMENT (SID, CID, Grade)
Using the above schema, write a SQL query to find the average grade for each course.
Answer.
SELECT CID,
AVG(Grade) AS avg_grade
FROM ENROLLMENT
GROUP BY CID;
(If course title is also retrieved by joining COURSE):
SELECT c.CID, c.Title,
AVG(e.Grade) AS avg_grade
FROM COURSE c
JOIN ENROLLMENT e ON c.CID = e.CID
GROUP BY c.CID, c.Title;
Topic: T07.2 · Triggers for security before and after a breach · Section A · 2 (Repeated question: Also asked in 2017 | Solved in T07)
Question. Discuss how trigger can contribute to the security of database before and after a security breach. Explain with example.
Answer.
Triggers protect database security at two stages: proactive prevention before a breach and forensic auditing after a breach.
BEFORE triggers act as real-time security gatekeepers. They evaluate incoming data modifications before changes reach the database.
SIGNAL SQLSTATE '45000'.Example (Blocking salary changes outside working hours):
DELIMITER //
CREATE TRIGGER trg_prevent_unauthorized_salary_update
BEFORE UPDATE ON employees
FOR EACH ROW
BEGIN
IF NEW.salary <> OLD.salary THEN
IF CURRENT_TIME() NOT BETWEEN '09:00:00' AND '17:00:00' THEN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Security Alert: Salary edits outside office hours are blocked';
END IF;
END IF;
END //
DELIMITER ;
AFTER triggers execute immediately after a modification succeeds on a table.
AFTER triggers write the unauthorized changes into an independent audit log table.USER(), NOW(), the modified table, and both OLD and NEW column values.Example (Logging security role modifications):
DELIMITER //
CREATE TRIGGER trg_audit_role_change
AFTER UPDATE ON user_roles
FOR EACH ROW
BEGIN
IF OLD.role <> NEW.role THEN
INSERT INTO security_audit_log (
user_id, old_role, new_role, changed_by, changed_at
) VALUES (
OLD.user_id, OLD.role, NEW.role, USER(), NOW()
);
END IF;
END //
DELIMITER ;
Short version for 2024 Q.2(a) (3 marks): State how BEFORE triggers block unauthorized actions with SIGNAL and how AFTER triggers record tamper-evident audit logs with USER() and timestamps. Provide one concise trigger example.
Topic: T04.2 · Write RA queries on a given schema · Section A · 1
Question.
EMPLOYEE (EID, Name, Department, Salary)
PROJECT (PID, Name, Budget)
WORKS_ON (EID, PID, Hours)
Suppose a company wants to find employees working on multiple projects. Write the relational algebra expression for it.
Answer.
Group WORKS_ON by EID, filter for counts strictly greater than 1, and join with EMPLOYEE:
Alternative (pure relational algebra without aggregation):
Self-join WORKS_ON with itself to find matching employees on different projects:
Topic: T09.2 · Consistency property alone, with example · Section A · 1 (Repeated question: Also asked in 2019 | Solved in T09)
Question. Explain the consistency property of a database system with a proper example.
Answer.
Definition:
The consistency property requires that executing a transaction in isolation preserves the consistency of the database. If the database starts in a valid state that satisfies all integrity rules, it must end in a valid state after the transaction completes.
Categories of Consistency Constraints:
CHECK constraints (such as balance >= 0).Example (Bank Transfer):
Let account A have $1000 and account B have $2000. The consistency invariant requires total funds to remain constant:
Transaction T1 transfers $50 from A to B:
Topic: T08.8 · Normalize an unnormalized table → 1NF → 2NF → 3NF · Section A · 2
Question. A library database stores information about Books, Authors, Publishers and Borrowers. Create a table that contains some data redundancy and partial dependencies. Also, show the procedure to normalize the table.
Answer.
Consider a single table LIBRARY_LOAN designed to store all lending records:
| Book_ID | Borrower_ID | Title | Author_ID | Author_Name | Publisher_Name | Borrower_Name | Borrow_Date |
|---|---|---|---|---|---|---|---|
| B101 | U01 | DBMS Concepts | A1 | Silberschatz | McGraw-Hill | Akib | 2024-01-10 |
| B101 | U02 | DBMS Concepts | A1 | Silberschatz | McGraw-Hill | Shuvo | 2024-02-15 |
| B202 | U01 | Operating Systems | A1 | Silberschatz | Wiley | Akib | 2024-03-01 |
Primary Key: (Book_ID, Borrower_ID)
Functional Dependencies:
Book_ID -> Title, Author_ID, Publisher_Name (partial dependency on subset Book_ID)Author_ID -> Author_Name (transitive dependency)Borrower_ID -> Borrower_Name (partial dependency on subset Borrower_ID)(Book_ID, Borrower_ID) -> Borrow_Date (full dependency)Data Redundancy:
Decompose LIBRARY_LOAN so non-prime attributes depend only on the full primary key:
BOOK_INFO(Book_ID, Title, Author_ID, Author_Name, Publisher_Name) with PK Book_IDBORROWER(Borrower_ID, Borrower_Name) with PK Borrower_IDLOAN(Book_ID, Borrower_ID, Borrow_Date) with PK (Book_ID, Borrower_ID)This eliminates partial dependencies and achieves 2NF.
In BOOK_INFO, the dependency Author_ID -> Author_Name is transitive because Author_ID is a non-prime attribute determining Author_Name.
We decompose BOOK_INFO into:
BOOK(Book_ID, Title, Author_ID, Publisher_Name) with PK Book_ID and FK Author_IDAUTHOR(Author_ID, Author_Name) with PK Author_IDBook_ID, Title, Author_ID, Publisher_Name)Book_ID | FK: Author_ID references AUTHOR(Author_ID)Author_ID, Author_Name)Author_IDBorrower_ID, Borrower_Name)Borrower_IDBook_ID, Borrower_ID, Borrow_Date)(Book_ID, Borrower_ID) | FKs: Book_ID references BOOK, Borrower_ID references BORROWERTopic: T12.1 · Failure classification, precautions, recovery methods · Section A · 1 (Repeated question: Also asked in 2019 | Solved in T12)
Question. Discuss the ways of DBMS can be failed. Also, mention the precautions should be taken considering the failure of DBMS and point out the recovery methods.
Answer.
A DBMS can fail in three primary ways:
Short version for 2024 Q.3(b) (CO1, 4 marks): Provide the same three sections in concise bullet points to fit the 4-mark time limit.
Topic: T06.1 · Types of joins · Section A · 1
Question. Differentiate between inner joining and outer joining.
Answer.
| Feature | Inner Join | Outer Join |
|---|---|---|
| Tuple Retention | Keeps only matching tuples from both relations. Drops non-matching rows. | Preserves matching rows plus unmatched rows from one or both relations. |
| Missing Values | Never produces NULL values to represent missing relationship data. | Pads missing attributes of unmatched tuples with NULL. |
| Information Loss | Loses dangling records that fail the join predicate. | Prevents information loss by keeping all records from preserved relations. |
| Forms / Syntax | Theta join, equijoin, and natural join (INNER JOIN, JOIN). | Left outer, right outer, and full outer join (LEFT JOIN, RIGHT JOIN, FULL JOIN). |
Topic: T06.2 · Join outcome tables · Section A · 2
Question.
Consider the following tables:
Courses
| Code | Series | t_code |
|---|---|---|
| E_2215 | 2020 | T1 |
| E_4127 | 2021 | T2 |
| E_1203 | 2022 | T3 |
| E_2219 | 2021 | T3 |
| t_code | Designation |
|---|---|
| T1 | Head |
| T2 | AP |
| T3 | AP |
| T4 | Lecturer |
Answer.
The common attribute between Courses and Teacher is t_code.
Matches tuples with equal t_code values and retains one copy of t_code.
Relational algebra:
Courses⋈TeacherMySQL query:
SELECT Code, Series, t_code, Designation
FROM Courses
NATURAL JOIN Teacher;
Outcome Table (4 rows):
| Code | Series | t_code | Designation |
|---|---|---|---|
| E_2215 | 2020 | T1 | Head |
| E_4127 | 2021 | T2 | AP |
| E_1203 | 2022 | T3 | AP |
| E_2219 | 2021 | T3 | AP |
Explanation: T1, T2, and T3 have matches in Teacher. T3 matches twice because two courses share T3. Teacher T4 has no course match and is omitted.
Preserves all tuples from the left relation (Courses). Unmatched right-side fields are set to NULL.
Relational algebra:
Courses⟕TeacherMySQL query:
SELECT Courses.Code, Courses.Series, Courses.t_code, Teacher.Designation
FROM Courses
LEFT JOIN Teacher ON Courses.t_code = Teacher.t_code;
Outcome Table (4 rows):
| Code | Series | t_code | Designation |
|---|---|---|---|
| E_2215 | 2020 | T1 | Head |
| E_4127 | 2021 | T2 | AP |
| E_1203 | 2022 | T3 | AP |
| E_2219 | 2021 | T3 | AP |
Explanation: Every course row has an assigned t_code present in Teacher. No NULL padding is needed. The outcome is identical to the Natural Join.
Preserves all tuples from the right relation (Teacher). Unmatched left-side fields are filled with NULL.
Relational algebra:
Courses⟖TeacherMySQL query:
SELECT Courses.Code, Courses.Series, Teacher.t_code, Teacher.Designation
FROM Courses
RIGHT JOIN Teacher ON Courses.t_code = Teacher.t_code;
Outcome Table (5 rows):
| Code | Series | t_code | Designation |
|---|---|---|---|
| E_2215 | 2020 | T1 | Head |
| E_4127 | 2021 | T2 | AP |
| E_1203 | 2022 | T3 | AP |
| E_2219 | 2021 | T3 | AP |
NULL | NULL | T4 | Lecturer |
Explanation: Teacher T4 has no matching course row. T4 appears with NULL for Code and Series.
Retains all records from both relations. Non-matching fields are filled with NULL.
Relational algebra:
Courses⟗TeacherMySQL query:
SELECT Courses.Code, Courses.Series, Courses.t_code, Teacher.Designation
FROM Courses
LEFT JOIN Teacher ON Courses.t_code = Teacher.t_code
UNION
SELECT Courses.Code, Courses.Series, Teacher.t_code, Teacher.Designation
FROM Courses
RIGHT JOIN Teacher ON Courses.t_code = Teacher.t_code;
Outcome Table (5 rows):
| Code | Series | t_code | Designation |
|---|---|---|---|
| E_2215 | 2020 | T1 | Head |
| E_4127 | 2021 | T2 | AP |
| E_1203 | 2022 | T3 | AP |
| E_2219 | 2021 | T3 | AP |
NULL | NULL | T4 | Lecturer |
Explanation: All courses find a teacher match. The unmatched teacher T4 is preserved with NULL for Code and Series.
Topic: T05.2 · DDL + DML warm-up: CREATE, INSERT, ALTER ... ADD, UPDATE, DELETE, rename, filter · Section A · 2 (Repeated question: Also asked in 2018 | Solved in T05)
Question.
Write down the SQL queries for following operations:
i) Create table for student (roll, name, dept)
ii) Insert one example entry for student tbale
iii) Modify the student table to student (roll, name, dept, session)
iv) Show the roll and name of the students of ECE dept only.
(Note: "tbale" printed verbatim in original paper; refers to table)
Answer.
(i) Create student table:
CREATE TABLE student (
roll INT,
name VARCHAR(50),
dept VARCHAR(20),
PRIMARY KEY (roll, dept)
);
(ii) Insert one example entry:
INSERT INTO student (roll, name, dept)
VALUES (1810001, 'Rahim', 'ECE');
(iii) Modify student table to add session:
ALTER TABLE student
ADD session VARCHAR(10);
(iv) Show roll and name of students from ECE:
SELECT roll, name
FROM student
WHERE dept = 'ECE';
Variant for 2024 Q.4(b) (4 marks): The identical queries answer parts (i) through (iv).
Topic: T04.2 · Write RA queries on a given schema · Section B · 2 (Repeated question: Also asked in 2019 | Solved in T04)
Question.
Consider the following relation database:
Patient (Patient_ID, Patient_Name, Mobile)
History (Patient_ID, Symptom, Date)
Report (Patient_ID, Corona_center, Test_result)
Now, write down the relational algebra (Not SQL) to find out the following queris:
i) Find the names of those patients who have fever symptom
ii) Find out the mobile numbers of those patients who have provided samples in Rangpur corona center and their results have become positive.
(Note: "relation database" and "queris" printed verbatim in original paper; refers to relational database and queries)
Answer.
Assumption: In relation Report, Parient_ID is a typographical misprint for Patient_ID.
(i) Names of patients who have fever symptom:
Join patients with their history records filtered for fever, then project the patient names:
ΠPatient_name(Patient⋈σSymptom="fever"(History))(ii) Maximum number of suspected patients (high-fever symptom) on a date:
Filter records for "high-fever", count patients per date, and take the maximum:
T1←σSymptom="high-fever"(History) Tdaily←Dateγcount(Patient_ID) as patient_count(T1) γmax(patient_count)(Tdaily)(iii) Mobile numbers of patients tested in Rajshahi corona center with positive results:
Filter reports for Rajshahi center and positive results, join with Patient, and project mobile numbers:
ΠMobile(Patient⋈σCorona_center="Rajshahi"∧Test_result="positive"(Report))(iv) Names of patients who have high fever symptom but negative test result:
Find patients who have high fever and whose test result is negative:
Thigh←ΠPatient_ID(σSymptom="high-fever"(History)) Tneg←ΠPatient_ID(σTest_result="negative"(Report)) ΠPatient_name(Patient⋈(Thigh∩Tneg))Short version for 2024 Q.5(a) (Sec B, 4 marks, CO2):
Answer parts (i) and (ii) only. Part (i) matches part (i) above. Part (ii) targets Rangpur instead of Rajshahi:
Topic: T05.7 · Multi-table business-schema query sets (MySQL): Covid, Company, Insurance, E-commerce · Section B · 2 (Repeated question: Also asked in 2020 | Solved in T05)
Question.
Define RDMS. Consider the following insurance database where the primary keys are underlined.
Person (driver_id, name, address)
Car (license, model, year)
Accident (report_no, data, location)
Owner (driver_id, license)
Participated (driver_id, report_no, car, damage_amount)
Write MySQL for the following queries –
i) Find the number of accidents in which the cars belonging to “John Smith” were involved.
ii) Add a new accident to the database, assuming any values for required attributes.
iii) Update the car “Mazda” belonging to “John”.
iv) Update the damage amounts $3000 for the car with license number “YJK-100” in the accident with report number “APR2197”.
(Note: "RDMS" and "data" printed verbatim in original paper; refers to RDBMS and date)
Answer.
Definition of RDBMS: An RDBMS (Relational Database Management System) is a database management software based on the relational model of data. It stores information in tables (relations) of rows and columns, enforces data integrity using keys and constraints, and provides a structured declarative query language (SQL) for retrieval and manipulation.
(i) Number of accidents involving cars owned by "John Smith":
SELECT COUNT(DISTINCT p.report_no) AS accident_count
FROM Participated p
JOIN Owner o ON p.car = o.license
JOIN Person per ON o.driver_id = per.driver_id
WHERE per.name = 'John Smith';
(ii) Add a new accident with sample values:
INSERT INTO Accident (report_no, date, location)
VALUES ('AR-2024-01', '2024-10-15', 'Dhaka-Rajshahi Highway');
(iii) Update the car "Mazda" belonging to "John":
Assumption: The query updates the manufacturing year of John's Mazda to 2022.
UPDATE Car c
JOIN Owner o ON c.license = o.license
JOIN Person p ON o.driver_id = p.driver_id
SET c.year = 2022
WHERE p.name = 'John'
AND c.model = 'Mazda';
(Alternative standard SQL subquery:
UPDATE Car
SET year = 2022
WHERE model = 'Mazda'
AND license IN (
SELECT o.license
FROM Owner o
JOIN Person p ON o.driver_id = p.driver_id
WHERE p.name = 'John'
);
)
(iv) Update damage amount to $3,000 for car "YJK-100" in accident "APR2197":
UPDATE Participated
SET damage_amount = 3000
WHERE car = 'YJK-100'
AND report_no = 'APR2197';
Variant for 2024 Q.5(b) (6 marks): The same RDBMS definition and four queries directly solve the question.
Topic: T05.6 · Subqueries theory ("two examples"): IN, SOME/ALL, EXISTS, scalar, correlated, WITH · Section B · 2
Question. Explain sub-queries with two suitable examples.
Answer.
Explanation: A subquery (or nested query) is a SELECT statement embedded inside another SQL statement (the outer query). It can appear in the WHERE clause to filter tuples, in the FROM clause as a temporary derived relation, or in the SELECT clause as a scalar expression. Subqueries allow multi-step data retrieval in a single query.
Example 1: Set Membership Subquery (IN)
Find all courses offered in Fall 2017 that were also offered in Spring 2018:
SELECT DISTINCT course_id
FROM section
WHERE semester = 'Fall' AND year = 2017
AND course_id IN (
SELECT course_id
FROM section
WHERE semester = 'Spring' AND year = 2018
);
The inner subquery generates the set of courses running in Spring 2018. The outer query checks whether Fall 2017 courses belong to that generated set.
Example 2: Scalar Comparison Subquery (AVG)
Find instructors whose salary is higher than the average salary of all instructors:
SELECT name, salary
FROM instructor
WHERE salary > (
SELECT AVG(salary)
FROM instructor
);
The inner query computes a single numeric value (the overall average salary). The outer query evaluates the > predicate against this scalar value for each instructor.
Variant for 2019 Q.8(b) (4 marks): Presenting the two SQL examples with their purpose answers the question.
Topic: T07.3 · Implement a trigger or stored procedure · Section B · 3
Question. An e-commerce system wants to automate actions when a new order is inserted such as updating stock and sending email. Implement a database trigger that handles this workflow.
Answer.
Assumption: The tables are orders(order_id, product_id, quantity, customer_email), products(product_id, stock), and email_queue(queue_id, recipient, subject, body, queued_at).
A trigger runs inside the database engine and cannot send external emails directly.
Instead, the trigger updates product stock and inserts a row into an email_queue table. An external mailer application reads this queue and sends the email.
DELIMITER //
CREATE TRIGGER trg_after_order_insert
AFTER INSERT ON orders
FOR EACH ROW
BEGIN
-- 1. Deduct ordered quantity from product stock
UPDATE products
SET stock = stock - NEW.quantity
WHERE product_id = NEW.product_id;
-- 2. Enqueue email notification for external mailer service
INSERT INTO email_queue (recipient, subject, body, queued_at)
VALUES (
NEW.customer_email,
'Order Confirmation',
CONCAT('Your order #', NEW.order_id, ' for product #', NEW.product_id, ' (Qty: ', NEW.quantity, ') has been placed successfully.'),
NOW()
);
END //
DELIMITER ;
Topic: T09.1 · ACID properties · Section B · 3 (Repeated question: Also asked in 2017 | Solved in T09)
Question. Briefly discuss the ACID properties of transaction.
Answer.
A transaction is a logical unit of program execution that accesses and updates data items. To preserve data integrity during crashes and concurrent access, the DBMS must ensure the four ACID properties:
Atomicity ("All-or-None"):
Consistency (Preservation of Invariants):
Isolation (Shielding Concurrent Access):
Durability (Persistence):
Short version for 2024 Q.6(c) (2 marks):
Topic: T05.4 · Aggregate functions (theory) · Section B · 1
Question.
Define aggregated functions.
EMPLOYEE (EID, Name, Department, Salary)
SALES (SID, EID, SaleAmount, SaleDate)
The management wants to reward the top-earing department. Write a SQL query to find the total salary paid per department.
(Note: "top-earing" printed verbatim in original paper; refers to top-earning)
Answer.
Definition: An aggregate function is a built-in SQL function that takes a collection of values across a column (or within subsets defined by GROUP BY) and returns a single summarizing scalar value. Standard SQL provides five primary aggregate functions: AVG, MIN, MAX, SUM, and COUNT.
Query:
SELECT Department,
SUM(Salary) AS Total_Salary
FROM EMPLOYEE
GROUP BY Department;
Topic: T05.8 · Short notes: ON DELETE CASCADE, GROUP BY, ORDER BY, AS · Section B · 1
Question.
Write short note on the following statements –
i) ON CASCADE DELETE
ii) Group By
iii) Order By
iv) As
Answer.
i) ON DELETE CASCADE (printed as "ON CASCADE DELETE"):
A foreign key referential integrity action. When a tuple in the parent table is deleted, the DBMS automatically deletes all corresponding referencing tuples in the child table. This maintains referential integrity and prevents orphaned records.
CREATE TABLE section (
course_id VARCHAR(8),
sec_id VARCHAR(8),
semester VARCHAR(6),
year NUMERIC(4, 0),
PRIMARY KEY (course_id, sec_id, semester, year),
FOREIGN KEY (course_id) REFERENCES course(course_id)
ON DELETE CASCADE
);
ii) GROUP BY:
An SQL clause used to partition table rows into distinct groups having identical values in specified columns. Aggregate functions (COUNT, SUM, AVG, MIN, MAX) then compute summary statistics for each individual group.
SELECT dept_name, AVG(salary) AS avg_sal
FROM instructor
GROUP BY dept_name;
iii) ORDER BY:
An SQL clause that sorts query result rows in ascending (ASC, default) or descending (DESC) order based on one or more attributes. Multiple sort keys break ties sequentially.
SELECT name, salary
FROM instructor
ORDER BY salary DESC, name ASC;
iv) AS:
An SQL keyword used to define an alias (an alternative temporary name). It can rename an attribute or computed expression in the SELECT clause for readability, or rename a table in the FROM clause to shorten table references and enable self-joins.
SELECT salary * 1.15 AS revised_salary
FROM employee AS e;
Short version for 2019 Q.8(c) (4 marks): Provide parts (i) and (ii).
Short version for 2023 Q.6(c) (2 marks): Provide part (i) with definition, syntax, and effect.
Topic: T12.4 · RAID levels, comparison, and recovery role · Section B · 3
Question. A multimedia archive contains very large image and video files. RAID is recommended for storage. Compare different RAID levels.
Answer.
Multimedia archives store multi-gigabyte image and video files. The workload consists of high-throughput sequential reads (streaming, downloading), rare updates (write-once, read-many), and very high total capacity demands.
| RAID Level | Striping Unit | Redundancy Mechanism | Fault Tolerance | Usable Storage Capacity | Read Speed (Large Files) | Write Speed |
|---|---|---|---|---|---|---|
| RAID 0 | Block | None | 0 disks | 100% | Very Fast | Very Fast |
| RAID 1 | Block / Drive | Mirroring (copy) | 1 disk per pair | 50% | Fast | Moderate |
| RAID 5 | Block | Distributed Parity | 1 disk | NN−1 (High) | Very Fast | Fast for sequential |
| RAID 6 | Block | Distributed P + Q | 2 disks | NN−2 (High) | Very Fast | Moderate |
| RAID 1+0 | Block | Mirroring + Striping | 1 disk per pair | 50% | Very Fast | Very Fast |
Topic: T09.5 · Concurrency problems · Section B · 3 (Repeated question: Also asked in 2018 | Solved in T09)
Question. If concurrency-control management is not implemented properly what problem may occur? Explain with example.
Answer.
If concurrency-control management is not implemented properly, uncoordinated interleaving violates transaction isolation. This causes five major anomalies:
Below are the full schedule tables for the two primary anomalies:
| Time | Transaction T1 | Transaction T2 | Database State / Note |
|---|---|---|---|
| t1 | read(A) | T1 reads A=500 | |
| t2 | A:=A−50 | T1 computes local A=450 | |
| t3 | write(A) | Database updated to A=450 | |
| t4 | write(A) | T2 performs blind write: A=25 | |
| t5 | commit | T1 commits | |
| t6 | commit | Final A=25 (update by T1 of −50 is lost!) |
| Time | Transaction T1 | Transaction T2 | Database State / Note |
|---|---|---|---|
| t1 | read(A) | T1 reads initial balance A=100 | |
| t2 | A:=A+100 | T1 computes local A=200 | |
| t3 | write(A) | Database A=200 (uncommitted) | |
| t4 | read(A) | T2 reads dirty value A=200 | |
| t5 | A:=A−50 | T2 computes local A=150 | |
| t6 | write(A) | Database updated to A=150 | |
| t7 | commit | T2 commits with invalid data | |
| t8 | abort (Rollback) | T1 fails and aborts; recovery restores A=100 |
T2 based its computation on a temporary value that never officially existed, leaving the database inconsistent.
Topic: T11.6 · Timestamp ordering: R-TS/W-TS rules, trace a schedule; rolled-back transaction gets a NEW timestamp · Section B · 3 (Repeated question: Also asked in 2018 | Solved in T11)
Question. When a transaction is rolled back under timestamp ordering and it is assigned a new timestamp? Why can it not simply keep its old timestamp?
Answer.
When a Transaction is Rolled Back Under Timestamp Ordering:
Under the Timestamp Ordering (TSO) protocol, a transaction Ti is rolled back whenever it attempts an operation that conflicts with a younger transaction:
Assigning a New Timestamp:
When Ti is rolled back, the system aborts it and restarts it. Upon restarting, the system assigns Ti a new, larger timestamp using the current system clock or logical counter.
Why It Cannot Keep Its Old Timestamp:
Short version for 2024 Q.8(b) (3 marks): Give the read and write rollback conditions concisely. Then explain in 2 points why the old timestamp causes repeated aborts and starvation.
Topic: T10.3 · Precedence-graph test → cycle → serial order(s) · Section B · 3
Question.
Consider the following schedule:
| T1 | T2 |
|---|---|
| read (A); A=A+10; | |
| read (A); A=A-100; write (A); read (B); | |
| write (A); read (B); B=B-10; write (B); | |
| B=B+100; write (B); |
Answer.
We extract the sequence of database read and write instructions:

The graph contains two opposite directed edges:
T1⟶T2andT2⟶T1This forms a directed cycle between T1 and T2.
Result: Because the precedence graph contains a cycle, the schedule is NOT conflict serializable.
← Prev: 2023 | Explanation Layer | Original Question Paper | Next: ClassTestQuestions →