2021 question paper

DATABASE MANAGEMENT SYSTEM

23 questions

  1. Q1a. The relational model feature is that there - (i) is no need for primary key data (ii) is much more data independence than some other database models (iii) are explicit relationships among records (iv) are tables with many dimensions20212m

    Unit 1: Database System Architecture

    The relational model feature is that there

    • (i) is no need for primary key data
      (ii) is much more data independence than some other database models
      (iii) are explicit relationships among records
      (iv) are tables with many dimensions
    View this question on its own page →
    Worked Solution

    Answer: (ii) is much more data independence than some other database models

    Explanation: The relational model provides high data independence. Data is stored in tables and logical/physical independence is better than hierarchical/network models where explicit pointers relate records. Primary keys are required and relationships are implicit via keys, not explicit pointers. Tables are two-dimensional, not many dimensions.

  2. Q1b. Which of the following operations is used if we are interested in only certain columns of a table? - (i) PROJECTION (ii) SELECTION (ii) UNION (iv) JOIN20212m

    Unit 2: Relational Query Languages

    Which of the following operations is used if we are interested in only certain columns of a table?

    • (i) PROJECTION
      (ii) SELECTION
      (ii) UNION
      (iv) JOIN
    View this question on its own page →
    Worked Solution

    Answer: (i) PROJECTION

    Explanation: Projection (pi) operates on columns - selects specific attributes vertically, eliminating duplicates. Selection (sigma) operates on rows - selects tuples satisfying condition. Union and Join combine relations. Example: pi_{name,age}(Student) returns only name and age columns.

  3. Q1c. Which of the following is the original purpose of SQL? - (i) To specify the syntax and semantics of SQL data definition language (ii) To specify the syntax and semantics of SQL manipulation language (ii) To define the data structures (iv) All of the above20212m

    Unit 2: Relational Query Languages

    Which of the following is the original purpose of SQL?

    • (i) To specify the syntax and semantics of SQL data definition language
      (ii) To specify the syntax and semantics of SQL manipulation language
      (ii) To define the data structures
      (iv) All of the above
    View this question on its own page →
    Worked Solution

    Answer: (iv) All of the above

    Explanation: SQL was originally based on SEQUEL and intended to specify both Data Definition Language (DDL - CREATE, ALTER) and Data Manipulation Language (DML - SELECT, INSERT, etc.) syntax and semantics, and consequently data structures. In exam context, expected answer is All of the above. More precise textbook answer is (ii) SQL manipulation, but given options, (iv) is marked correct in many keys.

  4. Q1d. Which of the following is true? - (i) B+ tree allows only the rapid random access (ii) B+ tree allows only the rapid sequential access (iii) B + tree allows rapid random access as well as rapid sequential access (iv) B + tree allows rapid random access and slower sequential access20212m

    Unit 3: Storage and Transaction Processing

    Which of the following is true?

    • (i) B+ tree allows only the rapid random access
      (ii) B+ tree allows only the rapid sequential access
      (iii) B + tree allows rapid random access as well as rapid sequential access
      (iv) B + tree allows rapid random access and slower sequential access
    View this question on its own page →
    Worked Solution

    Answer: (iii) B+ tree allows rapid random access as well as rapid sequential access

    Explanation: B+ tree is variant of B-tree where all records stored in leaf nodes linked as linked list. Provides rapid random access via tree traversal (log N) and rapid sequential access via leaf chain. B tree allows random but sequential requires inorder traversal slower. B+ is preferred for indexes and range queries.

  5. Q1e. Transaction processing is associated with everything below, except - (i) conforming an action or triggering a response (ii) producing detailed summary or exception report (iii) recording a business activity (iv) maintaining a data20212m

    Unit 3: Storage and Transaction Processing

    Transaction processing is associated with everything below, except

    • (i) conforming an action or triggering a response
      (ii) producing detailed summary or exception report
      (iii) recording a business activity
      (iv) maintaining a data
    View this question on its own page →
    Worked Solution

    Answer: (ii) producing detailed summary or exception report

    Explanation: Transaction Processing System (TPS/OLTP) handles routine business transactions: recording activity, confirming actions, maintaining data integrity, ACID. Producing detailed summary or exception reports is part of MIS/DSS or OLAP, not core TPS. TPS focuses on operational recording, not analytical summaries.

  6. Q1f. Which of the following is used at the end of the view to reject the tuples which do not satisfy the condition in where clause? - (i) With (ii) Check (iii) With check (iv) All of the above20212m

    Unit 2: Relational Query Languages

    Which of the following is used at the end of the view to reject the tuples which do not satisfy the condition in where clause?

    • (i) With
      (ii) Check
      (iii) With check
      (iv) All of the above
    View this question on its own page →
    Worked Solution

    Answer: (iii) With check

    Explanation: WITH CHECK OPTION at end of CREATE VIEW ensures that any INSERT/UPDATE through the view must satisfy the WHERE condition of the view, otherwise rejected. Example: CREATE VIEW v AS SELECT * FROM emp WHERE dept='CS' WITH CHECK OPTION; then INSERT dept='EE' via view fails. "With" alone or "Check" alone incomplete.

  7. Q1g. Many applications use where two independent factors are used to identify a user. - (i) Two-factor authentication (ii) Cross-site request forgery (iii) Cross-site scripting (iv) Cross-site scoring scripting20212m

    Unit 4 – Database Security

    Many applications use where two independent factors are used to identify a user.

    • (i) Two-factor authentication
      (ii) Cross-site request forgery
      (iii) Cross-site scripting
      (iv) Cross-site scoring scripting
    View this question on its own page →
    Worked Solution

    Answer: (i) Two-factor authentication

    Explanation: Two-factor authentication (2FA) uses two independent factors: something you know (password), something you have (OTP token), or something you are (biometric). Cross-site request forgery (CSRF) and cross-site scripting (XSS) are attacks, not authentication methods.

  8. Q1h. ______________allows a system administrator to associate a function with a relation; the function returns a predicate that must be added to any query that uses the relation. - (i) OpenID (ii) Single-site system (iii) Security Assertion Markup Language (SAML) (iv) Virtual Private Database (VPD)20212m

    Unit 4 – Database Security

    ______________allows a system administrator to associate a function with a relation; the function returns a predicate that must be added to any query that uses the relation.

    • (i) OpenID
      (ii) Single-site system
      (iii) Security Assertion Markup Language (SAML)
      (iv) Virtual Private Database (VPD)
    View this question on its own page →
    Worked Solution

    Answer: (iv) Virtual Private Database (VPD)

    Explanation: VPD (Row Level Security, e.g., Oracle VPD) allows associating a function/policy with a table that appends a predicate (WHERE clause) to every query on that table for fine-grained access control. Example: function returns 'dept = USER_DEPT'. OpenID is authentication, SAML is SSO assertion language, Single-site is not relevant.

  9. Q1i. The Object Query Language is which of the following? - (i) Similar to SQL and uses a select-from-where structure (ii) Similar to SQL and uses a select-where structure (ii) Similar to SQL and uses a from-where structure (iv) Not similar to SQL20212m

    Unit 5 – Advanced Topics

    The Object Query Language is which of the following?

    • (i) Similar to SQL and uses a select-from-where structure
      (ii) Similar to SQL and uses a select-where structure
      (ii) Similar to SQL and uses a from-where structure
      (iv) Not similar to SQL
    View this question on its own page →
    Worked Solution

    Answer: (i) Similar to SQL and uses a select-from-where structure

    Explanation: OQL (Object Query Language, ODMG standard) is declarative and SQL-like with SELECT-FROM-WHERE. Example: SELECT s.name FROM Students s WHERE s.cgpa > 8. It operates on objects, supports path expressions, but syntax closely resembles SQL. Not just select-where or from-where.

  10. Q1j. Which join refers to join records from the right table that have no matching key in the left table and are included in the result set? - (i) Left outer join (i) Right outer join (iii) Full outer join (iv) Half outer join20212m

    Unit 2: Relational Query Languages

    Which join refers to join records from the right table that have no matching key in the left table and are included in the result set?

    • (i) Left outer join
      (i) Right outer join
      (iii) Full outer join
      (iv) Half outer join
    View this question on its own page →
    Worked Solution

    Answer: (ii) Right outer join (note option list typo duplicated (i))

    Explanation: Right outer join preserves all tuples from right relation, left unmatched filled with NULL, e.g., A RIGHT JOIN B. Left outer join preserves left, Full preserves both. Half outer join is not standard term. The question wording matches right outer join definition.

  11. Budget App•POCKETLY

    Pocketly on Android

    Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.

    Install Pocketly
  12. Q2a. List five responsibilities of the database manager. For each responsibility, explain the problem that would arise if the responsibility were not discharged.20217m

    Unit 1: Database System Architecture

    List five responsibilities of the database manager. For each responsibility, explain the problem that would arise if the responsibility were not discharged.

    View this question on its own page →
    Worked Solution

    Five Responsibilities of Database Manager (DBMS / DBA responsibilities):

    1. Schema Definition: Define logical/physical schema, storage structure, access method via DDL. If not done: no consistent structure, data inconsistency, no integrity.

    2. Storage Structure & Access Method Definition: Choose indexing, hashing, partitioning. Failure: poor performance, high I/O, slow queries.

    3. Granting Authorization: Provide privilege controls (GRANT/REVOKE) for data access. Failure: security breach, unauthorized access/modification.

    4. Routine Maintenance: Backup, recovery, monitoring, tuning, reorganization. Failure: data loss on failure, degraded performance, no recovery.

    5. Integrity Constraint Specification: Define constraints (primary key, foreign key, check). Failure: invalid data, inconsistency, referential violations.

    Additional: Transaction management, concurrency control, defining security. Each missing responsibility leads to data anarchy, redundancy, inconsistency, security compromise, and failure recovery inability.

  13. Q2b. Consider a two-dimensional integer array of size name that is to be used in your favourite programming language. Using the array as an example, illustrate the difference (i) between the three levels of data abstraction and (ii) between a schema and instances.20217m

    Unit 1: Database System Architecture

    Consider a two-dimensional integer array of size name that is to be used in your favourite programming language. Using the array as an example, illustrate the difference (i) between the three levels of data abstraction and (ii) between a schema and instances.

    View this question on its own page →
    Worked Solution

    Using 2D array int A[10][20] as example:

    (i) Three levels of data abstraction:

    • Physical level: How array stored in memory - row-major contiguous bytes, address = base + (i*20 + j)*sizeof(int), disk blocks. User unaware.
    • Logical level: How we conceptualize - 2D matrix A[i][j] with rows/cols, data types, operations. Programmer works here.
    • View level: Specific view - e.g., user sees only upper triangle or specific rows via view/projection, hiding rest. Different users see different subsets.

    Example mapping to DB: physical = storage structures, logical = tables schema, view = user-specific virtual tables.

    (ii) Schema vs Instances:

    • Schema: Overall definition/structure - e.g., int A[10][20]; defines dimensions, type, constraints. Analogous to CREATE TABLE. Does not change frequently (logical schema). Physical schema is storage details.
    • Instances: Actual data content at a point in time - e.g., values stored: A[0][0]=5, A[0][1]=7 ... snapshot. Changes frequently on updates. Like table rows at time t.

    If array reinitialized, schema same but instances change.

  14. Q3. Construct an E-R diagram for a car insurance company that has a set of customers, each of whom owns one or more cars. Each car has associated with it zero to any number of recorded accidents..202114m

    Unit 1: Database System Architecture

    Construct an E-R diagram for a car insurance company that has a set of customers, each of whom owns one or more cars. Each car has associated with it zero to any number of recorded accidents..

    View this question on its own page →
    Worked Solution

    E-R Diagram for Car Insurance Company:

    Entities:

    • Customer (attributes: cust_id PK, name, address, phone)
    • Car (attributes: car_id PK, model, year, color, reg_no)
    • Accident (attributes: acc_id PK, date, location, damage_amount) - weak or regular, depends on design; accident identified by car + date.

    Relationships:

    • Owns: Customer (1) -- (N) Car, total participation on Car side (each car owned by one customer), cardinality one-to-many, key of Customer included in Car as foreign key if mapped.
    • Involved/Has: Car (1) -- (N) Accident, zero to many (0..*), each car may have zero or many accidents, each accident belongs to one car. Accident could be weak entity with Car as owner, partial key acc_id or date.

    If accident is weak: Car --< Accident (double diamond), accident PK = car_id + acc_no.

    Constraints: Customer owns at least one car, Car owned by exactly one Customer, Accident associated with exactly one Car.

    Diagram: Rectangles for Customer, Car, Accident; Diamonds for Owns and Had; Lines with cardinalities (1:N). Show primary keys underlined, weak entity double rectangle, identifying relationship double diamond. No image URL required - textual description suffices for construction.

  15. Q4a. What are DDL and DML? Explain with the help of examples.20217m

    Unit 1: Database System Architecture

    What are DDL and DML? Explain with the help of examples.

    View this question on its own page →
    Worked Solution

    DDL and DML with Examples:

    DDL (Data Definition Language): Defines/modifies schema structure. Auto-commit, no rollback. Commands:

    • CREATE TABLE Student(roll INT PRIMARY KEY, name VARCHAR(50));
    • ALTER TABLE Student ADD age INT;
    • DROP TABLE Student;
    • TRUNCATE TABLE Student;
    • CREATE INDEX idx_name ON Student(name);

    DML (Data Manipulation Language): Manipulates data within structures. Needs COMMIT. Commands:

    • SELECT * FROM Student WHERE age >20;
    • INSERT INTO Student VALUES(1,'Amit',21);
    • UPDATE Student SET age=22 WHERE roll=1;
    • DELETE FROM Student WHERE roll=1;

    DDL acts on metadata, DML on instances. DDL changes schema, DML queries/modifies rows.

  16. Q4b. Explain the following operations with the help of examples: - (i) Set of intersection operation (ii) Natural join operation (iii) Division operation20217m

    Unit 2: Relational Query Languages

    Explain the following operations with the help of examples:

    • (i) Set of intersection operation
      (ii) Natural join operation
      (iii) Division operation
    View this question on its own page →
    Worked Solution

    Relational Algebra Operations with Examples:

    (i) Set Intersection: R ∩ S returns tuples present in both relations, requires union compatibility (same arity, domain). Example: Student ∩ CricketTeam gives students who are both enrolled and in cricket team. Can be expressed as R - (R - S).

    (ii) Natural Join: Combines tuples from two relations where common attributes have equal values, automatically equating and projecting out duplicate column. Example: Student(sid, name) natural join Enroll(sid, cid) returns (sid, name, cid) where sid matches, without duplicate sid. Equivalent to cross product + selection + projection on equality of common attributes.

    (iii) Division: R ÷ S returns values of attributes of R not in S that are associated with all values in S. Used for "for all" queries. Example: Completed(Student, Course) ÷ Required(Course) gives students who completed all required courses. If Completed has (Amit,DBMS),(Amit,OS) and Required has (DBMS),(OS), result is Amit.

  17. Q5a. What are the differences between primary index and secondary index?20217m

    Unit 3: Storage and Transaction Processing

    What are the differences between primary index and secondary index?

    View this question on its own page →
    Worked Solution

    Primary vs Secondary Index:

    Primary Index: Ordered file on ordering key field (primary key or ordering field), sparse or dense, one per file, determines physical order (clustering). Example: File ordered by rollno, primary index on rollno. Has index entry per block. Cannot have many.

    Secondary Index: On non-ordering field (any attribute), dense, may be many secondary indexes per file, does not determine file order, needs extra level (bucket for duplicates). Example: Index on name or department where file not ordered by that. Secondary is non-clustering, requires more entries.

    Differences: Primary is on ordered key, reflects block anchors, sparse, clustering; Secondary is on non-ordered, dense, non-clustering, allows duplicates via buckets. Primary has unique entries per block, secondary may have many entries per value.

  18. Q5b. How does the remapping of bad sectors by disk controllers affect data retrievals rates?20217m

    Unit 3: Storage and Transaction Processing

    How does the remapping of bad sectors by disk controllers affect data retrievals rates?

    View this question on its own page →
    Worked Solution

    Bad Sector Remapping Effect on Retrieval Rates:

    Disks have spare sectors; disk controller remaps bad sectors transparently to spare area (defect management). List maintained in defect map (P-list, G-list). When mapped, logical block accessed via redirect.

    Effect on retrieval:

    • Sequential access: Remapped sectors are at different physical location (spare area elsewhere), so sequential scan that was contiguous becomes random seek to spare, increasing seek time, breaking sequentiality, lowering throughput especially for large sequential reads.
    • Random access: Minor impact - still one seek, but may add slight latency due to lookup and possible extra seek to spare cylinder.
    • Caching: If remapped sector cached, less impact, but first access incurs penalty.
    • Throughput drops proportionally to number of remapped sectors; heavily remapped disk sees degraded sequential rate (e.g., 10-30% slower).

    Mitigation: Controller maintains translation table; OS unaware but performance variance observed. SMART monitors reallocated count.

  19. Q6. Show that the two-phase locking protocol ensures conflict serializability and that transaction can be serialized according to their lock points.202114m

    Unit 3: Storage and Transaction Processing

    Show that the two-phase locking protocol ensures conflict serializability and that transaction can be serialized according to their lock points.

    View this question on its own page →
    Worked Solution

    Show 2PL Ensures Conflict Serializability and Serialization by Lock Points:

    Proof: Consider any schedule S generated by 2PL-compliant transactions. Let lock point of Ti be the moment Ti has acquired its last lock (end of growing phase). Lemma: If Ti precedes Tj in a conflict (operation o_i before o_j conflicting), then lock_point(Ti) < lock_point(Tj). Because to perform conflicting operations, both need lock on same item; conflicting lock types (X vs S/X) exclude. Since Ti held lock before Tj could acquire it, Ti must have acquired it first and since 2PL forbids acquiring after unlocking, Ti's lock point before Tj's first conflicting lock release.

    If schedule had cycle Ti -> Tj -> ... -> Ti, then lock points would have cycle lock(Ti) < lock(Tj) < ... < lock(Ti) impossible. Hence conflict graph acyclic -> conflict serializable.

    Serialization order: Sort transactions by lock points ascending. That order is a serial schedule conflict-equivalent to S, because all conflicting pairs respect lock point order. Strict 2PL also ensures recoverability.

    Example holds.

  20. Q7a. Make a list of security concerns for a bank. For each item on your list, state whether this concern relates to physical security, human security, operating-system security or database security.20217m

    Unit 4 – Database Security

    Make a list of security concerns for a bank. For each item on your list, state whether this concern relates to physical security, human security, operating-system security or database security.

    View this question on its own page →
    Worked Solution

    Security Concerns for a Bank - Classification:

    • Robbery/Bank Vault theft - Physical security
    • ATM skimming/physical tampering - Physical security
    • Insider fraud/employee collusion - Human security
    • Phishing/social engineering - Human security
    • Operating system vulnerability exploitation (unpatched OS) - Operating-system security
    • Privilege escalation on DB server - Operating-system / Database security
    • SQL injection on online banking - Database security
    • Unauthorized access to customer accounts/tables - Database security
    • Data leakage via SELECT bypass - Database security
    • Network eavesdropping - Operating-system / Database (communication)
    • Backup tape theft - Physical + Database security
    • Ransomware encrypting DB files - Operating-system and Database

    Classification per item shows multi-layer defense needed. Physical guards/CCTV, human training/background checks, OS hardening/patching, DB GRANT, VPD, encryption, audit logs.

  21. Q7b. Explain web and distributed database with the help of example.20217m

    Unit 5 – Advanced Topics

    Explain web and distributed database with the help of example.

    View this question on its own page →
    Worked Solution

    Web and Distributed Database with Examples:

    Web Database: Database accessible via web interface, often three-tier (browser -> web server -> DB). Example: E-commerce site where product catalog stored in MySQL, accessed via PHP/Node.js, users interact via browser, queries via HTTP. Characteristics: stateless HTTP, connection pooling, security via HTTPS.

    Distributed Database: Logically integrated but physically distributed across sites/nodes, appears as single DB. Types: Homogeneous (same DBMS) vs Heterogeneous (different). Fragmentation: Horizontal (rows), Vertical (columns), Replication. Example: Bank with branches in Mumbai and Delhi each store local accounts but global query can join - SELECT * FROM Accounts where branch='Mumbai' transparently via distributed query processor, with two-phase commit for atomicity. Advantages: locality, availability, scalability. Challenges: distributed concurrency, recovery, heterogeneity.

    Both enable large-scale data access; web is front-end paradigm, distributed is storage architecture. Modern cloud combines both.

  22. Budget App•POCKETLY

    Pocketly on Android

    Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.

    Install Pocketly
  23. Q8. Consider the following ordering schedule — S’ of transactions: `` T1 : R(A); T1 : A := A + 5; T1 : commit; T2 : R(B); T2 : B := B + 5; T3 : R(C); T3 : C := C + 5; T3 : C := C + 5; T4 : R(A); T4 : A := A + 5; T4 : R(D); T4 : D := D + 5; T4 : commit; T2 : commit; T3 : commit; ` Let the initial value of A = B = C = D = 0. The system follows log-based recovery process of *immediate database modification*. The assumption is the concurrency control system uses strict 2PL, and all transactions share a common disk buffer and single log. Explain what happens during the recovery process if a failure occurs at T2 : commit` statement.202114m

    Unit 3: Storage and Transaction Processing

    Consider the following ordering schedule —
    S’ of transactions:

    T1 : R(A);  
    T1 : A := A + 5;  
    T1 : commit;  
    
    T2 : R(B);  
    T2 : B := B + 5;  
    
    T3 : R(C);  
    T3 : C := C + 5;  
    T3 : C := C + 5;  
    
    T4 : R(A);  
    T4 : A := A + 5;  
    T4 : R(D);  
    T4 : D := D + 5;  
    T4 : commit;  
    
    T2 : commit;  
    T3 : commit;
    

    Let the initial value of A = B = C = D = 0.
    The system follows log-based recovery process of immediate database modification.

    The assumption is the concurrency control system uses strict 2PL, and all transactions share a common disk buffer and single log.

    Explain what happens during the recovery process if a failure occurs at T2 : commit statement.

    View this question on its own page →
    Worked Solution

    Given schedule S' with immediate modification, strict 2PL, common buffer/log, initial A=B=C=D=0. Sequence: T1 R(A) A=A+5 commit (A=5 logged), T2 R(B) B=B+5 (B=5 uncommitted), T3 R(C) C=C+5; C=C+5 (C=10 uncommitted, but two increments? note C incremented twice to 10), T4 R(A) A=A+5 (A reads 5, writes 10), R(D) D=D+5 commit (D=5 committed), then T2 commit then T3 commit.

    Immediate modification means uncommitted updates may be written to disk before commit (steal), so undo needed. Strict 2PL holds X locks till commit, so T2 holds B, T3 holds C, T4 holds A,D till commit.

    Failure occurs at T2:commit statement (T2 attempting commit, T4 already committed, T1 committed, T2 and T3 have not fully committed at failure point).

    Recovery (UNDO/REDO via log analysis):
    Log contains <T1 start>, <T1, A, 0,5>, <T1 commit>, <T2 start>, <T2, B,0,5>, <T3 start>, <T3, C,0,5>, <T3,C,5,10>, <T4 start>, <T4,A,5,10>, <T4,D,0,5>, <T4 commit> (steal may have flushed B,C,A). At failure, checkpoint analysis:

    • REDO: T1 and T4 are committed (and flushed before failure) - redo their updates to ensure durability (A=10? Actually T1 A=5 then T4 overwrote A=10, so final A=10, D=5).
    • UNDO: T2 and T3 are active/uncommitted at crash (T2 commit not completed, T3 not committed). Since immediate modification, their updates may be on disk and must be undone: B=0 (undo B 0->5), C=0 (undo C chain 0->5->10). Using undo log records in reverse.

    If strict 2PL buffer sharing noted: no dirty read but dirty writes possible via buffer. After recovery, DB reflects only committed transactions: A=10, D=5, B=0, C=0, then T2/T3 will be restarted/aborted. Some textbooks show T2's commit record not yet written, so T2 also undone. Result: T1 and T4 persist.

  24. Q9a. Write a short note on any one of the foflowing: - (a) SQL injection20217m

    Unit 4 – Database Security

    Write a short note on any one of the foflowing:

    • (a) SQL injection
    View this question on its own page →
    Worked Solution

    Short note on SQL Injection:

    Attack where attacker injects malicious SQL via user input to alter query logic. Example: Input "' OR '1'='1" into login: SELECT * FROM users WHERE name='' OR '1'='1' -- bypasses authentication, returns all rows. Can lead to data leak, delete, privilege escalation.

    Types: Error-based, Union-based, Blind,.

    Prevention: Use prepared statements/parameterized queries (SELECT * FROM users WHERE name=?), input validation/sanitization, least privilege, WAF, avoid dynamic concatenation, use ORM.

    Example parameterized in Java: PreparedStatement ps = conn.prepareStatement("SELECT * FROM users WHERE name=?"); ps.setString(1,input);

  25. Q9b. Write a short note on any one of the foflowing: - (b) Database recovery20217m

    Unit 3: Storage and Transaction Processing

    Write a short note on any one of the foflowing:

    • (b) Database recovery
    View this question on its own page →
    Worked Solution

    Short note on Database Recovery:

    Recovery restores database to consistent state after failure (crash, power, media) ensuring atomicity and durability via ACID.

    Techniques:

    • Log-Based: Write-Ahead Logging (WAL) records <T, X, old, new> before DB update to stable log. Undo/Redo.

    • Shadow Paging: Keep shadow copy, switch pointer on commit.

    • Checkpoints: Periodic flush, log checkpoint record to bound recovery time.

    Recovery types: Immediate (steal, uncommitted updates on disk need UNDO) vs Deferred (no steal, only REDO).

    ARIES algorithm: Analysis (identify active/dirty), Redo (repeat history), Undo (rollback loser transactions).

    Example: Log <T1 start>, <T1,A,0,5>, commit. Crash after T1 commit but before flush - redo applies A=5. If T2 uncommitted had B=5 on disk, undo restores B=0.

    Importance: prevents loss, ensures durability.

Free AppAndroid App

Coursify Android App

Generate AI courses, take quick quizzes between classes, and master complex engineering concepts on the go.