71.3 KB · commit 40bb182
| document_type | Class Test Question Solutions |
|---|---|
| course_code | ECE 2215 |
| course_title | Database Systems |
| full_marks | 80 |
| total_tests | 4 |
| layer | explanation |
← Prev: 2024 | Exam-Style Layer | Original CT Questions | Directory Overview →
| Parameter | Details |
|---|---|
| Institution | Rajshahi University of Engineering & Technology (RUET) |
| Department | Electrical & Computer Engineering |
| Test Title | CT-01 |
| Marks | 20 |
| Time | 30 minutes |
| Curriculum Standard | With CO Mapping |
Topic: T01.4 · Data abstraction levels, schemas and instances · CT-01 · CO1
Question. Define data abstraction. Describe different types of data abstractions.
Answer.
What the examiner wants.
The definition and purpose of data abstraction (~1 mark), clear descriptions of all three abstraction levels (physical, logical, view) (~2 marks), and the architecture diagram (~1 mark).
Key idea.
Database systems use complex data structures to store information efficiently. Most users and application programmers do not understand storage pointers or disk block layouts. Data abstraction hides low-level complexity to provide a clean and intuitive interface.
Step-by-step solution.
Purpose of Data Abstraction:
A database contains complex data structures, storage blocks, and indexing schemes. Most end users and programmers are not trained in low-level storage details. Data abstraction hides this physical complexity. It simplifies user interactions, enforces security, and enables physical data independence.
Levels of Data Abstraction:
type instructor = record
ID : string;
name : string;
dept_name : string;
salary : integer;
end;
Figure: Three levels of data abstraction (Deck 01, Slide 14)
Variant for 2019 Q.2(a) (4 marks): Define data abstraction, describe the three levels, and include the diagram.
Variant for CT-01 Q.01 (5 marks): State the definition, explain the three levels, show the record example, and draw the diagram.
Check.
Quick level-matching test:
Exam tip.
Draw the three-tiered box diagram with multiple view boxes on top, the logical box in the middle, and the physical box at the bottom.
Sources.
Topic: T03.3 · Referential integrity & FK syntax (MySQL) · CT-01 · CO1
Question. Draw a schema diagram for ECE, including 5 tables (Students, Courses, Instructors, Classroom, Results).
Answer.
What the examiner wants.
A complete Silberschatz-style relational schema diagram containing the five designated ECE tables: Students, Courses, Instructors, Classroom, and Results. The examiner looks for:
Key idea.
A relational schema diagram provides a complete architectural map of a relational database. It displays tables as boxes, underlines primary keys, and uses arrows to indicate foreign key dependencies.
Step-by-step solution.
1. Relational Schemas and Keys:
2. Relational Schema Diagram:
In Silberschatz style, each table is shown as a box with its attributes. Primary keys are underlined. Directed arrows point from foreign key attributes to the referenced primary keys.
Figure: Relational schema diagram for ECE with 5 tables and foreign key references.
Check.
Schema design audit:
Students, Courses, Instructors, Classroom, Results.Courses.instructor_id → Instructors.instructor_idCourses.(building, room_number) → Classroom.(building, room_number)Results.student_id → Students.student_idResults.course_id → Courses.course_idExam tip.
Write out the relational schema text lines first (Students(…)) to organize the primary and foreign keys in your head. Then draw the table boxes and connect the arrows.
Sources.
Topic: T01.7 · Two-tier vs three-tier architecture · CT-01 · CO1
Question. Describe the structure of a database application.
Answer.
What the examiner wants.
A concise description of the functional structure of a database application, covering user interaction, application logic, and database access.
Key idea.
A database application acts as a mediator. It accepts user input through an interface, executes business rules using host programming languages, and interacts with the DBMS engine via queries.
Step-by-step solution.
A database application connects user interfaces to the database engine through three functional layers:
Check.
Role verification:
Exam tip.
List the three clear application tiers: Presentation Layer, Business Logic Layer, and Data Access Layer.
Sources.
Topic: T04.3 · Explain an RA expression in words · CT-01 · CO1
Question. Relations:
Write the relational algebra expressions for the following conditions using the relations above.
(Note: Sub-parts are numbered v, vi, vii, viii on the original question script).
Answer.
What the examiner wants.
Four distinct relational algebra queries worth 1 mark each. Evaluates the rename operator (ρ), multi-table selection and projection, union compatibility constraints, and aggregation with grouping (γ).
Key idea.
Part (v) uses the rename operator ρ. Part (vi) combines selection on department and marks before joining. Part (vii) requires union compatibility: STUDENT has 4 attributes while ALUMNI has 3. Both relations must be projected to the same two attributes before applying ∪. Part (viii) groups by department name.
Step-by-step solution.
(v) Rename relation STUDENT as S and display Student_ID and Name:
Student_ID and Name:(vi) Student_ID, Name, and Course_Name for CSE students with Marks ≥80:
Student_ID, then project the requested columns:(vii) Student_ID and Name of students in either STUDENT or ALUMNI:
STUDENT is (Student_ID, Name, Dept_Name, CGPA) (arity 4). The schema of ALUMNI is (Student_ID, Name, Dept_Name) (arity 3).(Student_ID, Name) first, then take the union:(viii) Number of students in each department:
Group the STUDENT relation by Dept_Name and count Student_ID:
Check.
STUDENT contains (101, "A", "CSE", 3.8) and ALUMNI contains (201, "B", "EEE"), direct union STUDENT∪ALUMNI fails because 4=3. Projecting first yields {(101, "A")} and {(201, "B")}. The union produces {(101, "A"), (201, "B")}, which is valid and correct.STUDENT tuples by Dept_Name produces a two-column relation (Dept_Name, count(Student_ID)).Exam tip.
Before applying ∪, ∩, or −, always check the column counts of both tables. If they differ, project the common target columns first.
Sources.
[Lecture Deck 02 · Slides 13–29](../LectureSlides/02_Relational_Model.md)
[Textbook Ch. 2 §2.6](../Textbook/Chapter_02_Relational_Model/Chapter%2002%20-%20Introduction%20to%20the%20Relational%20Model.md)
Topic: T04.4 · Extended RA: aggregation · CT-01 · CO1
Question. Describe the following relational algebra expression:
iii.
ΠName(σMarks<50(STUDENT⋈STUDENT.Student_ID=COURSE.Student_IDCOURSE))iv.
Πcourse_id(σsemester="Fall"∧year=2017(section))−Πcourse_id(σsemester="Spring"∧year=2018(section))(Note: Sub-parts are numbered iii, iv on the original question script).
Answer.
What the examiner wants.
Accurate descriptions of two complex relational algebra expressions (2 marks each). Evaluates theta joins with selection and projection, and set difference between projected query expressions.
Key idea.
Part (iii) performs a theta join on student identifiers, filters on an academic performance threshold (marks under 50), and projects the student names. Part (iv) is a classic set difference pattern identifying courses offered in a specific semester but not in another semester.
Step-by-step solution.
(iii) Expression: ΠName(σMarks<50(STUDENT⋈STUDENT.Student_ID=COURSE.Student_IDCOURSE))
STUDENT and COURSE where the student IDs match. This pairs student personal data with their course enrollment records and marks.Name attribute from the filtered records, eliminating any duplicate student names.(iv) Expression: Πcourse_id(σsemester="Fall"∧year=2017(section))−Πcourse_id(σsemester="Spring"∧year=2018(section))
section for courses offered in Fall 2017 and projects their unique course_id values:section for courses offered in Spring 2018 and projects their unique course_id values:Check.
Exam tip.
Part (iv) is taken verbatim from Slide 24 of Lecture Deck 02. Knowing slide examples verbatim ensures rapid, confident full marks in class tests.
Sources.
[Lecture Deck 02 · Slides 18–24](../LectureSlides/02_Relational_Model.md)
[Textbook Ch. 2 §2.6](../Textbook/Chapter_02_Relational_Model/Chapter%2002%20-%20Introduction%20to%20the%20Relational%20Model.md)
| Parameter | Details |
|---|---|
| Institution | Rajshahi University of Engineering & Technology (RUET) |
| Department | Electrical & Computer Engineering |
| Test Title | CT-02 |
| Marks | 20 |
| Time | 20 minutes |
| Curriculum Standard | With CO Mapping |
Topic: T05.2 · DDL + DML warm-up: CREATE, INSERT, ALTER ... ADD, UPDATE, DELETE, rename, filter · CT-02 · CO2
Question. Consider the table and write SQL queries for the following queries:
STUDENT(StudentID,Name,Department,Semester,CGPA)[Marks: 02 | CO: CO2][Marks: 02 | CO: CO2][Marks: 03 | CO: CO2][Marks: 03 | CO: CO2]Answer.
What the examiner wants.
Basic single-relation selection and projection in SQL. Full marks for correct SELECT * (or all attributes) and equality filter WHERE Department = 'ECE'.
Key idea.
The WHERE clause acts as the relational selection operator (σ), filtering table tuples according to the boolean expression.
Step-by-step solution.
SELECT *
FROM STUDENT
WHERE Department = 'ECE';
Check.
Execution: The DBMS scans STUDENT and checks each row's Department column against the string literal 'ECE'. Only matching tuples appear in the result table.
Exam tip.
For simple CT queries, write clean standard SQL without unnecessary clauses.
Sources.
Deck 03 · Slide 17, Textbook Ch. 3 §3.3.
What the examiner wants.
A multi-condition WHERE clause combining department match and numeric threshold using logical AND, followed by sorting using ORDER BY ... DESC.
Key idea.
SQL evaluates the WHERE filter first to select tuples belonging to ECE with CGPA > 3.50. It then processes the ORDER BY clause to arrange the surviving tuples from highest to lowest CGPA.
Step-by-step solution.
SELECT *
FROM STUDENT
WHERE Department = 'ECE' AND CGPA > 3.50
ORDER BY CGPA DESC;
Check.
Trace with candidate records:
WHERE, placed top in output.WHERE, placed second in output.Department = 'ECE'.CGPA > 3.50.Exam tip.
Remember the strict clause sequence: SELECT → FROM → WHERE → ORDER BY.
Sources.
Deck 03 · Slides 17, 24, Textbook Ch. 3 §3.3, §3.6.
What the examiner wants.
An uncorrelated scalar subquery using AVG(CGPA) in a WHERE comparison predicate.
Key idea.
In SQL, aggregate functions cannot be placed directly in a WHERE clause (e.g., WHERE CGPA > AVG(CGPA) is invalid syntax). The aggregate must be evaluated inside a nested subquery, which computes the table-wide average and supplies it as a scalar value to the outer query.
Step-by-step solution.
SELECT *
FROM STUDENT
WHERE CGPA > (
SELECT AVG(CGPA)
FROM STUDENT
);
Check.
Trace:
If student CGPA values are {3.2,3.5,3.8,3.9}, the subquery evaluates:
AVG(CGPA)=43.2+3.5+3.8+3.9=3.60.
The outer query evaluates CGPA > 3.60, returning the students with 3.8 and 3.9.
Exam tip.
Wrap the aggregate calculation in a (SELECT AVG(...) FROM ...) subquery whenever comparing an attribute to a dataset-wide summary.
Sources.
Deck 03 · Slides 30, 35, 52, Textbook Ch. 3 §3.7, §3.8.
What the examiner wants.
Querying the second-highest numeric value using subqueries without relying on vendor-specific pagination keywords (LIMIT or TOP).
Key idea.
The second-highest value in a set is the maximum value strictly less than the overall maximum value. Once that scalar value is determined by a nested subquery, the outer query retrieves all student records matching that CGPA.
Step-by-step solution.
SELECT *
FROM STUDENT
WHERE CGPA = (
SELECT MAX(CGPA)
FROM STUDENT
WHERE CGPA < (
SELECT MAX(CGPA)
FROM STUDENT
)
);
Note on ties: This query identifies the unique second-highest distinct CGPA value. If multiple students share this exact second-highest CGPA, all tied students are displayed in the result.
Check.
Trace with sample values:
Suppose CGPA values in STUDENT are: {4.00, 4.00, 3.85, 3.85, 3.70}.
SELECT MAX(CGPA) FROM STUDENT ⟹4.00.SELECT MAX(CGPA) FROM STUDENT WHERE CGPA < 4.00 ⟹3.85.SELECT * FROM STUDENT WHERE CGPA = 3.85.
Both students with CGPA 3.85 are returned. A naive ORDER BY ... LIMIT 1 OFFSET 1 would have returned the second student with 4.00, failing to locate the true second-highest grade.Exam tip.
Nested MAX subqueries are the universal, standard-compliant way to find n-th highest values without vendor-specific extensions.
Sources.
Deck 03 · Slides 35, 52, Textbook Ch. 3 §3.7, §3.8.
Topic: T02.5 · Design a full E-R diagram for a scenario · CT-02 · CO3
Question. A university maintains information about Students, Courses, and Teachers. A student can enroll in several courses and each course can have many students. Each course is taught by one teacher, though a teacher may teach several courses.
[Marks: 04 | CO: CO3][Marks: 06 | CO: CO3]Answer.
What the examiner wants.
Part (a): Explicit identification and listing of all database design elements: entity sets, attributes, primary keys, relationship sets, and mapping cardinalities (4 marks).
Part (b): A complete, well-proportioned Chen-notation E-R diagram reflecting all identified elements (6 marks).
Key idea.
Extract business rules directly from the problem description:
Enrolls, M:N).Teaches, 1:N from Teacher to Course).Step-by-step solution.
(a) Identification of Components:
| Component | Type | Details | Primary Key |
|---|---|---|---|
| STUDENT | Entity Set | Attributes: student_id, name, email, dept_name | student_id |
| COURSE | Entity Set | Attributes: course_id, title, credits | course_id |
| TEACHER | Entity Set | Attributes: teacher_id, name, dept_name, phone | teacher_id |
| Enrolls | Relationship Set | Connects STUDENT and COURSE | (student_id, course_id) |
| Teaches | Relationship Set | Connects TEACHER and COURSE | course_id |
Cardinalities:
Enrolls): Many-to-Many (M:N). A student enrolls in several courses; each course has many students.Teaches): One-to-Many (1:N). A teacher teaches several courses; each course is taught by exactly one teacher.(b) Complete E-R Diagram:
Figure: University Enterprise Complete E-R Diagram
Check.
Cardinality and rule verification:
Exam tip.
Fill out the structured table in Part (a) first. Then draw the diagram in Part (b). This shows the examiner that your diagram matches your formal analysis.
Sources.
| Parameter | Details |
|---|---|
| Institution | Rajshahi University of Engineering & Technology (RUET) |
| Department | Electrical & Computer Engineering |
| Test Title | CT-03 |
| Marks | 20 |
| Time | 25 minutes |
| Curriculum Standard | With CO Mapping |
Topic: T08.4 · Attribute closure X+, F+, finding candidate keys · CT-03 · CO3
Question. Consider the relation:
ENROLLMENT(StudentID,StudentName,CourseID,CourseName,InstructorID,InstructorName,Grade)Assume the following functional dependencies:
StudentIDCourseIDInstructorID(StudentID,CourseID)→StudentName→CourseName,InstructorID→InstructorName→Grade[Marks: 04][Marks: 02][Marks: 02][Marks: 02]Answer.
What the examiner wants.
Systematic derivation of candidate keys: identifying core non-RHS attributes (1.5 marks), showing the step-by-step expansion of the attribute closure (1.5 marks), and proving minimality (1 mark).
Key idea.
Look at which attributes never appear on the right side of any arrow. Those attributes can never be derived from anything else, so they must be part of every candidate key.
Step-by-step solution.
To find all candidate keys, we analyze the attributes that must appear in every key.
Attributes not on any RHS: Examining the right-hand sides of the given functional dependencies:
Compute the Attribute Closure of {StudentID,CourseID}:
Check for Minimality: We check proper subsets of {StudentID,CourseID}:
Neither proper subset determines all attributes. Therefore, {StudentID,CourseID} is minimal.
Candidate Key={StudentID,CourseID}This is the only candidate key for the relation.
Check.
Quick self-test:
InstructorID be added to form a candidate key?InstructorID produces a superkey, but not a candidate key, because it is not minimal.StudentID?StudentID on the right side. It cannot be derived.Exam tip.
Start your solution by listing attributes that never appear on the RHS. This proves to the examiner that no other combination of attributes can be a candidate key.
Sources.
What the examiner wants.
Accurate classification of attributes as prime or non-prime based on the candidate key (2 marks), and identification of all partial and transitive functional dependencies with explicit determinants and dependents (2 marks).
Key idea.
A prime attribute belongs to at least one candidate key. Any attribute not in a candidate key is non-prime. A partial dependency occurs when a non-prime attribute depends on only part of a composite key. A transitive dependency occurs when a non-prime attribute depends on another non-prime attribute.
Step-by-step solution.
First, we determine the Candidate Key.
Attributes StudentID and CourseID never appear on the right-hand side of any functional dependency. Therefore, every candidate key must contain both attributes.
Computing the closure:
{StudentID,CourseID}+={StudentID,CourseID,StudentName,CourseName,InstructorID,InstructorName,Grade}Because no proper subset is a superkey, the unique Candidate Key is:
Candidate Key={StudentID,CourseID}Partial Dependencies: Occur when a non-prime attribute depends on a proper subset of a composite candidate key:
Transitive Dependencies: Occur when a non-prime attribute depends on another non-prime attribute:
Here, InstructorID is a non-prime attribute that determines the non-prime attribute InstructorName. From the primary key, we have (StudentID,CourseID)→InstructorID→InstructorName.
Check.
Attribute partition check:
Exam tip.
Write down the candidate key before answering part (b). Even if part (a) is graded separately, stating the candidate key explicitly protects your marks.
Sources.
What the examiner wants.
Identifying the highest normal form satisfied (1NF, 1 mark) and giving a rigorous justification explaining why it satisfies 1NF but fails 2NF (1 mark).
Key idea.
All attribute values are atomic, so the relation is in 1NF. But the composite key is (StudentID, CourseID), and non-prime attributes like StudentName and CourseName depend on parts of that key. Since partial dependencies exist, it fails 2NF. The highest normal form reached is therefore 1NF.
Step-by-step solution.
First Normal Form (1NF) Check:
All attributes hold atomic, single values. Therefore, the relation satisfies 1NF.
Second Normal Form (2NF) Check:
The candidate key is composite: {StudentID,CourseID}.
Prime attributes: {StudentID,CourseID}.
Non-prime attributes: {StudentName,CourseName,InstructorID,InstructorName,Grade}.
Examining the functional dependencies:
Both dependencies are partial functional dependencies. Because non-prime attributes depend on proper subsets of the candidate key, the relation violates 2NF.
Check.
Quick self-test:
Grade was the only non-prime attribute?Grade were the only non-prime attribute, it would depend on the full composite key, so no partial dependencies would exist.Exam tip.
A 2-mark question requires only 3 to 4 sentences: confirm 1NF atomicity, point out one partial dependency, and conclude that the relation violates 2NF.
Sources.
Topic: T08.1 · Why normalize: redundancy and insert/update/delete anomalies · CT-03 · CO3
Question. Mention the problems caused by an unnormalized relation.
Answer.
What the examiner wants.
A structured answer listing data redundancy and the three classic modification anomalies (1.5 marks). Then, a concrete relational table example illustrating each problem clearly (2.5 marks).
Key idea.
When you lump multiple real-world entities into a single relation, you store the same fact repeatedly. This repetition wastes disk space. Worse, when you modify, insert, or delete data, the database either loses valid facts or ends up with conflicting values. Normalization fixes this by giving each independent entity its own table.
Step-by-step solution.
Using databases without normalization causes four major problems:
Consider an unnormalized table storing student enrollment and instructor data:
| Student_ID | Student_Name | Course | Instructor | Instructor_Phone |
|---|---|---|---|---|
| S01 | Riad | DBMS | Dr. Hasan | 01711... |
| S01 | Riad | AI | Dr. Abdullah | 01811... |
| S02 | Zoha | DBMS | Dr. Hasan | 01711... |
Student_ID is part of the primary key and cannot be NULL.Short version for CT-03 Q.02 (3 marks): State the four problems (data redundancy, update anomaly, insertion anomaly, deletion anomaly). Give a brief two-line explanation and one table row example showing an inconsistent update.
Check.
Quick self-test:
Student_ID is part of the primary key, and primary key attributes cannot be null.STUDENT, COURSE, and ENROLLMENT tables so course data exists independently of student enrollments.Exam tip.
Draw a simple 3-row table with 5 columns. Use it to demonstrate all three anomalies one by one. This takes less than two minutes and guarantees full marks.
Sources.
Topic: T08.6 · Define normalization (and its importance) & 1NF / 2NF / 3NF · CT-03 · CO3
Question. Define normalization and state its main objective.
Answer.
What the examiner wants.
A concise definition of normalization (1.5 marks) and four clear points on why it is important for relational database design (1.5 marks).
Key idea.
Normalization is systematic database cleanup. It takes messy, bloated tables and divides them into well-behaved tables where every non-key column depends strictly on the primary key.
Step-by-step solution.
Normalization is a formal, systematic technique for designing relational database schemas. It decomposes relations with anomalies into smaller, well-structured relations to reduce data redundancy and ensure data integrity.
Normalization is essential for relational databases because it:
Short version for CT-03 Q.03 (3 marks): Define normalization as the systematic decomposition of relations to minimize redundancy and eliminate anomalies. State the main objective: to produce well-structured tables free of insertion, update, and deletion anomalies while maintaining data consistency.
Check.
Quick self-test:
Exam tip.
Provide the formal definition in 2 to 3 lines, followed by a numbered list of four distinct benefits.
Sources.
Topic: T08.9 · BCNF; 3NF vs BCNF; highest normal form · CT-03 · CO3
Question. Justify the statement: "Every BCNF relation is in 3NF, but every 3NF relation is not necessarily in BCNF."
Answer.
What the examiner wants.
Formal definitions of 3NF and BCNF showing why BCNF condition is a strict subset of 3NF conditions (2 marks), followed by a concrete counterexample relation that satisfies 3NF but violates BCNF (2 marks).
Key idea.
BCNF requires every determinant to be a superkey. 3NF allows an escape clause: if the determinant is not a superkey, the dependency is still valid as long as the right-hand side consists of prime attributes. Therefore, BCNF is strictly stronger than 3NF.
Step-by-step solution.
If a relation is in BCNF, every non-trivial FD α→β satisfies condition 1 (α is a superkey). Since condition 1 of 3NF is identical to the only condition of BCNF, every dependency that satisfies BCNF automatically satisfies 3NF. Thus, BCNF is a stricter subset of 3NF:
BCNF⊂3NFConsider relation R(A,B,C,D) with functional dependencies:
F={AB→CD,D→A}Find Candidate Keys:
Check 3NF:
Check BCNF:
Because relation R is in 3NF but not in BCNF, the statement is justified.
Check.
Quick self-test:
Exam tip.
Use the exact counterexample from Slide 40 and Slide 43 of Deck 06 (R(A,B,C,D) with AB→CD,D→A). Examiners at RUET recognize it immediately.
Sources.
| Parameter | Details |
|---|---|
| Institution | Rajshahi University of Engineering & Technology (RUET) |
| Department | Electrical & Computer Engineering |
| Test Title | CT-04 |
| Marks | 20 |
| Time | 25 minutes |
| Curriculum Standard | With CO Mapping |
Topic: T09.1 · ACID properties · CT-04 · CO3
Question. Define a transaction? Explain the four ACID properties of a transaction with suitable examples.
Answer.
What the examiner wants.
A formal definition of a transaction (1.5 marks) and a comprehensive explanation of all four ACID properties with concrete examples and enforcing mechanisms (4.5 marks).
Key idea.
Give the precise textbook definition of a transaction as an execution unit delimited by begin and end. Then step through the $50 transfer to provide concrete numerical examples for each property.
Step-by-step solution.
Definition:
A transaction is a logical unit of program execution that accesses and possibly updates various data items in a database. It consists of all operations executed between a begin transaction and an end transaction (commit or abort).
The Four ACID Properties with Examples:
Consider transaction T1 transferring $50 from account A (initially $1000) to account B (initially $2000):
Atomicity ("All-or-None"):
Consistency (Invariant Preservation):
Isolation (Shielding Concurrent Execution):
Durability (Permanence across Failures):
commit, updates A=950 and B=2050 are recorded to stable storage. If power fails a second later, the values remain intact upon reboot.Check.
Quick self-test:
commit (success) and abort (rollback).Exam tip.
Write out the seven steps of T1 clearly at the top. Then refer to specific step numbers under each of the four properties.
Sources.
Topic: T09.3 · Transaction states / life-cycle diagram · CT-04 · CO3
Question. Differentiate between a serial schedule and a concurrent schedule. Mention two advantages of concurrent execution of transactions.
Answer.
What the examiner wants.
A comparison between a serial schedule and a concurrent schedule (2 marks), and two distinct, well-explained advantages of concurrent execution (2 marks).
Key idea.
Serial schedules run one transaction at a time. Concurrent schedules interleave operations. Concurrency is essential in modern databases because it maximizes hardware use (CPU and disk in parallel) and prevents short queries from waiting behind long batch jobs.
Step-by-step solution.
Difference Between Serial Schedule and Concurrent Schedule:
| Feature | Serial Schedule | Concurrent Schedule |
|---|---|---|
| Execution Pattern | Non-interleaved. One transaction runs to completion before another begins. | Interleaved. Operations from different transactions overlap in time. |
| Resource Use | Low. CPU remains idle while a transaction waits for disk I/O. | High. CPU processes one transaction while disk serves another. |
| Response Time | High average response time; short transactions wait behind long ones. | Low average response time; short transactions finish quickly. |
| Need for Concurrency Control | None. Execution is safe without concurrency control protocols. | Essential. Needs protocols (locks/timestamps) to avoid anomalies. |
Two Advantages of Concurrent Execution of Transactions:
Check.
Quick self-test:
Exam tip.
Under the advantages section, name the two textbook points explicitly: (1) Throughput and resource use, and (2) Average response time / waiting time.
Sources.
Topic: T09.4 · Concurrent execution advantages and schedules · CT-04 · CO3
Question. Explains any two problems caused by concurrent execution.
(Note: Printed as "Explains any two problems caused by concurrent execution." in the original question script).
Answer.
What the examiner wants.
Identification and explanation of the data corruption anomalies that occur when concurrent transactions run without proper concurrency control. The examiner expects two-column chronological schedules showing exactly how values get corrupted. Mark split: 2 marks per problem explained with schedule.
Key idea.
When concurrent operations interleave without control, they violate isolation. The five classic concurrency anomalies are: Lost Update, Dirty Read (temporary update), Unrepeatable Read, Phantom Read, and Incorrect Summary.
Step-by-step solution.
If concurrency-control management is not implemented properly, uncoordinated interleaving violates transaction isolation. This causes five major 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 (T1's −50 update is lost!) |
| Time | Transaction T1 | Transaction T2 | Database State / Note |
|---|---|---|---|
| t1 | read(A) | T1 reads 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 A=150 | |
| t6 | write(A) | Database A=150 | |
| t7 | commit | T2 commits with invalid data | |
| t8 | abort (Rollback) | T1 fails; log restores A=100 |
T2 based its computation on a temporary value that never officially existed, leaving the database inconsistent.
| Time | Transaction T1 | Transaction T2 | Database State / Note |
|---|---|---|---|
| t1 | read(A) | T1 reads A=500 | |
| t2 | read(A) | T2 reads A=500 | |
| t3 | A:=A+100 | T2 computes local A=600 | |
| t4 | write(A) | Database A=600 | |
| t5 | commit | T2 commits | |
| t6 | read(A) | T1 reads A=600 (reads different value!) |
| Time | Transaction T1 | Transaction T2 | Note |
|---|---|---|---|
| t1 | read(A) | read(A) | Both transactions read data item A |
| t2 | delete(A) | T1 deletes data item A and commits | |
| t3 | read(A) | T2 attempts to read A again, but item does not exist |
| Time | Transaction T1 | Transaction T2 | Database / Summary State |
|---|---|---|---|
| t1 | read(A) A:=A−50 write(A) | T1 updates A to 950 on disk | |
| t2 | sum:=0 read(C) sum:=sum+C | T2 reads C=1000⟹sum=1000 | |
| t3 | read(A) sum:=sum+A | T2 reads updated A=950⟹sum=1950 | |
| t4 | read(B) sum:=sum+B | T2 reads old B=1000⟹sum=2950 | |
| t5 | avg:=sum/3 commit | T2 reports avg=2950/3≈983.33 | |
| t6 | read(B) B:=B+50 write(B) commit | T1 adds 50 to B (B=1050 on disk) |
Variant for 2024 Q.8(a) (3 marks):
List the five anomalies, then provide the full schedule tables for Lost Update and Dirty Read.
Short version for CT-04 Q.03 (4 marks):
Select Lost Update and Dirty Read with their definitions and schedule tables above.
Check.
Quick self-test:
Exam tip.
For 4-mark questions, pick Lost Update and Dirty Read as your primary two examples. They are the easiest to draw and the most convincing to examiners.
Sources.
Topic: T10.2 · Conflict equivalence by swapping (proof) · CT-04 · CO3
Question. Determine whether the schedule is conflict serializable or not. If it is serializable, give the equivalent serial order.
| T1 | T2 | T3 |
|---|---|---|
| Write(A) | ||
| Read(A) | ||
| Write(B) | ||
| Write(B) | ||
| Write(B) | ||
| Write(A) | ||
| Read(B) | ||
| Read(B) |
Answer.
What the examiner wants. Chronological indexing of the 8 steps (1 mark), identification of conflicting pairs for items A and B (2 marks), precedence graph construction (1.5 marks), cycle detection and verdict (1.5 marks).
Key idea. With multiple writes on item B interleaving across T1 and T3, we must trace the operations step by step. If T3 writes B before T1 writes B, we get T3→T1. If T1 writes B before T3 writes or reads B again, we get T1→T3. That produces a cycle.
Step-by-step solution.
Conflicts on data item A:
Conflicts on data item B:

The graph contains:
Between T1 and T3, there is a direct cycle:
T1⟷T3Result: The precedence graph contains a cycle. The schedule is NOT conflict serializable. Because it is non-serializable, no equivalent serial order exists.
Check.
Exam tip. In class tests, showing the step numbers for conflicting instructions proves you did not guess the cycle.
Sources.
← Prev: 2024 | Exam-Style Layer | Original CT Questions | Directory Overview →