1Which of the following is used to execute a block of statements conditionally in a database programming language?
flow control statements
Easy
A.SELECT
B.IF...THEN
C.COMMIT
D.TRIGGER
Correct Answer: IF...THEN
Explanation:
The IF...THEN statement is a flow control statement used to execute code only when a specific condition is true.
Incorrect! Try again.
2In database programming, what is a primary characteristic of a function compared to a standard stored procedure?
functions
Easy
A.It cannot take any parameters
B.It is used exclusively for transaction management
C.It executes automatically on data modification
D.It must return a value
Correct Answer: It must return a value
Explanation:
A user-defined function in a database is designed to perform a specific calculation or task and must return a single value or a table.
Incorrect! Try again.
3What is a stored procedure in a Database Management System?
stored procedures
Easy
A.A temporary table created during execution
B.A hardware component for storing data
C.A graphical user interface for querying
D.A precompiled collection of SQL statements saved in the database
Correct Answer: A precompiled collection of SQL statements saved in the database
Explanation:
A stored procedure is a prepared block of SQL code that is saved in the database so it can be reused multiple times.
Incorrect! Try again.
4Which database object is used to retrieve, examine, and process data row by row from a result set?
cursors
Easy
A.View
B.Trigger
C.Index
D.Cursor
Correct Answer: Cursor
Explanation:
A cursor is a temporary work area created in system memory that allows database programmers to process individual rows returned by a query one at a time.
Incorrect! Try again.
5What is the correct logical sequence of operations when working with a cursor?
cursors
Easy
A.DECLARE, OPEN, FETCH, CLOSE
B.OPEN, FETCH, DECLARE, CLOSE
C.FETCH, OPEN, CLOSE, DECLARE
D.DECLARE, FETCH, OPEN, CLOSE
Correct Answer: DECLARE, OPEN, FETCH, CLOSE
Explanation:
The standard lifecycle of a cursor involves declaring it, opening it to execute the query, fetching rows one by one, and finally closing it to release resources.
Incorrect! Try again.
6Which database programming construct automatically executes in response to certain events on a particular table, such as INSERT, UPDATE, or DELETE?
triggers
Easy
A.Trigger
B.Sequence
C.Cursor
D.Index
Correct Answer: Trigger
Explanation:
A trigger is a special type of stored procedure that automatically runs (or "fires") when a specific data modification event occurs in the database.
Incorrect! Try again.
7Which of the following are valid timings for a trigger to execute relative to the triggering event?
triggers
Easy
A.TOP and BOTTOM
B.START and END
C.INSIDE and OUTSIDE
D.BEFORE and AFTER
Correct Answer: BEFORE and AFTER
Explanation:
Triggers are typically defined to run either BEFORE the data modification takes place or AFTER the modification has completed.
Incorrect! Try again.
8What is the primary purpose of exception handling in database programming?
exception handling
Easy
A.To manage and respond to runtime errors gracefully
B.To create backups of the database
C.To speed up the execution of SQL queries
D.To join multiple tables together
Correct Answer: To manage and respond to runtime errors gracefully
Explanation:
Exception handling allows a program to intercept and deal with errors or unusual conditions without abruptly terminating the entire process.
Incorrect! Try again.
9In a Database Management System, what is a transaction?
Database Transaction Processing
Easy
A.A logical unit of work that contains one or more SQL statements
B.A type of database user account
C.A single row in a database table
D.A graphical tool for designing tables
Correct Answer: A logical unit of work that contains one or more SQL statements
Explanation:
A transaction is a single, indivisible logical unit of work, which may consist of multiple read and write operations that must succeed or fail as a whole.
Incorrect! Try again.
10Which SQL command is used to permanently save the changes made during a transaction?
transaction system concepts
Easy
A.COMMIT
B.UPDATE
C.SAVEPOINT
D.ROLLBACK
Correct Answer: COMMIT
Explanation:
The COMMIT command is used to save all transaction changes permanently to the database, making them visible to other users.
Incorrect! Try again.
11Which SQL command is used to undo the changes made in the current transaction?
transaction system concepts
Easy
A.DROP
B.COMMIT
C.ROLLBACK
D.REVOKE
Correct Answer: ROLLBACK
Explanation:
The ROLLBACK command undoes any data changes made since the transaction began or since the last commit/savepoint.
Incorrect! Try again.
12The desirable properties of a database transaction are commonly referred to by which acronym?
desirable properties of transactions
Easy
A.CRUD
B.BASE
C.ACID
D.SOLID
Correct Answer: ACID
Explanation:
ACID stands for Atomicity, Consistency, Isolation, and Durability, which are the fundamental properties required for reliable transaction processing.
Incorrect! Try again.
13Which ACID property ensures that a transaction is treated as a single, indivisible unit (either all operations succeed or none do)?
desirable properties of transactions
Easy
A.Isolation
B.Atomicity
C.Durability
D.Consistency
Correct Answer: Atomicity
Explanation:
Atomicity ensures the "all or nothing" rule, meaning a transaction cannot be partially completed. If one part fails, the entire transaction fails.
Incorrect! Try again.
14Which ACID property guarantees that once a transaction has been committed, it will remain in the system even in the event of a system failure?
desirable properties of transactions
Easy
A.Durability
B.Consistency
C.Isolation
D.Atomicity
Correct Answer: Durability
Explanation:
Durability ensures that successfully committed transactions are permanently recorded in non-volatile memory and will survive power outages or system crashes.
Incorrect! Try again.
15In database transaction processing, what is a schedule?
schedules
Easy
A.A backup plan for database restoration
B.A list of database users logging in
C.A timetable for running automated reports
D.A chronological execution sequence of operations from multiple transactions
Correct Answer: A chronological execution sequence of operations from multiple transactions
Explanation:
A schedule is a list of the actions (like reads, writes, commits) of a set of transactions, ordered by the time they execute in the system.
Incorrect! Try again.
16What does it mean for a schedule to be "serializable"?
serializability of schedules
Easy
A.Its execution produces the same result as some strictly sequential execution of those transactions
B.It executes all transactions exactly at the same time
C.It only contains read operations
D.It cannot be rolled back under any circumstances
Correct Answer: Its execution produces the same result as some strictly sequential execution of those transactions
Explanation:
A serializable schedule allows operations to overlap for efficiency but guarantees that the final database state is identical to executing the transactions one after another.
Incorrect! Try again.
17What is the main objective of concurrency control in a Database Management System?
concurrency control
Easy
A.To prevent any multiple transactions from executing at the same time
B.To compress the database files to save disk space
C.To allow multiple transactions to execute simultaneously without interfering with each other
D.To automatically write SQL queries for the user
Correct Answer: To allow multiple transactions to execute simultaneously without interfering with each other
Explanation:
Concurrency control coordinates the simultaneous execution of transactions to ensure data integrity, isolation, and consistency.
Incorrect! Try again.
18Which mechanism is most commonly used to implement concurrency control and prevent conflicting transactions?
concurrency control
Easy
A.Locks
B.Triggers
C.Views
D.Cursors
Correct Answer: Locks
Explanation:
Locks are used to block access to a specific data item by other transactions while one transaction is currently reading or modifying it.
Incorrect! Try again.
19A situation where two or more transactions are waiting for each other to release locks, causing them all to be stuck indefinitely, is called:
concurrency control
Easy
A.Atomicity
B.Starvation
C.Serializability
D.Deadlock
Correct Answer: Deadlock
Explanation:
A deadlock occurs when two or more transactions form a circular dependency for locks, preventing any of them from ever making progress.
Incorrect! Try again.
20In the context of transaction schedules, a recoverable schedule ensures that:
recoverability
Easy
A.Every transaction executes one at a time
B.Deadlocks can never occur
C.No transaction ever needs to be rolled back
D.A transaction commits only after all transactions whose changes it read have committed
Correct Answer: A transaction commits only after all transactions whose changes it read have committed
Explanation:
Recoverability prevents scenarios where a committed transaction might have read invalid data from another transaction that eventually failed and rolled back.
Incorrect! Try again.
21Which flow control statement is best suited to repeatedly execute a block of SQL statements as long as a specified condition evaluates to TRUE, evaluating the condition before each iteration?
flow control statements
Medium
A.WHILE loop
B.REPEAT loop
C.LOOP statement with EXIT WHEN
D.FOR loop
Correct Answer: WHILE loop
Explanation:
A WHILE loop evaluates its condition before executing the loop body. If the condition is true, the loop executes; otherwise, it terminates. REPEAT loops typically evaluate the condition after execution, and FOR loops are used for a known number of iterations.
Incorrect! Try again.
22In standard SQL, a User-Defined Function (UDF) is being created to calculate total salary. Which of the following is a key restriction of standard SQL scalar functions compared to stored procedures?
functions
Medium
A.Functions cannot accept input parameters.
B.Functions cannot return values.
C.Functions cannot contain SELECT statements.
D.Functions cannot perform DML operations (INSERT/UPDATE/DELETE) that modify database state.
Standard SQL scalar functions must be deterministic and side-effect free, meaning they are restricted from executing Data Manipulation Language (DML) statements that change the state of the database.
Incorrect! Try again.
23Consider a stored procedure that processes user orders. How does passing a parameter as IN OUT differ from passing it as OUT in most database programming languages like PL/SQL?
stored procedures
Medium
A.IN OUT parameters are read-only, while OUT parameters are write-only.
B.IN OUT requires a default value, while OUT does not.
C.There is no difference; they are interchangeable.
D.IN OUT parameters pass an initial value to the procedure and can return an updated value, while OUT parameters ignore any initial value and only return a value.
Correct Answer: IN OUT parameters pass an initial value to the procedure and can return an updated value, while OUT parameters ignore any initial value and only return a value.
Explanation:
An IN OUT parameter allows a value to be passed into the procedure, modified, and then passed back out. An OUT parameter is strictly for returning a value from the procedure, discarding any initial value sent by the caller.
Incorrect! Try again.
24What is a primary performance advantage of using stored procedures for complex business logic over executing multiple individual SQL queries from a client application?
stored procedures
Medium
A.Stored procedures eliminate the need for index lookups.
B.Stored procedures reduce network traffic by executing the logic entirely on the database server.
C.Stored procedures do not consume CPU resources on the database server.
D.Stored procedures bypass the database concurrency control mechanisms.
Correct Answer: Stored procedures reduce network traffic by executing the logic entirely on the database server.
Explanation:
By keeping the execution of complex logic containing multiple statements on the server side, stored procedures minimize the round trips of data between the application client and the database server.
Incorrect! Try again.
25When processing a result set using a cursor, what is the standard and correct sequence of operations?
The correct lifecycle of a cursor is to first DECLARE it, OPEN it to establish the result set, FETCH rows one by one, CLOSE it to release the current result set, and finally DEALLOCATE it to free up resources.
Incorrect! Try again.
26An application uses a cursor to iterate through a large table. Which type of cursor is least sensitive to changes made by other concurrent transactions after the cursor is opened?
cursors
Medium
A.Forward-only cursor
B.Static cursor
C.Keyset-driven cursor
D.Dynamic cursor
Correct Answer: Static cursor
Explanation:
A static cursor takes a snapshot of the data at the time the cursor is opened. It does not reflect any changes, inserts, or deletes made by other transactions after it is opened.
Incorrect! Try again.
27You need to ensure that an audit table is updated automatically whenever a row in the Employees table is deleted. Which type of trigger is most appropriate for this requirement?
triggers
Medium
A.BEFORE UPDATE trigger on Employees
B.AFTER INSERT trigger on the audit table
C.INSTEAD OF DELETE trigger on Employees
D.AFTER DELETE trigger on Employees
Correct Answer: AFTER DELETE trigger on Employees
Explanation:
An AFTER DELETE trigger on the Employees table fires right after a successful delete operation, making it ideal for logging or auditing the action that just occurred.
Incorrect! Try again.
28An INSTEAD OF trigger is most commonly applied to which of the following database objects to make them updatable?
triggers
Medium
A.Materialized views
B.Base tables with primary keys
C.Temporary tables
D.Complex views with joins or aggregates
Correct Answer: Complex views with joins or aggregates
Explanation:
Complex views containing joins, aggregations, or grouping are inherently non-updatable. INSTEAD OF triggers intercept the DML command and allow developers to define custom logic to update the underlying base tables.
Incorrect! Try again.
29In a database programming block (e.g., PL/SQL), what happens when an exception is raised but not explicitly caught by an exception handler in that specific block?
exception handling
Medium
A.The exception propagates to the calling environment or enclosing block.
B.The transaction is immediately committed.
C.The block ignores the exception and continues executing the next statement.
D.The database engine automatically drops the affected table.
Correct Answer: The exception propagates to the calling environment or enclosing block.
Explanation:
If an exception is unhandled in the current block, execution halts and the exception is passed (propagated) up to the enclosing block or the calling environment until it is handled or causes a system error.
Incorrect! Try again.
30In transaction processing, what does a 'Commit Point' signify?
Database Transaction Processing
Medium
A.The point where all operations of a transaction have successfully executed and their effects are permanently recorded.
B.The point where a transaction acquires its first lock.
C.The point where a transaction is forced to roll back due to a system failure.
D.The point at which a transaction begins execution.
Correct Answer: The point where all operations of a transaction have successfully executed and their effects are permanently recorded.
Explanation:
The commit point is reached when a transaction completes all its actions successfully. The DBMS records the commit in the log, ensuring the changes are durable.
Incorrect! Try again.
31Which transaction state indicates that a transaction has executed its final statement but has not yet committed its changes to the database?
transaction system concepts
Medium
A.Aborted
B.Active
C.Failed
D.Partially committed
Correct Answer: Partially committed
Explanation:
A transaction enters the 'partially committed' state after executing its last statement. It transitions to 'committed' only after all recovery information and logs are successfully written to disk.
Incorrect! Try again.
32A bank transfer transaction deducts $100 from Account A and adds $100 to Account B. If the system crashes immediately after the deduction but before the addition, which ACID property ensures the deduction is undone upon recovery?
desirable properties of transactions
Medium
A.Atomicity
B.Durability
C.Consistency
D.Isolation
Correct Answer: Atomicity
Explanation:
Atomicity guarantees that a transaction is treated as a single, indivisible unit of work ('all or nothing'). If the entire transaction does not complete, partial changes are rolled back.
Incorrect! Try again.
33Two concurrent transactions are updating the same row. Transaction 1's intermediate changes are hidden from Transaction 2 until Transaction 1 commits. Which ACID property is being demonstrated here?
desirable properties of transactions
Medium
A.Isolation
B.Durability
C.Atomicity
D.Consistency
Correct Answer: Isolation
Explanation:
Isolation ensures that concurrent transactions execute independently of one another. The intermediate states of a transaction are invisible to other transactions until a commit occurs.
Incorrect! Try again.
34In a concurrent schedule, a 'blind write' occurs when a transaction:
schedules
Medium
A.Reads a value and then writes it without modifying it.
B.Writes a value to a log file but not the database.
C.Writes a value to a data item without previously reading it.
D.Attempts to write to a locked resource.
Correct Answer: Writes a value to a data item without previously reading it.
Explanation:
A blind write happens when a transaction writes a value to a data object without reading its current value first. Blind writes can affect whether a schedule is view serializable.
Incorrect! Try again.
35A precedence graph (serialization graph) is drawn for a schedule of concurrent transactions. Which condition strictly indicates that the schedule is conflict serializable?
serializability of schedules
Medium
A.The graph has identical in-degrees and out-degrees for all nodes.
B.The graph is completely disconnected.
C.The graph has at least one cycle.
D.The graph contains no cycles (is a directed acyclic graph).
Correct Answer: The graph contains no cycles (is a directed acyclic graph).
Explanation:
A schedule is conflict serializable if and only if its precedence graph contains no cycles. A cycle indicates an unresolvable conflict between transactions.
Incorrect! Try again.
36Consider transactions and . If reads data item and then writes to data item , what type of conflict is this?
serializability of schedules
Medium
A.Write-Write (WW) conflict
B.Write-Read (WR) conflict
C.Read-Write (RW) conflict
D.Read-Read (RR) conflict
Correct Answer: Read-Write (RW) conflict
Explanation:
This is a Read-Write (RW) conflict, also known as an unrepeatable read scenario. reads the data, and modifies it afterward, conflicting with 's initial read.
Incorrect! Try again.
37Under the Basic Two-Phase Locking (2PL) protocol, which of the following actions is strictly prohibited?
concurrency control
Medium
A.Releasing all locks simultaneously at the end of the transaction.
B.Acquiring a new lock after releasing an existing lock.
C.Upgrading a shared lock to an exclusive lock during the growing phase.
D.Acquiring a shared lock after a transaction starts.
Correct Answer: Acquiring a new lock after releasing an existing lock.
Explanation:
In Two-Phase Locking (2PL), a transaction cannot request any additional locks once it releases a lock. This separates the transaction into a growing phase (acquiring locks) and a shrinking phase (releasing locks).
Incorrect! Try again.
38Which of the following concurrency control anomalies occurs when a transaction reads a value written by an uncommitted transaction?
concurrency control
Medium
A.Lost update
B.Non-repeatable read
C.Dirty read
D.Phantom read
Correct Answer: Dirty read
Explanation:
A dirty read occurs when a transaction is allowed to read data that has been modified by another running transaction but not yet committed.
Incorrect! Try again.
39A schedule is defined as 'recoverable' if, for every pair of transactions and where reads a value written by , which of the following holds true?
recoverability
Medium
A. commits before commits.
B. commits before commits.
C.Both transactions commit simultaneously.
D. rolls back if attempts to commit.
Correct Answer: commits before commits.
Explanation:
For a schedule to be recoverable, a transaction () that reads a value written by another transaction () must delay its commit until after the transaction that wrote the value () commits.
Incorrect! Try again.
40What characterizes a 'cascadeless' schedule?
recoverability
Medium
A.Deadlocks are completely eliminated.
B.No transaction ever rolls back.
C.A transaction only reads values written by already committed transactions.
D.When a transaction aborts, all other transactions automatically commit.
Correct Answer: A transaction only reads values written by already committed transactions.
Explanation:
A cascadeless schedule prevents cascading rollbacks by ensuring that transactions can only read data items that have been written by transactions that are already committed.
Incorrect! Try again.
41In a procedural SQL block, how does three-valued logic (TRUE, FALSE, UNKNOWN) affect the execution of an IF ... ELSIF ... ELSE construct when evaluating a condition that results in NULL?
flow control statements
Hard
A.The execution halts, and the transaction is implicitly rolled back to the nearest savepoint.
B.The construct throws a runtime exception because NULL cannot be evaluated in boolean contexts.
C.The NULL condition evaluates to UNKNOWN, which is treated as TRUE by default, executing the block under the current condition.
D.The NULL condition evaluates to UNKNOWN, bypassing the current IF/ELSIF block and proceeding to the next ELSIF or the ELSE block.
Correct Answer: The NULL condition evaluates to UNKNOWN, bypassing the current IF/ELSIF block and proceeding to the next ELSIF or the ELSE block.
Explanation:
In SQL flow control, a condition that results in NULL evaluates to UNKNOWN. Since flow control statements (like IF) require a strict TRUE evaluation to execute their corresponding block, an UNKNOWN result causes the logic to fall through to the next ELSIF or the ELSE block without throwing an error.
Incorrect! Try again.
42When defining a User-Defined Function (UDF) in a database, what is the primary performance implication of declaring the function as DETERMINISTIC when it actually accesses sequence values or time-based data?
functions
Hard
A.The database prevents the compilation of the function because sequence values trigger a syntax error in deterministic contexts.
B.The function will automatically be converted to an autonomous transaction to isolate the non-deterministic state.
C.The database engine will automatically track state changes and invalidate the query cache dynamically, causing high CPU overhead.
D.The query optimizer may cache the result of the function for a given input during a query, leading to incorrect, stale data being returned for subsequent rows.
Correct Answer: The query optimizer may cache the result of the function for a given input during a query, leading to incorrect, stale data being returned for subsequent rows.
Explanation:
Declaring a function as DETERMINISTIC signals to the optimizer that for a given input, the output is always the same. The optimizer relies on this to cache results to speed up queries. If the function actually returns varying data (like SYSDATE or sequence numbers), the optimizer might erroneously reuse the cached value for multiple rows, causing data corruption or logical errors.
Incorrect! Try again.
43Consider a stored procedure containing an autonomous transaction. If the main transaction that calls this procedure rolls back, what is the state of the data modified and committed by the autonomous transaction?
stored procedures
Hard
A.The autonomous transaction's changes are rolled back along with the main transaction.
B.The autonomous transaction's changes remain committed because it operates in a separate, independent transaction context.
C.The autonomous transaction's changes are reverted only if the procedure used an OUT parameter to pass data back.
D.The database raises an exception and places the database in an inconsistent state.
Correct Answer: The autonomous transaction's changes remain committed because it operates in a separate, independent transaction context.
Explanation:
An autonomous transaction is fully independent of the calling (main) transaction. Once it commits, its changes are permanent and visible to other transactions, regardless of whether the main transaction subsequently commits or rolls back. This is often used for logging errors.
Incorrect! Try again.
44In the context of stored procedures with OUT parameters, if an unhandled exception occurs within the procedure after an OUT parameter has been assigned a new value, what value is returned to the calling environment?
stored procedures
Hard
A.The procedure returns a pointer to the exception object.
B.The OUT parameter becomes uninitialized (resulting in undefined behavior).
C.The original value (or NULL) before the procedure call is returned.
D.The newly assigned value is returned.
Correct Answer: The original value (or NULL) before the procedure call is returned.
Explanation:
When an unhandled exception propagates out of a stored procedure, the procedure does not complete normally. Therefore, the values of OUT or IN OUT parameters are not passed back to the calling environment, and they retain their original values from before the call.
Incorrect! Try again.
45Which of the following scenarios describes a 'mutating table' exception when dealing with implicit cursors and triggers?
cursors
Hard
A.A row-level trigger attempts to query or modify the same table that fired the trigger, while the triggering statement is still processing.
B.A statement-level trigger modifies a view that possesses an INSTEAD OF trigger.
C.A dynamic cursor fetches a row that was deleted by another transaction after the cursor was opened.
D.A cursor attempts to fetch data from a table that is currently locked in SHARE mode by another transaction.
Correct Answer: A row-level trigger attempts to query or modify the same table that fired the trigger, while the triggering statement is still processing.
Explanation:
A mutating table is a table that is currently being modified by an UPDATE, DELETE, or INSERT statement. If a row-level trigger on that table attempts to read or modify the same table, the database raises a mutating table exception to prevent inconsistent reads and infinite loops.
Incorrect! Try again.
46When utilizing the WHERE CURRENT OF clause with an explicit cursor to update a row, what prerequisite must be met in the cursor declaration to guarantee concurrency control without phantom updates?
cursors
Hard
A.The cursor must be declared as a DYNAMIC scrollable cursor.
B.The cursor must strictly select only the primary key column.
C.The cursor must be declared with ISOLATION LEVEL SERIALIZABLE.
D.The cursor must include a FOR UPDATE clause, which acquires row-level exclusive locks during the fetch phase.
Correct Answer: The cursor must include a FOR UPDATE clause, which acquires row-level exclusive locks during the fetch phase.
Explanation:
The WHERE CURRENT OF clause updates or deletes the most recently fetched row from a cursor. To use it safely and legally in most SQL dialects, the cursor must be declared with FOR UPDATE. This locks the fetched rows, preventing other transactions from modifying them before the update/delete occurs.
Incorrect! Try again.
47In a complex database schema, an INSTEAD OF trigger is defined on a non-updatable view. If a transaction executes an INSERT statement on this view, how does the database handle the base table constraints?
triggers
Hard
A.The base table constraints are ignored entirely because the view is abstract.
B.The base table constraints are evaluated before the INSTEAD OF trigger executes.
C.The base table constraints are evaluated only when the DML statements inside the INSTEAD OF trigger attempt to modify the base tables.
D.The database throws a compilation error because non-updatable views cannot evaluate constraints.
Correct Answer: The base table constraints are evaluated only when the DML statements inside the INSTEAD OF trigger attempt to modify the base tables.
Explanation:
An INSTEAD OF trigger intercepts the DML operation on the view and executes its own procedural block instead. Constraints on the underlying base tables are not checked against the initial DML on the view; they are only checked when the procedural code inside the trigger explicitly performs DML on those base tables.
Incorrect! Try again.
48Consider a scenario with cascading triggers: Table A has an AFTER UPDATE trigger that updates Table B. Table B has an AFTER UPDATE trigger that updates Table C. If the trigger on Table B fails and raises an unhandled exception, what is the final state of the transaction?
triggers
Hard
A.Table C is rolled back, but Table A and Table B updates remain.
B.The entire transaction, including the initial update on Table A, is rolled back.
C.Table B and Table C are rolled back, but Table A's update is committed.
D.Only Table B's update is rolled back.
Correct Answer: The entire transaction, including the initial update on Table A, is rolled back.
Explanation:
Triggers execute within the same transaction context as the firing statement. If a trigger raises an unhandled exception, the statement that caused the trigger to fire fails. In a cascading scenario, an unhandled exception propagates up the chain, causing the entire sequence (including the original triggering statement on Table A) to be rolled back.
Incorrect! Try again.
49In a nested block structure, the inner block catches a NO_DATA_FOUND exception, performs an INSERT into an error log table, and then executes a RAISE; statement without arguments. What is the consequence of this action?
exception handling
Hard
A.A syntax error occurs because RAISE requires an explicit exception name.
B.The NO_DATA_FOUND exception is re-raised to the outer block, and if not caught there, the entire transaction (including the error log INSERT) is rolled back.
C.The exception is masked, and the inner block successfully completes, allowing the outer block to continue normally.
D.The error log INSERT is immediately committed, and the outer block resumes execution.
Correct Answer: The NO_DATA_FOUND exception is re-raised to the outer block, and if not caught there, the entire transaction (including the error log INSERT) is rolled back.
Explanation:
A RAISE; statement with no arguments inside an exception handler re-raises the current exception to the enclosing block. Because the exception propagates outward, the transaction context remains uncommitted. If the outer block does not handle the exception, the entire transaction (including the logging attempt, unless it was an autonomous transaction) rolls back.
Incorrect! Try again.
50Which of the following statements correctly differentiates between user-defined exceptions and pre-defined exceptions during the compilation and execution phases?
exception handling
Hard
A.Pre-defined exceptions are raised automatically by the database engine, whereas user-defined exceptions must be raised explicitly using the RAISE statement.
B.User-defined exceptions bypass the rollback mechanism, whereas pre-defined exceptions force a transaction rollback.
C.Pre-defined exceptions can only be caught in the OTHERS handler, whereas user-defined exceptions require specific WHEN clauses.
D.User-defined exceptions are evaluated at compile time, whereas pre-defined exceptions are evaluated at runtime.
Correct Answer: Pre-defined exceptions are raised automatically by the database engine, whereas user-defined exceptions must be raised explicitly using the RAISE statement.
Explanation:
Pre-defined exceptions (like ZERO_DIVIDE or NO_DATA_FOUND) are tied to database errors and are automatically thrown by the execution engine. User-defined exceptions are declared by the developer for business logic errors and must be explicitly triggered using a RAISE statement.
Incorrect! Try again.
51A Database Management System implements a Steal / No-Force buffer management policy. Which types of logging are strictly required to ensure both Atomicity and Durability in the event of a system crash?
Database Transaction Processing
Hard
A.Only UNDO logging is required.
B.Neither UNDO nor REDO logging is required if Write-Ahead Logging (WAL) is disabled.
C.Both UNDO and REDO logging are required.
D.Only REDO logging is required.
Correct Answer: Both UNDO and REDO logging are required.
Explanation:
A 'Steal' policy allows uncommitted transactions to flush their dirty pages to disk, necessitating UNDO logging to roll them back (Atomicity) upon a crash. A 'No-Force' policy does not require transactions to flush all dirty pages to disk before committing, necessitating REDO logging to recreate committed changes (Durability) after a crash.
Incorrect! Try again.
52During transaction execution, a transaction reaches the state where the final statement has been executed, but the system has not yet recorded the commit on disk. What is the precise state of the transaction?
transaction system concepts
Hard
A.Failed
B.Partially Committed
C.Active
D.Committed
Correct Answer: Partially Committed
Explanation:
A transaction enters the 'Partially Committed' state immediately after executing its final operation. It transitions to 'Committed' only when all of its updates, including the commit record, are safely written to stable storage (disk).
Incorrect! Try again.
53Which of the following concurrency anomalies represents a violation of Isolation that can occur under Snapshot Isolation, where two transactions read overlapping data sets but disjointly update different items?
desirable properties of transactions
Hard
A.Dirty Read
B.Phantom Read
C.Write Skew
D.Non-Repeatable Read
Correct Answer: Write Skew
Explanation:
Write Skew occurs under Snapshot Isolation when two concurrent transactions read the same initial state, make mutually exclusive modifications based on that state, and both commit successfully. Since neither transaction overwrites the other's data, no write conflict is detected, but the combined result violates a constraint that would have been preserved in a serial execution.
Incorrect! Try again.
54Given a schedule , it is observed that no transaction reads from or writes to a data item that has been written by an uncommitted transaction. Which of the following classifications strictly defines this schedule?
schedules
Hard
A.Conflict Serializable schedule
B.Recoverable schedule
C.Strict schedule
D.Cascadeless schedule
Correct Answer: Strict schedule
Explanation:
A Strict schedule mandates that no transaction can read or write a data item until the last transaction that wrote has committed or aborted. While a Cascadeless schedule prevents reading uncommitted data, a Strict schedule extends this prohibition to writing over uncommitted data (preventing blind writes on uncommitted items), making recovery easier.
Incorrect! Try again.
55Consider a schedule that is View Serializable but NOT Conflict Serializable. What property must be present in schedule ?
serializability of schedules
Hard
A.Two transactions updating separate data items concurrently without locking.
B.The presence of cascading rollbacks.
C.At least one blind write (a transaction writing to a data item without reading it first).
D.A cycle in the precedence graph consisting solely of Read-Write conflicts.
Correct Answer: At least one blind write (a transaction writing to a data item without reading it first).
Explanation:
If a schedule is View Serializable but not Conflict Serializable, it must contain a cycle in its precedence graph, yet still yield the same final state and read operations as a serial schedule. This is only mathematically possible if the schedule contains blind writes, which allow subsequent writes to overwrite conflicting data without affecting final view equivalency.
Incorrect! Try again.
56Why is View Serializability rarely used as the standard correctness criterion in practical database concurrency control implementations?
serializability of schedules
Hard
A.Because View Serializability cannot prevent dirty reads in a distributed database system.
B.Because testing for View Serializability has a computational complexity of , making it too slow.
C.Because the problem of checking whether a schedule is View Serializable is NP-Complete, making it computationally infeasible for the scheduler.
D.Because View Serializability does not guarantee strictness, which is required for recoverability.
Correct Answer: Because the problem of checking whether a schedule is View Serializable is NP-Complete, making it computationally infeasible for the scheduler.
Explanation:
Testing for Conflict Serializability is a polynomial-time operation (e.g., detecting a cycle in a precedence graph takes ). However, testing for View Serializability in the general case (especially when blind writes are present) is an NP-Complete problem. Therefore, real-world DBMS schedulers rely on conflict serializability protocols (like 2PL).
Incorrect! Try again.
57Under Basic Timestamp Ordering (TO) concurrency control, what does the Thomas Write Rule optimize by ignoring certain write operations rather than aborting the transaction?
concurrency control
Hard
A.It skips validation phases in optimistic concurrency control for read-only transactions.
B.It ignores a write if a younger transaction has already written the data item, thus avoiding an unnecessary abort.
C.It ignores read operations if an older transaction holds a write lock, preventing deadlocks.
D.It ignores a write if a younger transaction has already read the data item, allowing the older transaction to commit.
Correct Answer: It ignores a write if a younger transaction has already written the data item, thus avoiding an unnecessary abort.
Explanation:
The Thomas Write Rule relaxes basic Timestamp Ordering. If a transaction attempts to write to a data item , and the write timestamp of is greater than (meaning a younger transaction has already overwritten it), 's write is considered obsolete. Instead of aborting , the rule simply ignores the write operation, safely allowing to continue.
Incorrect! Try again.
58In Strict Two-Phase Locking (Strict 2PL), when does a transaction release its exclusive (write) locks?
concurrency control
Hard
A.As soon as the shrinking phase begins.
B.Only after the transaction has successfully committed or aborted.
C.When the lock manager detects a potential deadlock cycle.
D.Immediately after the specific write operation is completed.
Correct Answer: Only after the transaction has successfully committed or aborted.
Explanation:
In Strict Two-Phase Locking (Strict 2PL), a transaction holds all of its exclusive (write) locks until the transaction completes (either commits or aborts). This guarantees that the generated schedules are both conflict serializable and strict (preventing cascading aborts). Regular 2PL would allow releasing locks during the shrinking phase, which can lead to cascading rollbacks.
Incorrect! Try again.
59Schedule : . Which statement accurately categorizes this schedule concerning recoverability?
recoverability
Hard
A.It is recoverable but not cascadeless, because reads the uncommitted value of from , but commits after commits.
B.It is strict, because commits before commits.
C.It is unrecoverable because overwrites the value of before commits.
D.It is cascadeless, because reads only after writes it.
Correct Answer: It is recoverable but not cascadeless, because reads the uncommitted value of from , but commits after commits.
Explanation:
A schedule is recoverable if, for every transaction that reads a value written by , commits before commits. Here, reads from and commits before ( before ), so it is recoverable. However, read the data before committed ( before ), meaning the schedule is not cascadeless (if failed, would have to cascade abort).
Incorrect! Try again.
60Which of the following conditions definitively guarantees that a schedule will NOT suffer from cascading rollbacks (cascadelessness)?
recoverability
Hard
A.The schedule is proven to be equivalent to a serial schedule.
B.Every transaction holds all its read and write locks until it commits.
C.Every transaction reads only those data items written by transactions that have already committed.
D.Transactions commit in the exact chronological order they started.
Correct Answer: Every transaction reads only those data items written by transactions that have already committed.
Explanation:
A cascadeless schedule is strictly defined as a schedule where no transaction reads a data item until the transaction that previously wrote it has committed. This prevents a scenario where the abort of one transaction forces the abort of other dependent transactions (cascading rollback). Serializability alone or commit ordering does not guarantee this.