0% found this document useful (0 votes)
31 views327 pages

Question Bank for Practice

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 327

Q1. Choose the correct option.

What is a database?
A. An organized collection of data
B. A software program used to store and manage data
C. A computer system used to store and manage data
D. All of the above
Correct Answer : D

Q2. Choose the correct option.

What are the different types of databases?


A. Relational databases
B. NoSQL databases
C. Cloud databases
D. All of the above
Correct Answer : D

Q3. Choose the correct option.

What is a data model?


A. An abstract representation of data
B. A blueprint for a database
C. A description of the structure and relationships between data
D. All of the above
Correct Answer : D

Q4. Choose the correct option.

What are the different types of data models?


A. Relational data models
B. Entity-relationship (ER) diagrams
C. Object-oriented data models
D. All of the above
Correct Answer : D
Q5. Choose the correct option.

Which of the following is NOT a functional dependency?


A. CustomerID -> CustomerName
B. OrderID -> CustomerID
C. OrderID -> ProductID
D. ProductID -> CustomerID
Correct Answer : D

Q6. Choose the correct option.

Which of the following is NOT a normal form?


A. First normal form (1NF)
B. Second normal form (2NF)
C. Third normal form (3NF)
D. Fourth normal form (4NF)
Correct Answer : A

Q7. Choose the correct option.

Which of the following is a benefit of normalization?


A. Reduces data redundancy
B. Improves data integrity
C. Makes data easier to update and maintain
D. All of the above
Correct Answer : D

Q8. Choose the correct option.

Which of the following is a partial dependency?


A. CustomerID -> CustomerName
B. OrderID -> CustomerID
C. OrderID -> ProductID
D. ProductID -> CustomerID
Correct Answer : B

Q9. Choose the correct option.

Which of the following is a transitive dependency?


A. CustomerID -> CustomerName
B. OrderID -> CustomerID
C. OrderID -> ProductID
D. ProductID -> CustomerID
Correct Answer : C

Q10. Choose the correct option.

Which of the following is a type of database encryption?


A. At-rest encryption
B. In-transit encryption
C. Both and
D. None of the above
Correct Answer : C

Q11. Choose the correct option.

Which of the following is a best practice for database password security?


A. Use strong passwords and change them regularly.
B. Store passwords in a secure location.
C. Avoid using common passwords.
D. All of the above.
Correct Answer : D

Q12. Choose the correct option.

Which of the following is a database security vulnerability that can be exploited to gain
unauthorized access to data?
A. SQL injection
B. Cross-site scripting (XSS)
C. Broken authentication and session management
D. All of the above.
Correct Answer : D

Q13. Choose the correct option.

Which of the following is a best practice for database disaster recovery?


A. Have a backup and recovery plan in place.
B. Test your backup and recovery plan regularly.
C. Store backups in a secure location.
D. All of the above.
Correct Answer : D

Q14. Choose the correct option.

What is the difference between a public and private object in a PL/SQL package?
A. A public object is accessible to other PL/SQL objects, while a private object is only
accessible to other objects in the same package.
B. A public object is a named object, while a private object is an unnamed object.
C. A public object is a stored procedure, while a private object is a function.
D. A public object is a trigger, while a private object is a PL/SQL block.
Correct Answer : A

Q15. Choose the correct option.

What is the purpose of the NEW and OLD pseudo-variables in PL/SQL triggers?
A. The NEW and OLD pseudo-variables are used to access the new and old values of a row
that is being inserted, updated, or deleted, respectively.
B. The NEW and OLD pseudo-variables are used to generate new values for a row.
C. The NEW and OLD pseudo-variables are used to compare the new and old values of a
row.
D. The NEW and OLD pseudo-variables are used to set the new values for a row.
Correct Answer : A

Q16. Choose the correct option.

Which of the following is a good practice when using triggers in PL/SQL?


A. Avoid writing complex triggers.
B. Test triggers thoroughly before deploying them to production.
C. Use triggers sparingly, and only when necessary.
D. All of the above.
Correct Answer : D

Q17. Choose the correct option.

Which of the following is a common use case for PL/SQL packages?


A. To encapsulate related PL/SQL objects.
B. To improve the performance of PL/SQL code.
C. To make PL/SQL code more secure.
D. All of the above.
Correct Answer : A

Q18. Choose the correct option.

Which of the following is NOT a benefit of using PL/SQL procedures?


A. Procedures can be reused in other PL/SQL code.
B. Procedures can be used to encapsulate complex logic.
C. Procedures can be used to improve the performance of PL/SQL code.
D. Procedures can be used to store data.
Correct Answer : D

Q19. Choose the correct option.

What is the purpose of a conditional control structure in DBMS?


A. To execute different statements based on the value of a condition.
B. To loop through a set of data.
C. To exit a loop.
D. All of the above.
Correct Answer : A

Q20. Choose the correct option.

What is the difference between an IF statement and an ELSE IF statement in DBMS?


A. An IF statement allows you to execute a block of code if a condition is met, while an
ELSE IF statement allows you to execute a different block of code if a condition is not met,
but another condition is met.
B. An IF statement is a conditional control structure, while an ELSE IF statement is a loop
control structure.
C. An IF statement is a procedural statement, while an ELSE IF statement is a declarative
statement.
D. None of the above.
Correct Answer : A

Q21. Choose the correct option.

What is the purpose of a WHILE loop in DBMS?


A. To execute a block of code repeatedly until a condition is met.
B. To execute a block of code a fixed number of times.
C. To exit a loop.
D. All of the above.
Correct Answer : A

Q22. Choose the correct option.

What is the difference between a WHILE loop and a DO-WHILE loop in DBMS?
A. A WHILE loop checks the condition before executing the block of code, while a DO-
WHILE loop checks the condition after executing the block of code.
B. A WHILE loop is a conditional control structure, while a DO-WHILE loop is a loop
control structure.
C. A WHILE loop is a procedural statement, while a DO-WHILE loop is a declarative
statement.
D. None of the above.
Correct Answer : A

Q23. Choose the correct option.

What is the purpose of the BREAK statement in DBMS?


A. To exit a loop.
B. To continue to the next iteration of a loop.
C. To skip the current iteration of a loop.
D. All of the above.
Correct Answer : A

Q24. Choose the correct option.

What are the two main types of concurrency control protocols?


A. Locking and timestamping.
B. Pessimistic and optimistic.
C. Centralized and distributed.
D. Static and dynamic.
Correct Answer : A

Q25. Choose the correct option.

What is the difference between a lock conflict and a deadlock?


A. A lock conflict occurs when two transactions try to acquire the same lock on the same
data item at the same time, while a deadlock occurs when two or more transactions are
waiting for each other to release locks.
B. A lock conflict is a type of deadlock, while a deadlock is not a type of lock conflict.
C. A lock conflict is a problem that can be resolved by the DBMS, while a deadlock is a
problem that can only be resolved by the user.
D. None of the above.
Correct Answer : A
Q26. Choose the correct option.

What is the purpose of the COMMIT statement in DBMS?


A. To make the changes made by a transaction permanent in the database.
B. To roll back the changes made by a transaction.
C. To save the changes made by a transaction without making them permanent.
D. None of the above.
Correct Answer : A

Q27. Choose the correct option.

What is a package in PL/SQL?


A. A collection of variables and constants
B. A collection of stored procedures and functions
C. A collection of related data types
D. A collection of triggers and views
Correct Answer : A

Q28. Choose the correct option.

Which of the following statements about PL/SQL packages is true?


A. Packages cannot contain cursors
B. Packages cannot have variables
C. Packages can have multiple functions and procedures
D. Packages can only be used in anonymous blocks
Correct Answer : C

Q29. Choose the correct option.

What is the advantage of using packages in PL/SQL?


A. Packages allow for code reusability and encapsulation
B. Packages provide a way to create database tables
C. Packages can only be used for exception handling
D. Packages allow direct access to database records
Correct Answer : A

Q30. Choose the correct option.

In a PL/SQL package, which section is used to declare public variables and cursors
accessible outside the package?
A. PROCEDURE
B. FUNCTION
C. PUBLIC
D. PACKAGE
Correct Answer : C

Q31. Choose the correct option.

What is the purpose of the BODY keyword in a PL/SQL package?


A. It declares public procedures and functions
B. It defines the implementation details of procedures and functions
C. It specifies package-level variables
D. It indicates the package is complete and ready for execution
Correct Answer : B

Q32. Choose the correct option.

What is a transaction in a DBMS?


A. A single SQL statement
B. A sequence of SQL statements executed together as a unit
C. A database schema
D. A database index
Correct Answer : B

Q33. Choose the correct option.

Which of the following properties is ensured by ACID properties of transactions in DBMS?


A. Atomicity, Consistency, Isolation, Durability
B. Accuracy, Consistency, Integrity, Durability
C. Atomicity, Compatibility, Isolation, Durability
D. Availability, Consistency, Isolation, Durability
Correct Answer : A

Q34. Choose the correct option.

What does the Isolation property of ACID ensure in DBMS transactions?


A. Transactions are executed in a specific sequence
B. Transactions are independent of each other
C. Transactions are durable and permanent
D. Transactions are always consistent
Correct Answer : B

Q35. Choose the correct option.

Which of the following is a potential issue in concurrent access to a database?


A. Data redundancy
B. Data normalization
C. Lost updates
D. Data encryption
Correct Answer : C

Q36. Choose the correct option.

What is a transaction in the context of DBMS concurrency control?


A. A sequence of SQL statements
B. A database schema
C. A database index
D. A database table
Correct Answer : A
Q37. Choose the correct option.

What is the purpose of the Two-Phase Locking (2PL) protocol in DBMS concurrency
control?
A. It ensures that transactions acquire all the necessary locks before releasing any locks.
B. It allows transactions to release locks at any time.
C. It allows transactions to acquire and release locks multiple times during their
execution.
D. It does not relate to concurrency control.
Correct Answer : A

Q38. Choose the correct option.

Which type of subquery can be used with the UPDATE and DELETE statements to perform
operations based on values from another table?
A. Correlated Subquery
B. Scalar Subquery
C. Nested Subquery
D. Inline View Subquery
Correct Answer : A

Q39. Choose the correct option.

What will a subquery return if it does not find any matching rows in the database?
A. NULL
B. 0
C. Error
D. Empty string
Correct Answer : A

Q40. Choose the correct option.

Which component of DBMS architecture is responsible for managing concurrent access to


the database by multiple users or transactions?
A. Query Executor
B. Concurrency Control Manager
C. Backup and Recovery Manager
D. Schema Manager
Correct Answer : B

Q41. Choose the correct option.

What is the primary role of the Data Dictionary in DBMS architecture?


A. It stores metadata, such as schema definitions and access privileges.
B. It manages data encryption and decryption.
C. It optimizes SQL queries for better performance.
D. It executes SQL queries submitted by users.
Correct Answer : A

Q42. Choose the correct option.

In a SQL NATURAL JOIN, what happens if there are columns with the same name but
different data types in the joined tables?
A. An error is raised
B. The columns with the same name are automatically cast to a common data type
C. The join is not allowed
D. The columns with the same name are ignored
Correct Answer : B

Q43. Choose the correct option.

In a relational database, what is a functional dependency?


A. A relationship between two tables
B. A constraint that enforces data consistency
C. A relationship between two attributes where one uniquely determines the other
D. A relationship between two attributes where both are primary keys
Correct Answer : C

Q44. Choose the correct option.


Consider a sales database with two tables: sales (sale_id | sale_date | product_id |
quantity | unit_price) and products (product_id | product_name | category). Which SQL query
should you use to find the product(s) with the highest unit price?
A. SELECT product_id FROM products WHERE unit_price = (SELECT MAX(unit_price)
FROM products);
B. SELECT product_name FROM products WHERE unit_price = (SELECT MAX(unit_price)
FROM products);
C. SELECT product_id FROM products WHERE unit_price = (SELECT MAX(unit_price)
FROM sales);
D. SELECT product_name FROM products WHERE unit_price = (SELECT MAX(unit_price)
FROM sales);
Correct Answer : B

Q45. Choose the correct option.

Which of the following is NOT a property of a transaction in DBMS?


A. Atomicity
B. Consistency
C. Durability
D. Isolation
Correct Answer : B

Q46. Choose the correct option.

Which isolation level allows the highest concurrency but may result in non-repeatable
reads?
A. Read Uncommitted
B. Read Committed
C. Repeatable Read
D. Serializable
Correct Answer : A

Q47. Choose the correct option.


Which concurrency control technique allows conflicts to be detected and resolved only at
the commit time?
A. Validation-based protocol
B. Timestamp ordering
C. Two-phase locking
D. Three-phase locking
Correct Answer : A

Q48. Choose the correct option.

Which of the following is a valid example of a full functional dependency?


A. A -> B, A -> C, B -> C
B. A -> B, C -> B, A -> C
C. A -> B, A -> C, B -> D
D. A -> B, B -> C, A -> C
Correct Answer : D

Q49. Choose the correct option.

In a functional dependency A -> B, what does A represent?


A. The dependent attribute
B. The determinant attribute
C. Both A and B
D. None of the above
Correct Answer : B

Q50. Choose the correct option.

What is the closure of a set of attributes with respect to a set of functional dependencies?
A. The set of all attributes that can be derived from the given attributes and functional
dependencies
B. The set of primary keys in a table
C. The set of attributes that are directly related to each other
D. The set of attributes that are not related to each other
Correct Answer : A
Q51. Choose the correct option.

Which normal form ensures that there are no partial dependencies in a relational
database?
A. Boyce-Codd Normal Form (BCNF)
B. Third Normal Form (3NF)
C. Second Normal Form (2NF)
D. First Normal Form (1NF)
Correct Answer : A

Q52. Choose the correct option.

Consider an order database with two tables: orders (order_id | order_date | customer_id |
total_amount) and customers(customer_id | customer_name). What SQL query would you use to
find the total amount spent by each customer?
A. SELECT customer_id, SUM(total_amount) FROM orders GROUP BY customer_id;
B. SELECT customer_name, SUM(total_amount) FROM customers JOIN orders ON
customers.customer_id = orders.customer_id GROUP BY customer_name;
C. SELECT customer_name, SUM(total_amount) FROM customers LEFT JOIN orders ON
customers.customer_id = orders.customer_id GROUP BY customer_name;
D. SELECT customer_id, total_amount FROM orders;
Correct Answer : A

Q53. Choose the correct option.

What is the primary purpose of a Write-Ahead Logging (WAL) protocol in a DBMS?


A. To optimize storage space usage
B. To maintain data integrity constraints
C. To ensure data consistency during recovery
D. To improve query performance
Correct Answer : C

Q54. Choose the correct option.


What is the key difference between stored procedures and functions in DBMS?
A. Stored procedures can return multiple values, while functions can only return a single
value
B. Stored procedures can be executed by users, while functions can only be executed by
the database administrator
C. Stored procedures are used for data manipulation, while functions are used for data
retrieval
D. Stored procedures can be called from within other procedures, while functions cannot
Correct Answer : A

Q55. Choose the correct option.

When one transaction updates a database item, and somehow the transaction fails, and
the data doesn't get ___ back, another transaction tries to access the updated database item.
A. Rolled
B. Committed
C. Aborted
D. None
Correct Answer : A

Q56. Choose the correct option.

Which of the following statements best defines database recovery in DBMS?


A. The process of restoring data from backup tapes
B. The process of ensuring that the database remains secure
C. The process of restoring the database to a consistent state after a failure
D. The process of recovering deleted data from the Recycle Bin
Correct Answer : C

Q57. Choose the correct option.

What is a transitive dependency in functional dependency theory?


A. A situation where an attribute depends on a non-prime attribute
B. A situation where an attribute depends on a superkey
C. A situation where an attribute depends on another attribute through a third attribute
D. A situation where an attribute depends on a primary key
Correct Answer : C

Q58. Choose the correct option.

In a relational database, what is a superkey?


A. A set of attributes that uniquely identifies a tuple in a relation
B. A set of attributes that determines another set of attributes
C. A set of attributes that is not related to any other attributes
D. A set of attributes that includes all the attributes in a relation
Correct Answer : D

Q59. Choose the correct option.

The CREATE TRIGGER statement is used to create the trigger. THE _____ clause specifies the
table name on which the trigger is to be attached. The ______ specifies that this is an AFTER
INSERT trigger.
A. for insert, on
B. On, for insert
C. For, insert
D. None of the mentioned
Correct Answer : B

Q60. Choose the correct option.

Suppose a database system crashes again while recovering from a previous crash. Assume
checkpointing is not done by the database either during the transactions or during recovery.
Which of the following statements is/are correct?
A. The same undo and redo list will be used while recovering again.
B. The database will become inconsistent.
C. All the transactions that are already undone and redone will not be recovered again.
D. The system cannot recover any further.
Correct Answer : A
Q61. Choose the correct option.

Consider the following database schedule with two transactions, T1 and T2


S = r2(X); r1(X); r2(Y); w1(X); r1(Y); w2(X); a1; a2
where ri(Z) denotes a read operation by transaction Ti on a variable Z, wi(Z) denotes a write
operation by Ti on a variable Z a
A. S is non-recoverable
B. S is recoverable, but has a cascading abort
C. S does not have a cascading abort
D. S is strict
Correct Answer : C

Q62. Choose the correct option.

In PL/SQL, the CREATE TABLESPACE is used


A. To create a place in the database for storage of scheme objects, rollback segments, and
naming the data files to comprise the table-space
B. To create a database trigger
C. To add/rename data files, to change storage
D. All of the above
Correct Answer : A

Q63. Choose the correct option.

Which of the following types of errors occurs when a user tries to access a table that does
not exist in the database?
A. Table Not Found Error
B. Semantic Error
C. Logical Error
D. Syntax Error
Correct Answer : A

Q64. Choose the correct option.

Which of the following is an example of a transitive dependency?


A. A -> B
B. A -> B, B -> C
C. A -> B, B -> C, A -> C
D. A -> B, C -> A
Correct Answer : C

Q65. Choose the correct option.

Which type of error occurs when the database crashes while a transaction is being
executed?
A. System error
B. Media error
C. Transaction error
D. Operator error
Correct Answer : A

Q66. Choose the correct option.

Which recovery technique uses backward recovery to undo the changes made by a failed
transaction?
A. Undo logging
B. Redo logging
C. Deferred update
D. Immediate update
Correct Answer : A

Q67. Choose the correct option.

Which of the following recovery techniques is based on maintaining multiple copies of the
database at different points in time?
A. Replication
B. Deferred update
C. Redo logging
D. Undo logging
Correct Answer : A
Q68. Choose the correct option.

What is Output-- Insert sample records into the "employee" table


INSERT INTO employee (employee_id, first_name, last_name, department, salary)
VALUES (1, 'John', 'Doe', 'HR', 50000);
INSERT INTO employee (employee_id, first_name, last_name, department, s
A. An error occurred.
B. Employee ID not found. No employee deleted.
C. Employee deleted successfully.
D. EXECUTE delete_employee_by_id(2);
Correct Answer : B

Q69. Choose the correct option.

When a DBMS encounters a constraint violation, which type of error is generated?


A. Integrity Constraint Violation Error
B. Semantic Error
C. Logical Error
D. Syntax Error
Correct Answer : A

Q70. Choose the correct option.

Which of the following is an example of a runtime error in DBMS?


A. Referential integrity error
B. Division by zero during a query execution
C. Violation of a primary key constraint
D. Incorrect SQL syntax
Correct Answer : B

Q71. Choose the correct option.

Which normal form allows for a partial dependency but eliminates transitive
dependencies?
A. Boyce-Codd Normal Form (BCNF)
B. Third Normal Form (3NF)
C. Second Normal Form (2NF)
D. First Normal Form (1NF)
Correct Answer : A

Q72. Choose the correct option.

Consider a sales database with a sales (order_id | order_date | customer_id |


total_amount) customer( customer_id | customer_name) table. Which SQL query should you use
to calculate the total sales revenue for each product?
A. SELECT product_id, SUM(quantity * unit_price) FROM sales;
B. SELECT product_id, SUM(quantity * unit_price) FROM sales GROUP BY product_id;
C. SELECT product_id, SUM(total_sales) FROM sales GROUP BY product_id;
D. SELECT product_id, SUM(quantity) * SUM(unit_price) FROM sales GROUP BY
product_id;
Correct Answer : B

Q73. Choose the correct option.

When a database operation attempts to insert a duplicate value into a unique key column,
what type of error occurs?
A. Semantic Error
B. Logical Error
C. Syntax Error
D. Duplicate Key Error
Correct Answer : D

Q74. Choose the correct option.

Which type of error in DBMS occurs when a query retrieves incorrect data due to a flawed
database design or query logic?
A. Semantic Error
B. Logical Error
C. Syntax Error
D. Data Retrieval Error
Correct Answer : B

Q75. Choose the correct option.

Which type of error occurs when there is a mismatch between the data type of a column
and the data being inserted into it?
A. Data Integrity Error
B. Semantic Error
C. Logical Error
D. Type Error
Correct Answer : D

Q76. Choose the correct option.

When a query attempts to divide a number by zero, what type of error is encountered?
A. Data Arithmetic Error
B. Semantic Error
C. Division by Zero Error
D. Syntax Error
Correct Answer : C

Q77. Choose the correct option.

Which ACID property ensures that once a transaction is committed, its changes are
permanent and will survive system crashes or failures?
A. Atomicity
B. Consistency
C. Isolation
D. Durability
Correct Answer : D

Q78. Choose the correct option.


Which of the following is an example of a violation of the "Isolation" property in ACID?
A. Lost updates
B. Dirty reads
C. Non-repeatable reads
D. All of the above
Correct Answer : D

Q79. Choose the correct option.

What is the Oracle Error Code for ACCESS_INTO_NULL?


A. 6592
B. 6531
C. 1722
D. 6530
Correct Answer : D

Q80. Choose the correct option.

Which of the following is TRUE about User-defined exceptions?


A. Users can explicitly raise an exception by using a RAISE statement
B. RAISE_APPLICATION_ERROR can be used to raise a user-defined exception explicitly
C. both 1 and 2
D. None of the above
Correct Answer : C

Q81. Choose the correct option.

What is the syntax of User-defined exceptions?


A. DECLARE my-exception EXCEPTION;
B. DECLARE EXCEPTION;
C. DECLARE my-exception;
D. EXCEPTION;
Correct Answer : A
Q82. Choose the correct option.

The format for compound statement is


A. Begin ……. end
B. Begin atomic……. end
C. Begin ……. repeat
D. Both Begin ……. end and Begin atomic……. end
Correct Answer : D

Q83. Choose the correct option.

In a multi-user DBMS, which ACID property ensures that concurrent execution of


transactions does not result in data corruption or inconsistencies?
A. Atomicity
B. Consistency
C. Isolation
D. Durability
Correct Answer : C

Q84. Choose the correct option.

Consider a sales database with a sales (order_id | order_date | customer_id |


total_amount) Customer customer_id | customer_name) table. You want to find the average unit
price for each product. What SQL query should you use?
A. SELECT AVG(unit_price) FROM sales;
B. SELECT product_id, AVG(unit_price) FROM sales GROUP BY product_id;
C. SELECT AVG(unit_price) FROM sales GROUP BY product_id;
D. SELECT product_id, AVG(quantity * unit_price) FROM sales GROUP BY product_id;
Correct Answer : B

Q85. Choose the correct option.

Which ACID property ensures that a transaction, once completed, brings the database
from one consistent state to another?
A. Atomicity
B. Consistency
C. Isolation
D. Durability
Correct Answer : B

Q86. Choose the correct option.

Which of the following scenarios demonstrates a violation of the "Atomicity" property in


ACID?
A. A transaction successfully transferring funds from one account to another
B. A transaction partially completing and leaving the database in an inconsistent state
C. A transaction successfully updating multiple rows in a table
D. A transaction successfully committing its changes to the database
Correct Answer : B

Q87. Choose the correct option.

Which ACID property ensures that concurrent transactions do not interfere with each
other, preserving transaction integrity?
A. Durability
B. Isolation
C. Consistency
D. Atomicity
Correct Answer : B

Q88. Choose the correct option.

Consider an orders database with an orders (order_id | order_date | customer_id |


total_amount) table. You need to retrieve the orders that were placed in the first quarter of 2023
(January to March). What SQL query should you use?
A. SELECT * FROM orders WHERE EXTRACT(QUARTER FROM order_date) = 1 AND
EXTRACT(YEAR FROM order_date) = 2023;
B. SELECT * FROM orders WHERE DATEPART(QUARTER, order_date) = 1 AND
DATEPART(YEAR, order_date) = 2023;
C. SELECT * FROM orders WHERE DATEPART(QUARTER, order_date) = 1 AND
YEAR(order_date) = 2023;
D. SELECT * FROM orders WHERE EXTRACT(MONTH FROM order_date) BETWEEN 1 AND
3 AND EXTRACT(YEAR FROM order_date) = 2023;
Correct Answer : D

Q89. Choose the correct option.

What is the primary purpose of a stored procedure in DBMS?


A. To store and organize data in a database
B. To retrieve data from the database
C. To define the structure of the database
D. To encapsulate a series of database operations
Correct Answer : D

Q90. Choose the correct option.

Which of the following statements is true about stored procedures?


A. Stored procedures cannot have input parameters
B. Stored procedures cannot return values
C. Stored procedures can be reused and shared by multiple applications
D. Stored procedures can only be executed by the database administrator
Correct Answer : C

Q91. Choose the correct option.

Which component of a package in DBMS defines the interface and public entities?
A. Package body
B. Package Signature
C. Package Constructor
D. Package specification
Correct Answer : D

Q92. Choose the correct option.

When talking about ACID properties, what does "Atomicity" mean?


A. The ability to execute transactions in any order.
B. The ability to undo a transaction if it fails.
C. The property that ensures all or none of a transaction's operations are executed.
D. The property that ensures a transaction is executed only if it maintains data
consistency.
Correct Answer : C

Q93. Choose the correct option.

Triggers can be defined on the?

A. table
B. view
C. schema
D. All of the above
Correct Answer : D

Q94. Choose the correct option.

Which of the following is a key goal of recovery techniques in DBMS?


A. Maximizing system performance
B. Ensuring data confidentiality
C. Ensuring data consistency and availability
D. Minimizing storage space usage
Correct Answer : C

Q95. Choose the correct option.

Which of the following is not a concurrency control mechanism in DBMS?


A. Locking
B. Timestamp ordering
C. Multiversion concurrency control
D. Rollback and recovery
Correct Answer : D
Q96. Choose the correct option.

Consider an employee database with two tables: employees (emp_id | emp_name |


emp_salary | dep_id) and departments (dep_id | dep_name). How can you find the employees
who earn more than the average salary in their respective departments?
A. SELECT emp_name FROM employees WHERE emp_salary > (SELECT AVG(emp_salary)
FROM employees GROUP BY dep_id);
B. SELECT emp_name FROM employees WHERE emp_salary > (SELECT AVG(emp_salary)
FROM employees WHERE employees.dep_id = dep_id);
C. SELECT emp_name FROM employees WHERE emp_salary > (SELECT AVG(emp_salary)
FROM employees GROUP BY dep_id HAVING employees.dep_id = dep_id);
D. SELECT emp_name FROM employees WHERE emp_salary > (SELECT AVG(emp_salary)
FROM employees GROUP BY dep_id HAVING employees.emp_id = emp_id);
Correct Answer : B

Q97. Choose the correct option.

What is the purpose of a transaction log in recovery mechanisms?


A. To record all completed transactions for auditing purposes
B. To store the current state of the database
C. To maintain a record of all executed SQL statements
D. To facilitate database recovery in case of failures
Correct Answer : D

Q98. Choose the correct option.

Which ACID property ensures that a database remains in a consistent state before and
after a transaction?
A. Durability
B. Isolation
C. Consistency
D. Atomicity
Correct Answer : C
Q99. Choose the correct option.

Packages are schema objects that groups logically related PL/SQL types, variables, and
subprograms.

A. Yes
B. No
C. Can be yes or no
D. none of the above
Correct Answer : C

Q100. Choose the correct option.

Which recovery technique in DBMS involves periodically saving a copy of the entire
database to a separate storage location?
A. Checkpoints
B. Shadow Paging
C. Write-Ahead Logging
D. Database Backup
Correct Answer : D

Q101. Choose the correct option.

Which of the following is NOT an Oracle-supported trigger?


A. BEFORE
B. DURING
C. AFTER
D. INSTEAD OF
Correct Answer : B

Q102. Choose the correct option.

Which of the following is used to input the entry and give the result in a variable in a
procedure?
A. Put and get
B. Get and put
C. Out and In
D. In and out
Correct Answer : D

Q103. Choose the correct option.

Create procedure dept_count proc(in dept name varchar(20),


out d count integer)
begin
select count(*) into d count
from instructor
where instructor.dept name= dept count proc.dept name
end
Which of the following is used to call the procedure given above ?
A. Declare d_count integer;
B. Declare d_count integer;
call dept_count proc(’Physics’, d_count);

C. Declare d_count integer;


call dept_count proc(’Physics’);
D. Declare d_count;
call dept_count proc(’Physics’, d_count);
Correct Answer : B

Q104. Choose the correct option.

Repeat
sequence of statements;
__________________
end repeat
Fill in the correct option :
A. While Condition
B. Until variable
C. Until boolean expression
D. Until 0
Correct Answer : C
Q105. Choose the correct option.

Which package lets PL/SQL programs read and write operating system (OS) text files?
A. UTL_HTTP
B. UTL_FILE
C. UTL_SMTP
D. UTL_FMT
Correct Answer : B

Q106. Choose the correct option.

The package specification is the interface to the package.


A. TRUE
B. FALSE
C. Nither TRUE NOR FALSE
D. none of the above
Correct Answer : A

Q107. Choose the correct option.

A _________ consists of a sequence of query and/or update statements.


A. Transaction
B. Commit
C. Rollback
D. Flashback
Correct Answer : A

Q108. Choose the correct option.

The property of a schedule that states that the result of executing concurrent transactions
is the same as executing them serially is known as:
A. Consistency
B. Atomicity
C. Serializability
D. Durability
Correct Answer : C

Q109. Choose the correct option.

Consider a sales database with two tables: sales (sale_id | sale_date | product_id |
quantity | unit_price) and products (product_id | product_name | category). You need to retrieve
the sale details for products that have been sold more than the average
A. SELECT * FROM sales WHERE product_id IN (SELECT product_id FROM sales HAVING
AVG(quantity) < quantity);
B. SELECT * FROM sales WHERE quantity > (SELECT AVG(quantity) FROM sales);
C. SELECT * FROM sales WHERE product_id IN (SELECT product_id FROM sales WHERE
AVG(quantity) < quantity);
D. SELECT * FROM sales WHERE product_id IN (SELECT product_id FROM sales HAVING
quantity > AVG(quantity));
Correct Answer : B

Q110. Choose the correct option.

Consider an orders database with an orders (order_id | order_date | customer_id |


total_amount) table. You want to calculate the total amount of orders placed by each customer
and rank them in descending order of total amount. What SQL query should you us
A. SELECT customer_id, SUM(total_amount) AS total_orders FROM orders GROUP BY
customer_id ORDER BY total_orders DESC;
B. SELECT customer_id, SUM(total_amount) AS total_orders FROM orders GROUP BY
customer_id HAVING total_orders > (SELECT AVG(total_amount) FROM orders);
C. SELECT customer_id, SUM(total_amount) AS total_orders FROM orders GROUP BY
customer_id HAVING total_orders > (SELECT AVG(total_amount) FROM orders GROUP BY
customer_id);
D. SELECT customer_id, SUM(total_amount) AS total_orders FROM orders GROUP BY
customer_id ORDER BY SUM(total_amount) DESC;
Correct Answer : A

Q111. Choose the correct option.

Which of the following is not a type of trigger in DBMS?


A. Insert trigger
B. Update trigger
C. Delete trigger
D. Search trigger
Correct Answer : D

Q112. Choose the correct option.

Consider an employee database with a employees (emp_id | emp_name | emp_salary |


hire_date) table. You want to retrieve a list of employees who have been with the company for at
least three years. What SQL query should you use?
A. SELECT emp_name FROM employees WHERE DATEDIFF(CURDATE(), hire_date) >=
1095;
B. SELECT emp_name FROM employees WHERE TIMESTAMPDIFF(YEAR, hire_date,
CURDATE()) >= 3;
C. SELECT emp_name FROM employees WHERE DATEDIFF(hire_date, CURDATE()) >= -
1095;
D. SELECT emp_name FROM employees WHERE CURDATE() - hire_date >= INTERVAL '3'
YEAR;
Correct Answer : B

Q113. Choose the correct option.

Consider a sales database with two tables: sales (sale_id | sale_date | product_id |
quantity | unit_price) and products (product_id | product_name | category). Consider a student
database with a students table. You want to retrieve the names of students
A. SELECT student_name FROM students WHERE student_id IN (SELECT student_id FROM
grades WHERE grade = 'A' GROUP BY student_id HAVING COUNT(DISTINCT course) =
(SELECT COUNT(DISTINCT course) FROM grades));
B. SELECT student_name FROM students WHERE student_id IN (SELECT student_id FROM
grades WHERE grade = 'A' GROUP BY student_id HAVING COUNT(DISTINCT course) =
(SELECT COUNT(DISTINCT course) FROM grades WHERE grades.grade = 'A'));
C. SELECT student_name FROM students WHERE student_id IN (SELECT student_id FROM
grades WHERE grade = 'A' GROUP BY student_id HAVING COUNT(course) = (SELECT
COUNT(DISTINCT course) FROM grades));
D. SELECT student_name FROM students WHERE student_id IN (SELECT student_id FROM
grades WHERE grade = 'A' GROUP BY student_id HAVING COUNT(course) = (SELECT
COUNT(course) FROM grades WHERE grades.grade = 'A'));
Correct Answer : B

Q114. Choose the correct option.

In a DBMS, what is the role of a checkpoint in the recovery process?


A. To recover data from backups
B. To record all transactions in the transaction log
C. To establish a known, consistent state of the database
D. To lock the database to prevent unauthorized access
Correct Answer : C

Q115. Choose the correct option.

Consider an employee database with two tables: employees (emp_id | emp_name |


emp_salary | dep_id) and departments (dep_id | dep_name). You need to retrieve a list of
departments with the highest-paid employee's name in each department. What SQL query sho
A. SELECT dep_name, MAX(emp_salary) FROM employees JOIN departments ON
employees.dep_id = departments.dep_id GROUP BY dep_name;
B. SELECT dep_name, emp_name FROM employees JOIN departments ON
employees.dep_id = departments.dep_id WHERE emp_salary = (SELECT MAX(emp_salary)
FROM employees);
C. SELECT dep_name, emp_name FROM employees WHERE emp_salary = (SELECT
MAX(emp_salary) FROM employees) GROUP BY dep_name;
D. SELECT dep_name, MAX(emp_salary) FROM employees WHERE emp_salary = (SELECT
MAX(emp_salary) FROM employees) GROUP BY dep_name;
Correct Answer : B

Q116. Choose the correct option.

Which recovery technique allows a DBMS to recover from a failure without requiring
redoing all committed transactions?
A. Immediate Database Backup
B. Deferred Database Backup
C. Write-Ahead Logging
D. Checkpoints
Correct Answer : C

Q117. Choose the correct option.

A transaction that violates the consistency property is considered+D33 to be:


A. Data integrity
B. High availability
C. Data consistency
D. Data durablity
Correct Answer : B

Q118. Choose the correct option.

Which of the following describes the ACID properties of transactions?


A. Atomicity, Consistency, Isolation, Durability
B. Atomicity, Consistency, Isolation, Dileang
C. Atomicity, Consistency, Isolate, Durability
D. Atomic, Consistency, Isolation, Durability
Correct Answer : A

Q119. Choose the correct option.

A transaction that violates the consistency property is considered to be:


A. Serializable
B. Inconsistent
C. Isolate
D. Error
Correct Answer : B

Q120. Choose the correct option.


Which isolation level allows only committed data to be read?
A. Read Uncommitted
B. Read committed
C. Serializable
D. Read Update
Correct Answer : B

Q121. Choose the correct option.

Consider an employee database with two tables: employees (emp_id | emp_name |


emp_salary | dep_id) and departments(dep_id | dep_name). You want to retrieve a list of
employees who earn more than the average salary of employees in the same department. What
A. SELECT emp_name FROM employees WHERE emp_salary > (SELECT AVG(emp_salary)
FROM employees GROUP BY dep_id);
B. SELECT emp_name FROM employees WHERE emp_salary > (SELECT AVG(emp_salary)
FROM employees WHERE employees.dep_id = dep_id);
C. SELECT emp_name FROM employees WHERE emp_salary > (SELECT AVG(emp_salary)
FROM employees GROUP BY dep_id HAVING emp_id = emp_id);
D. SELECT emp_name FROM employees WHERE emp_salary > (SELECT AVG(emp_salary)
FROM employees HAVING dep_id = dep_id);
Correct Answer : C

Q122. Choose the correct option.

Consider an order database with two tables: orders and customers. You need to retrieve a
list of customers who have placed orders in February 2023. What SQL query should you use?
A. SELECT customer_name FROM customers WHERE customer_id IN (SELECT customer_id
FROM orders WHERE order_date BETWEEN '2023-02-01' AND '2023-02-28');
B. SELECT customer_name FROM customers JOIN orders ON customers.customer_id =
orders.customer_id WHERE order_date BETWEEN '2023-02-01' AND '2023-02-28';
C. SELECT customer_name FROM customers JOIN orders ON customers.customer_id =
orders.customer_id WHERE order_date = '2023-02-15';
D. SELECT customer_name FROM customers WHERE customer_id IN (SELECT customer_id
FROM orders WHERE order_date = '2023-02-15');
Correct Answer : B
Q123. Choose the correct option.

Which type of entity represents a logical generalization whose actual occurrence is


represented by a second, associated entity
A. Supertype entity
B. Subtype entity
C. Archetype entity
D. Instance entity
Correct Answer : C

Q124. Choose the correct option.

The relationship associating the weak entity sets with specific strong entity set is called as
A. Identifying relationship
B. Connecting relationship
C. Completing relationship
D. Unique relationship
Correct Answer : A

Q125. Choose the correct option.

Which of the following is an example of a multi-valued dependency


A. A -> B, C
B. A -> B, A -> C
C. A -> B, D
D. A -> B, B -> C
Correct Answer : C

Q126. Choose the correct option.

In the context of functional dependencies, what is a superkey?


A. A key that uniquely identifies a tuple in a relation
B. A key that includes all attributes in a relation
C. A key that is a candidate key
D. A key that is used to define all weak entities in a table
Correct Answer : B

Q127. Choose the correct option.

Which of the following is not a step in the normalization process?


A. Identifying functional dependencies
B. Removing duplicate records
C. Creating new tables
D. Reorganizing data to minimize redundancy
Correct Answer : B

Q128. Choose the correct option.

In second normal form (2NF), what condition must be met?


A. All attributes must be atomic
B. There should be no partial functional dependencies.
C. There should be no transitive functional dependencies.
D. All of the above
Correct Answer : B

Q129. Choose the correct option.

What is a conflict-serializable schedule in DBMS?


A. A schedule where transactions never conflict with each other.
B. A schedule where transactions cannot be serialized.
C. A schedule where transactions can conflict but are still serializable.
D. A schedule where transactions are executed in parallel.
Correct Answer : C

Q130. Choose the correct option.

Which algorithm is commonly used to test for conflict serializability in a schedule?


A. Two-Phase Locking (2PL)
B. Wait-Die
C. Wound-Wait
D. Transaction Precedence Graph (TPG)
Correct Answer : D

Q131. Choose the correct option.

Which of the following represents a conflict between two transactions in a schedule?


A. T1 reads a data item X, and T2 reads X
B. T1 reads a data item X, and T2 writes X.
C. T1 writes a data item X, and T2 writes X
D. T1 writes a data item X, and T2 reads X
Correct Answer : B

Q132. Choose the correct option.

Which ACID property ensures that a transaction is either fully completed or fully undone?
A. Durability
B. Isolation
C. Consistency
D. Atomicity
Correct Answer : D

Q133. Choose the correct option.

Consistency in ACID ensures that:


A. Transactions can be undone if needed.
B. Changes made by one transaction are not visible to other transactions.
C. The database remains in a valid state before and after transactions.
D. Transactions can be isolated from each other.
Correct Answer : C
Q134. Choose the correct option.

Consider a student database with a students (student_id | student_name | major) table


and a grades (grade_id | student_id | course | grade) table. What SQL query would you use to
count the number of students majoring in each subject?
A. SELECT COUNT(student_id) FROM students GROUP BY major;
B. SELECT major, COUNT(student_id) FROM students GROUP BY major;
C. SELECT COUNT(student_name) FROM students GROUP BY major;
D. SELECT major, COUNT(*) FROM students GROUP BY student_id;
Correct Answer : B

Q135. Choose the correct option.

A _________ consists of a sequence of query and/or update statements.


A. Transaction
B. Commit
C. Rollback
D. Flashback
Correct Answer : A

Q136. Choose the correct option.

Which of the following makes the transaction permanent in the database?


A. View
B. Commit
C. Rollback
D. Flashback
Correct Answer : B

Q137. Choose the correct option.

In order to undo the work of transaction after last commit which one should be used?
A. View
B. Commit
C. Rollback
D. Flashback
Correct Answer : C

Q138. Choose the correct option.

PL/SQL supports programmers to catch such conditions using ________ block in the
program
A. Try
B. Throw
C. Catch
D. Exception
Correct Answer : D

Q139. Choose the correct option.

What does ACID stand for in the context of database transactions?


A. All Commands for Integrated Databases
B. Advanced Concurrent Information Database
C. All Concurrent Items Database
D. Atomicity, Consistency, Isolation, Durability
Correct Answer : D

Q140. Choose the correct option.

Isolation in ACID ensures that:


A. Transactions are permanent and cannot be undone.
B. Transactions do not interfere with each other, and each transaction is unaware of
others.
C. Transactions can be rolled back if they fail.
D. Transactions are executed serially to maintain consistency.
Correct Answer : B

Q141. Choose the correct option.


Which level of isolation ensures that transactions are completely isolated from each other,
providing the highest level of data integrity?
A. Serializable
B. Repeatable Read
C. Read Committed
D. Read Uncommitted
Correct Answer : A

Q142. Choose the correct option.

Durability in ACID ensures that:


A. Transactions are isolated from each other.
B. Transactions can be rolled back if needed.
C. Changes made by a committed transaction are permanent and survive subsequent
failures.
D. Transactions are executed quickly.
Correct Answer : C

Q143. Choose the correct option.

What is a 'redo log' in the context of database recovery?


A. A log that records changes made by transactions
B. A log that records the original state of the database
C. A log that records only committed transactions
D. A log that helps in reapplying changes during recovery
Correct Answer : D

Q144. Choose the correct option.

Which of the following statements about ACID properties is true?


A. ACID properties are important only for small-scale databases.
B. ACID properties are primarily concerned with improving query performance.
C. ACID properties guarantee the correctness and reliability of transactions in a database.
D. ACID properties are only applicable to read operations.
Correct Answer : C
Q145. Choose the correct option.

In the context of database recovery, what does "roll forward" mean?


A. To restore the database from a backup
B. To apply changes made by committed transactions from the redo log
C. To undo the changes made by uncommitted transactions
D. To revert the database to its initial state
Correct Answer : B

Q146. Choose the correct option.

Which of the following is a trivial functional dependency?


A. A → B
B. A → A
C. A → BC
D. AB→ C
Correct Answer : B

Q147. Choose the correct option.

Consider a student database with a students (student_id | student_name | major) table


and a grades (grade_id | student_id | course | grade) table. You want to find the highest grade
obtained by each student. What SQL query should you use?
A. SELECT student_name, MAX(grade) FROM students JOIN grades ON
students.student_id = grades.student_id GROUP BY student_name;
B. SELECT student_id, MAX(grade) FROM grades GROUP BY student_id;
C. SELECT student_id, MAX(grade) FROM students JOIN grades ON students.student_id =
grades.student_id GROUP BY student_id;
D. SELECT student_name, MAX(grade) FROM grades GROUP BY student_name;
Correct Answer : B

Q148. Choose the correct option.


In which normal form is a relation that has no partial dependencies?
A. 1NF
B. 2NF
C. 3NF
D. BCNF
Correct Answer : C

Q149. Choose the correct option.

In the context of ACID properties, what does the acronym "ACID" stand for?
A. Atomicity, Cohesion, Isolation, Durability
B. Atomicity, Consistency, Isolation, Durability
C. Atomicity, Correctness, Isolation, Durability
D. Atomicity, Consistency, Isolation, Downtime
Correct Answer : B

Q150. Choose the correct option.

Which normal form eliminates transitive dependencies?


A. 1NF
B. 2NF
C. 3NF
D. BCNF
Correct Answer : C

Q151. Choose the correct option.

Which of the following recovery techniques allows the database to be restored to a specific
point in time by applying both redo and undo operations?
A. Write-Ahead Logging
B. ARIES
C. Shadow Paging
D. Rollback
Correct Answer : B
Q152. Choose the correct option.

Which of the following is NOT a common threat to database security?


A. Unauthorized access
B. Data corruption
C. SQL injection
D. Data encryption
Correct Answer : D

Q153. Choose the correct option.

Which ACID property ensures that a transaction is treated as a single, indivisible unit of
work?
A. Atomicity
B. Consistency
C. Isolation
D. Durability
Correct Answer : A

Q154. Choose the correct option.

What is serializability in DBMS?


A. A property that guarantees a serial execution of transactions
B. A property that guarantees a concurrent execution of transactions
C. A property that guarantees a consistent execution of transactions
D. A property that guarantees isolation of transactions
Correct Answer : A

Q155. Choose the correct option.

Which of the following is a best practice for securing database backups?


A. Store backups on the same server as the live database
B. Keep backups unencrypted for easy access
C. Implement access controls and encryption for backups
D. Share backup files with external parties regularly
Correct Answer : C

Q156. Choose the correct option.

In a table with attributes A, B, and C, if A determines B and B determines C, what type of


dependency exists?
A. Functional dependency
B. Transitive dependency
C. Multivalued dependency
D. Join dependency
Correct Answer : B

Q157. Choose the correct option.

What does the "Consistency" property in ACID entail?


A. Ensuring that transactions execute in isolation from each other
B. Ensuring that data remains accurate and adheres to integrity constraints before and
after transactions
C. Ensuring that transactions are durable and can survive system failures
D. Ensuring that transactions are executed atomically
Correct Answer : B

Q158. Choose the correct option.

The main goal of serializability is to ensure:


A. High throughput of transactions
B. Low latency of transactions
C. Consistency of the database
D. Data compression
Correct Answer : C

Q159. Choose the correct option.


Which DBMS feature allows multiple transactions to work on the same data
simultaneously while maintaining data consistency?
A. Locking
B. Isolation levels
C. Concurrency control
D. Backup and recovery
Correct Answer : C

Q160. Choose the correct option.

A schedule that is conflict serializable is also guaranteed to be:


A. View serializable
B. Serializable
C. Deadlock-free
D. Non-recoverable
Correct Answer : A

Q161. Choose the correct option.

What is the primary purpose of a Write-Ahead Logging (WAL) protocol in a DBMS?


A. To improve query performance
B. To ensure data consistency during recovery
C. To maintain data integrity constraints
D. To optimize storage space usage
Correct Answer : B

Q162. Choose the correct option.

Consider a sales database with two tables: sales (sale_id | sale_date | product_id |
quantity | unit_price) and products (product_id | product_name | category). You want to retrieve
the names of products that have never been sold. What SQL query should y
A. SELECT product_name FROM products WHERE product_id NOT IN (SELECT product_id
FROM sales);
B. SELECT product_name FROM products LEFT JOIN sales ON products.product_id =
sales.product_id WHERE sale_id IS NULL;
C. SELECT product_name FROM products WHERE product_id IN (SELECT product_id
FROM sales HAVING COUNT(sale_id) = 0);
D. SELECT product_name FROM products WHERE product_id NOT EXISTS (SELECT
product_id FROM sales);
Correct Answer : A

Q163. Choose the correct option.

SQL injection attacks typically target:


A. Data confidentiality
B. Data availability
C. Data integrity
D. All of the above
Correct Answer : A

Q164. Choose the correct option.

Which of the following is the correct format for if statement?


A. If boolean expression
then statement or compound statement
elseif boolean expression
then statement or compound statement
else statement or compound statement
end if
B. If boolean expression
then statement or compound statement
elsif boolean expression
then statement or compound statement
else statement or compound statement
end if
C. If boolean expression
then statement or compound statement
elif boolean expression
then statement or compound statement
else statement or compound statement
end if
D. If boolean expression
then statement or compound statement
else
statement or compound statement
else statement or compound statement
end if
Correct Answer : A

Q165. Choose the correct option.

A stored procedure in SQL is a___________


A. Block of functions
B. Group of Transact-SQL statements compiled into a single execution plan.
C. Group of distinct SQL statements.
D. None of the mentioned
Correct Answer : B

Q166. Choose the correct option.

Temporary stored procedures are stored in _________ database.


A. Master
B. Model
C. User specific
D. Tempdb
Correct Answer : D

Q167. Choose the correct option.

Declare out of classroom seats condition


DECLARE exit handler FOR OUT OF classroom seats
BEGIN
SEQUENCE OF statements
END
The above statements are used for
A. Calling procedures
B. Handling Exception
C. Handling procedures
D. All of the mentioned
Correct Answer : B

Q168. Choose the correct option.

Which recovery technique is associated with the use of "fuzzy checkpoints" to minimize
the amount of work required during recovery?
A. Shadow Paging
B. Deferred Database Backup
C. ARIES
D. Write-Ahead Logging
Correct Answer : C

Q169. Choose the correct option.

Which isolation level in DBMS ensures serializability?


A. Read Uncommitted
B. Read Committed
C. Repeatable Read
D. Serializable
Correct Answer : D

Q170. Choose the correct option.

Which of the following is a security measure to protect against insider threats in a


database?
A. Encryption
B. Role-based access control
C. Intrusion detection system (IDS)
D. Firewalls
Correct Answer : B
Q171. Choose the correct option.

Consider a sales database with two tables: sales (sale_id | sale_date | product_id |
quantity | unit_price) and products (product_id | product_name | category). Which SQL query
should you use to find the total revenue generated from the sale of all elect
A. SELECT SUM(quantity * unit_price) FROM sales WHERE product_id IN (SELECT
product_id FROM products WHERE category = 'Electronics');
B. SELECT SUM(total_sales) FROM sales GROUP BY category HAVING category =
'Electronics';
C. SELECT SUM(quantity * unit_price) FROM sales WHERE product_id IN (SELECT
product_id FROM products WHERE category = 'Electronics');
D. SELECT SUM(total_sales) FROM sales WHERE product_id IN (SELECT product_id FROM
products WHERE category = 'Electronics');
Correct Answer : C

Q172. Choose the correct option.

To eliminate transitive dependency in a relational table, we typically:


A. Split the table into multiple smaller tables
B. Use normalization techniques like 2NF or 3NF
C. Denormalize the table for better performance
D. Ignore the transitive dependency as it is not a concern in database design
Correct Answer : B

Q173. Choose the correct option.

Which type of conflict can lead to a "dirty read" in a DBMS?


A. Write-write conflict
B. Read-write conflict
C. Write-read conflict
D. Read-read conflict
Correct Answer : C
Q174. Choose the correct option.

Which technique is commonly used to test for serializability of a schedule?


A. Two-Phase Locking
B. Preemptive Scheduling
C. Transaction Isolation Levels
D. Conflict Serializability Graph
Correct Answer : D

Q175. Choose the correct option.

Which technique is used to manage conflicts in a DBMS by locking data items to prevent
simultaneous access by multiple transactions?
A. Two-Phase Locking (2PL)
B. Multi-Version Concurrency Control (MVCC)
C. Optimistic Concurrency Control (OCC)
D. Deadlock Detection and Resolution
Correct Answer : A

Q176. Choose the correct option.

Identify the correct options on basis of given two statements:


S1: Every table with two-single valued attributes is in 1NF,2NF,3NF & BCNF.
S2: AB->C ,D->E, E->C is a minimal cover for the set of functional dependencies AB->C, D->E, AB->E,
E->C.

A. S1 is True and S2 is False


B. Both S1 & S2 are true
C. S1 is false & S2 is true
D. Both S1 & S2 are false
Correct Answer : A

Q177. Choose the correct option.

How can concurrent access to shared data lead to data inconsistency in a DBMS?
A. By preventing data updates
B. By enforcing data integrity rules
C. By allowing simultaneous updates
D. By reducing query performance
Correct Answer : C

Q178. Choose the correct option.

In a DBMS, what is the primary purpose of a database package body?


A. To define package variables
B. To provide information about the package's procedures and functions
C. To specify package triggers
D. To implement the actual code for package procedures
Correct Answer : D

Q179. Choose the correct option.

In a DBMS, what is the term for a package that only contains the package specification
without a package body?
A. A minimal package
B. A comprehensive package
C. A bodiless package
D. A complete package
Correct Answer : C

Q180. Choose the correct option.

In a DBMS, what is the typical process of developing a package?


A. Write the package body first, then the specification
B. Write the package specification first, then the body
C. Develop procedures and triggers independently of packages
D. Develop triggers before procedures
Correct Answer : B
Q181. Choose the correct option.

In a locking-based concurrency control system, what does a "lock" prevent other


transactions from doing?
A. Accessing the locked data
B. Aborting the transaction
C. Executing queries
D. Creating database triggers
Correct Answer : A

Q182. Choose the correct option.

In a multi-user DBMS, what problem can arise when transactions are executed
concurrently without control?
A. Faster data retrieval
B. Enhanced data consistency
C. Reduced code duplication
D. Increased code modularity
Correct Answer : B

Q183. Choose the correct option.

In the context of transactions, what does "serializability" mean?


A. The ability to serialize data
B. The ability to execute transactions concurrently
C. The ability to recover from failures
D. The ability to perform queries efficiently
Correct Answer : A

Q184. Choose the correct option.

What does "recoverability" encompass in the context of transactions and concurrency


control?
A. The ability to recover from system failures
B. The ability to execute transactions concurrently
C. The ability to lock database tables
D. The ability to perform efficient queries
Correct Answer : A

Q185. Choose the correct option.

What does DBA stand for in the context of databases?


A. Database Backup Administrator
B. Data Business Analyst
C. Database Architect
D. Database Administrator
Correct Answer : D

Q186. Choose the correct option.

What does the term "serializability" imply in the context of transaction execution?
A. Transactions occur in sequence
B. Transactions can execute concurrently
C. Transactions are aborted
D. Transactions are isolated
Correct Answer : A

Q187. Choose the correct option.

What does the term "transaction isolation" refer to in the context of concurrency control?
A. A transaction's lifespan
B. A transaction's ability to update data
C. A transaction's isolation level
D. A transaction's recovery
Correct Answer : C

Q188. Choose the correct option.

What is a "bodiless" package in a DBMS context?


A. A package without a body
B. A package with excessive code
C. A package with only triggers
D. A package with minimal documentation
Correct Answer : A

Q189. Choose the correct option.

What is a common drawback of "pessimistic" locking in concurrency control systems?


A. Increased code modularity
B. Reduced data consistency
C. Reduced query performance
D. Optimized query execution
Correct Answer : C

Q190. Choose the correct option.

What is a common use of a database trigger in a DBMS?


A. To define package specifications
B. To encapsulate related procedures and functions
C. To monitor and respond to database events
D. To create database packages
Correct Answer : C

Q191. Choose the correct option.

What is a package body in a DBMS?


A. A part of a package that contains package variables
B. A part of a package that specifies the package's procedures and functions
C. A part of a package that defines package triggers
D. A part of a package that implements the actual code for package procedures
Correct Answer : D

Q192. Choose the correct option.


What is one of the advantages of using procedures in a DBMS?
A. Increased code duplication
B. Slower query performance
C. Enhanced security vulnerabilities
D. Reduced code redundancy
Correct Answer : D

Q193. Choose the correct option.

What is one of the advantages of using triggers in a DBMS?


A. Increased code modularity
B. Reduced control over data changes
C. Enhanced query performance
D. Automated enforcement of data integrity rules
Correct Answer : D

Q194. Choose the correct option.

What is the ACID property that ensures that transactions are performed correctly and
completely?
A. Atomicity
B. Consistency
C. Isolation
D. Durability
Correct Answer : A

Q195. Choose the correct option.

What is the primary drawback of "optimistic" concurrency control in a DBMS?


A. Increased code modularity
B. Slower query performance
C. Risk of transaction conflicts
D. Enhanced data integrity
Correct Answer : C
Q196. Choose the correct option.

What is the primary purpose of "deadlock detection" mechanisms in a DBMS that uses
locking for concurrency control?
A. To prevent transaction conflicts
B. To optimize query performance
C. To eliminate transactions
D. To create database triggers
Correct Answer : C

Q197. Choose the correct option.

What is the primary purpose of a database package in a DBMS?


A. To define database triggers
B. To encapsulate and group related procedures, functions, and variables
C. To establish database connections
D. To optimize query performance
Correct Answer : B

Q198. Choose the correct option.

What is the primary purpose of locking in concurrency control?


A. To eliminate transactions
B. To optimize query performance
C. To manage data access
D. To create database triggers
Correct Answer : C

Q199. Choose the correct option.

What is the primary syntax for creating a trigger in a DBMS?


A. CREATE PROCEDURE
B. CREATE FUNCTION
C. CREATE TRIGGER
D. CREATE TABLE
Correct Answer : C

Q200. Choose the correct option.

What is the purpose of "recoverability" in the context of database transactions?


A. To ensure all transactions recover
B. To prevent data recovery issues
C. To recover from system failures
D. To lock database tables
Correct Answer : C

Q201. Choose the correct option.

What is the purpose of the JOIN operation in a relational database?


A. To add new records to a table
B. To remove records from a table
C. To combine data from multiple tables based on a related column
D. To modify existing records in a table
Correct Answer : C

Q202. Choose the correct option.

What is the role of a "transaction log" in a DBMS with respect to concurrency control?
A. To manage database locks
B. To record transaction history
C. To optimize query performance
D. To create database triggers
Correct Answer : B

Q203. Choose the correct option.

What is the role of a "transaction manager" in a DBMS?


A. To design the database
B. To manage database connections
C. To coordinate transaction execution
D. To create database triggers
Correct Answer : C

Q204. Choose the correct option.

What is the role of a package specification in a database package?


A. To define package variables
B. To provide information about the package's procedures and functions
C. To specify package triggers
D. To establish database connections
Correct Answer : B

Q205. Choose the correct option.

What is the typical sequence of steps for developing a package in a DBMS?


A. Develop triggers first, then procedures
B. Develop procedures and package specification simultaneously
C. Write the package specification first, then the package body
D. Write the package body first, then the specification
Correct Answer : C

Q206. Choose the correct option.

What part of a procedure in a DBMS is responsible for declaring the input and output
variables?
A. Procedure header
B. Procedure specification
C. Procedure body
D. Procedure parameters
Correct Answer : B
Q207. Choose the correct option.

What type of trigger is executed automatically after the triggering event?


A. After Trigger
B. Before Trigger
C. Instead of Trigger
D. Compound Trigger
Correct Answer : A

Q208. Choose the correct option.

Which ACID property ensures that a transaction's effects on the database are permanent?
A. Atomicity
B. Consistency
C. Isolation
D. Durability
Correct Answer : D

Q209. Choose the correct option.

Which database system component is responsible for managing transactions and ensuring
data integrity?
A. Database schema
B. Data dictionary
C. Concurrency control manager
D. Query optimizer
Correct Answer : C

Q210. Choose the correct option.

Which of the following database languages is used to define the structure and organization
of a database?
A. Data Manipulation Language (DML)
B. Data Definition Language (DDL)
C. Data Control Language (DCL)
D. Data Query Language (DQL)
Correct Answer : B

Q211. Choose the correct option.

Which of the following is an advantage of using packages in a DBMS?


A. Limited code organization
B. Increased code redundancy
C. Enhanced code isolation
D. Improved code modularity and reusability
Correct Answer : D

Q212. Choose the correct option.

Which of the following is an advantage of using procedures in a DBMS?


A. Increased code redundancy
B. Slower execution of queries
C. Improved security vulnerabilities
D. Code reusability and maintainability
Correct Answer : D

Q213. Choose the correct option.

Which of the following statements is true about First Normal Form (1NF)?
A. It allows for multivalued dependencies.
B. It allows for partial dependencies.
C. It eliminates repeating groups and ensures atomicity of data.
D. It enforces referential integrity constraints.
Correct Answer : C

Q214. Choose the correct option.

Which of the following statements is true about the Two-tier architecture?


A. It allows for better scalability than the Three-tier architecture.
B. It is easier to maintain and modify compared to the Three-tier architecture.
C. It requires less network traffic than the Three-tier architecture.
D. It provides better security and data isolation compared to the Three-tier architecture.
Correct Answer : C

Q215. Choose the correct option.

Which part of a procedure in a DBMS is responsible for specifying the operations to be


performed?
A. Procedure header
B. Procedure specification
C. Procedure body
D. Procedure parameters
Correct Answer : C

Q216. Choose the correct option.

Which property of a transaction ensures that it does not interfere with other transactions
while executing?
A. Atomicity
B. Consistency
C. Isolation
D. Durability
Correct Answer : C

Q217. Choose the correct option.

Which property of a transaction ensures that it does not interfere with other transactions
while executing?
A. Atomicity
B. Consistency
C. Isolation
D. Durability
Correct Answer : C
Q218. Choose the correct option.

Which property of a transaction ensures that the database remains in a consistent state
after transaction execution?
A. Atomicity
B. Consistency
C. Isolation
D. Durability
Correct Answer : B

Q219. Choose the correct option.

Which type of database constraint ensures that a foreign key value matches a primary key
value in another table?
A. Unique constraint
B. Primary key constraint
C. Foreign key constraint
D. Not null constraint
Correct Answer : C

Q220. Choose the correct option.

Why is "concurrency control" important in a multi-user database environment?


A. To increase query performance
B. To ensure data consistency
C. To eliminate transactions
D. To optimize database storage
Correct Answer : B

Q221. Choose the correct option.

Why is "concurrency" a concern in a multi-user DBMS environment?


A. To simplify data retrieval
B. To ensure data consistency
C. To reduce query performance
D. To create redundant data
Correct Answer : B

Q222. Choose the correct option.

Which of the following SQL statements is used to select all rows from a table?
A. SELECT * FROM table_name;
B. INSERT INTO table_name (column1, column2, ...) VALUES (value1, value2, ...);
C. UPDATE table_name SET column1 = value1, column2 = value2, ... WHERE condition;
D. DELETE FROM table_name WHERE condition;
Correct Answer : A

Q223. Choose the correct option.

Which of the following SQL statements is used to select all rows from a table where the
value of a column is equal to a specific value?
A. SELECT * FROM table_name WHERE column_name = value;
B. SELECT * FROM table_name WHERE column_name > value;
C. SELECT * FROM table_name WHERE column_name < value;
D. SELECT * FROM table_name WHERE column_name LIKE '%value%';
Correct Answer : A

Q224. Choose the correct option.

Which of the following SQL statements is used to select all rows from a table where the
value of a column is between two values?
A. SELECT * FROM table_name WHERE column_name BETWEEN value1 AND value2;
B. SELECT * FROM table_name WHERE column_name > value1 AND column_name <
value2;
C. SELECT * FROM table_name WHERE column_name >= value1 AND column_name <=
value2;
D. All of the above.
Correct Answer : D

Q225. Choose the correct option.


Which of the following SQL statements is used to join two tables?
A. SELECT column1, column2, ... FROM table1 INNER JOIN table2 ON
table1.column_name = table2.column_name;
B. SELECT column1, column2, ... FROM table1 LEFT JOIN table2 ON table1.column_name
= table2.column_name;
C. SELECT column1, column2, ... FROM table1 RIGHT JOIN table2 ON table1.column_name
= table2.column_name;
D. All of the above.
Correct Answer : D

Q226. Choose the correct option.

What is the database management system (DBMS)?


A. A software program used to store and manage data
B. A computer system used to store and manage data
C. A database itself
D. None of the above
Correct Answer : A

Q227. Choose the correct option.

What are the main functions of a DBMS?


A. To store and manage data
B. To provide access to data
C. To protect data
D. All of the above
Correct Answer : D

Q228. Choose the correct option.

Which of the following is an example of a DBMS?


A. MySQL
B. PostgreSQL
C. Oracle Database
D. All of the above
Correct Answer : D

Q229. Choose the correct option.

What is the primary key of a table in a relational database?


A. A unique column that identifies each row in the table
B. A column that is used to join the table with other tables
C. A column that contains the most important information about each row in the table
D. All of the above
Correct Answer : A

Q230. Choose the correct option.

Which of the following is a valid functional dependency in the following table?


A. EmployeeID -> Name
B. DepartmentID -> Name
C. Salary -> DepartmentID
D. Salary -> EmployeeID
Correct Answer : A

Q231. Choose the correct option.

Which of the following is a partial dependency in the following table?


A. OrderID -> CustomerID
B. OrderID -> ProductID
C. ProductID -> Quantity
D. Quantity -> OrderID
Correct Answer : D

Q232. Choose the correct option.

Which of the following is a transitive dependency in the following table?


A. CourseID -> CourseName
B. CourseID -> DepartmentID
C. DepartmentID -> CourseName
D. DepartmentID -> CourseID
Correct Answer : B

Q233. Choose the correct option.

Which of the following normal forms eliminates all partial and transitive dependencies?
A. First normal form (1NF)
B. Second normal form (2NF)
C. Third normal form (3NF)
D. Boyce-Codd normal form (BCNF)
Correct Answer : D

Q234. Choose the correct option.

Which of the following SQL statements is used to group rows and count the number of
rows in each group?
A. SELECT column_name, COUNT(*) AS count FROM table_name GROUP BY
column_name;
B. SELECT column_name, COUNT() AS count FROM table_name HAVING COUNT() > 1;
C. SELECT column_name, COUNT(*) AS count FROM table_name ORDER BY count DESC;
D. All of the above.
Correct Answer : A

Q235. Choose the correct option.

Which of the following SQL statements is used to order rows in a table?


A. SELECT * FROM table_name ORDER BY column_name ASC;
B. SELECT * FROM table_name ORDER BY column_name DESC;
C. SELECT * FROM table_name ORDER BY column_name, column_name2;
D. All of the above.
Correct Answer : D
Q236. Choose the correct option.

Which of the following SQL statements is used to insert a new row into a table?
A. INSERT INTO table_name (column1, column2, ...) VALUES (value1, value2, ...);
B. UPDATE table_name SET column1 = value1, column2 = value2, ... WHERE condition;
C. DELETE FROM table_name WHERE condition;
D. None of the above.
Correct Answer : A

Q237. Choose the correct option.

Which of the following SQL statements is used to update a row in a table?


A. INSERT INTO table_name (column1, column2, ...) VALUES (value1, value2, ...);
B. UPDATE table_name SET column1 = value1, column2 = value2, ... WHERE condition;
C. DELETE FROM table_name WHERE condition;
D. None of the above.
Correct Answer : B

Q238. Choose the correct option.

Which of the following is NOT a type of database security attack?


A. SQL injection
B. Cross-site scripting (XSS)
C. Denial-of-service (DoS) attack
D. Man-in-the-middle attack
Correct Answer : A

Q239. Choose the correct option.

Which of the following is a tool that can be used to monitor database activity for
suspicious behavior?
A. Intrusion detection system (IDS)
B. Security information and event management (SIEM) system
C. Database auditing tool
D. All of the above.
Correct Answer : D

Q240. Choose the correct option.

Which of the following is a best practice for protecting data in transit between a database
and a client application?
A. Use a secure connection protocol, such as TLS.
B. Encrypt the data in transit.
C. Both (A) and (B).
D. None of the above.
Correct Answer : C

Q241. Choose the correct option.

Which of the following is NOT a control structure in DBMS?


A. IF-ELSE
B. CASE
C. LOOP
D. TRANSACTION
Correct Answer : D

Q242. Choose the correct option.

Which control structure is used to execute a block of code repeatedly until a certain
condition is met?
A. IF-ELSE
B. CASE
C. LOOP
D. TRANSACTION
Correct Answer : C

Q243. Choose the correct option.

Which control structure is used to execute a different block of code depending on the value
of a variable?
A. IF-ELSE
B. CASE
C. LOOP
D. TRANSACTION
Correct Answer : A

Q244. Choose the correct option.

Which control structure is used to group a set of statements together and execute them as
a single unit?
A. IF-ELSE
B. CASE
C. BLOCK
D. TRANSACTION
Correct Answer : C

Q245. Choose the correct option.

Which control structure is used to start a database transaction?


A. BEGIN TRANSACTION
B. COMMIT TRANSACTION
C. ROLLBACK TRANSACTION
D. TRANSACTION
Correct Answer : A

Q246. Choose the correct option.

What is a package in PL/SQL?


A. A collection of related PL/SQL objects
B. A stored procedure
C. A trigger
D. A variable
Correct Answer : A
Q247. Choose the correct option.

What is the difference between a procedure and a function in PL/SQL?


A. A procedure performs a specific task, but does not return a value, while a function
performs a specific task and returns a value.
B. A procedure is a named block of PL/SQL code, while a function is a block of PL/SQL
code that is not named.
C. A procedure is a stored procedure, while a function is a user-defined function.
D. A procedure is a trigger, while a function is a PL/SQL block.
Correct Answer : A

Q248. Choose the correct option.

What is a trigger in PL/SQL?


A. A trigger is a PL/SQL block that is automatically executed when a specific event occurs
on a database table.
B. A trigger is a stored procedure that is manually executed by a user.
C. A trigger is a user-defined function that is used to perform calculations on data.
D. A trigger is a database object that is used to store data.
Correct Answer : A

Q249. Choose the correct option.

Which of the following is a benefit of using packages in PL/SQL?


A. Packages can be used to encapsulate related PL/SQL objects.
B. Packages can be used to improve the performance of PL/SQL code.
C. Packages can be used to make PL/SQL code more secure.
D. All of the above.
Correct Answer : A

Q250. Choose the correct option.

Which of the following is a disadvantage of using triggers in PL/SQL?


A. Triggers can make code more complex and difficult to troubleshoot.
B. Triggers can reduce the performance of database operations.
C. Triggers can make database operations more vulnerable to errors.
D. All of the above.
Correct Answer : A

Q251. Choose the correct option.

What is the purpose of a transaction in DBMS?


A. To ensure the ACID properties of data.
B. To improve the performance of database operations.
C. To make database operations more secure.
D. All of the above.
Correct Answer : A

Q252. Choose the correct option.

What are the four ACID properties of a transaction?


A. Atomicity, Consistency, Isolation, and Durability.
B. Accuracy, Completeness, Integrity, and Durability.
C. Availability, Correctness, Isolation, and Durability.
D. Atomicity, Consistency, Isolation, and Efficiency.
Correct Answer : A

Q253. Choose the correct option.

What is the purpose of concurrency control in DBMS?


A. To ensure that concurrent transactions are executed correctly and do not interfere with
each other.
B. To improve the performance of concurrent transactions.
C. To make concurrent transactions more secure.
D. All of the above.
Correct Answer : A

Q254. Choose the correct option.


What is a subquery in SQL?
A. A query that retrieves data from multiple tables
B. A query that performs calculations on numerical data
C. A query nested inside another query
D. A query that updates existing data in a table
Correct Answer : C

Q255. Choose the correct option.

What happens if a subquery returns more than one row and is used with a single-row
comparison operator?
A. SQL error occurs
B. The subquery result is compared with the first row only
C. The subquery result is compared with all the rows, and an error occurs
D. The subquery result is compared with all the rows, and the query executes successfully
if there is a match
Correct Answer : A

Q256. Choose the correct option.

Which type of subquery does not depend on the outer query for its values?
A. Correlated Subquery
B. Scalar Subquery
C. Nested Subquery
D. Non-correlated Subquery
Correct Answer : D

Q257. Choose the correct option.

What keyword is used to introduce a subquery in SQL?


A. FROM
B. WHERE
C. SELECT
D. JOIN
Correct Answer : C

Q258. Choose the correct option.

What is the primary function of the Data Dictionary in a DBMS architecture?


A. Stores actual data records
B. Stores metadata about database objects
C. Executes SQL queries
D. Manages database transactions
Correct Answer : B

Q259. Choose the correct option.

Which component of DBMS architecture is responsible for managing concurrent access to


the database?
A. Query Optimizer
B. Buffer Manager
C. Concurrency Control
D. Transaction Manager
Correct Answer : C

Q260. Choose the correct option.

What does the Query Optimizer do in a DBMS architecture?


A. Manages data storage on disk
B. Translates SQL queries into execution plans
C. Ensures data consistency and integrity
D. Handles user authentication and authorization
Correct Answer : B

Q261. Choose the correct option.

In the context of DBMS architecture, what is the purpose of the Buffer Manager?
A. Manages database security
B. Manages storage and retrieval of data pages in memory
C. Optimizes SQL queries
D. Manages database transactions
Correct Answer : B

Q262. Choose the correct option.

Which part of DBMS architecture is responsible for ensuring that transactions are executed
in a way that preserves the consistency and integrity of the database?
A. Query Processor
B. Transaction Manager
C. Concurrency Control
D. Database Administrator
Correct Answer : B

Q263. Choose the correct option.

What is a PL/SQL package?


A. A single PL/SQL block
B. A collection of related PL/SQL objects like procedures, functions, and variables
C. A database table
D. A query to retrieve data from multiple tables
Correct Answer : B

Q264. Choose the correct option.

Which keyword is used to create a package specification in PL/SQL?


A. PACKAGE BODY
B. PACKAGE
C. DECLARE PACKAGE
D. SPECIFICATION PACKAGE
Correct Answer : B
Q265. Choose the correct option.

What is the purpose of a PL/SQL procedure?


A. To define a collection of related variables
B. To perform a specific task and can return multiple values
C. To store and organize data in the database
D. To create indexes on database tables
Correct Answer : B

Q266. Choose the correct option.

In PL/SQL procedures, what is OUT parameter used for?


A. To pass values from the procedure back to the calling code
B. To specify the input values for the procedure
C. To define local variables within the procedure
D. To terminate the procedure execution
Correct Answer : A

Q267. Choose the correct option.

What is a PL/SQL trigger?


A. A database schema
B. A set of predefined SQL queries
C. A set of actions that are automatically performed when a certain event occurs on a
particular table or view
D. A type of PL/SQL package
Correct Answer : C

Q268. Choose the correct option.

What is the primary function of the Data Dictionary in a DBMS?


A. To store user data
B. To store metadata about the database
C. To store database logs
D. To store temporary data
Correct Answer : B

Q269. Choose the correct option.

Which component of DBMS is responsible for translating DML statements into low-level
instructions for the storage manager?
A. Query Optimizer
B. DDL Interpreter
C. DML Compiler
D. Query Executor
Correct Answer : C

Q270. Choose the correct option.

What is the purpose of the Buffer Manager in DBMS architecture?


A. To manage disk space
B. To manage main memory
C. To manage database security
D. To manage user access control
Correct Answer : B

Q271. Choose the correct option.

Which type of DBMS architecture allows multiple users to access the database
simultaneously without interfering with each other?
A. Single-tier architecture
B. Two-tier architecture
C. Three-tier architecture
D. Multi-tier architecture
Correct Answer : D

Q272. Choose the correct option.

In a client-server DBMS architecture, what role does the client play?


A. Stores data
B. Processes user requests and interfaces with the user
C. Manages database security
D. Optimizes queries
Correct Answer : B

Q273. Choose the correct option.

What does Data Independence in DBMS refer to?


A. Data stored in a secure location
B. Data being independent of any specific application
C. Data encrypted for transmission
D. Data being independent of the underlying physical storage
Correct Answer : D

Q274. Choose the correct option.

Which type of data independence ensures that application programs are unaffected by
changes in the conceptual schema?
A. Logical Data Independence
B. Physical Data Independence
C. Semantic Data Independence
D. Syntactic Data Independence
Correct Answer : A

Q275. Choose the correct option.

When a change in the storage structure does not affect the existing external schemas, it is
an example of:
A. Logical Data Independence
B. Physical Data Independence
C. Semantic Data Independence
D. Structural Data Independence
Correct Answer : A
Q276. Choose the correct option.

Which level of data independence deals with hiding the details of the physical storage
structure from the DBMS users?
A. Logical Data Independence
B. Physical Data Independence
C. Semantic Data Independence
D. Syntactic Data Independence
Correct Answer : B

Q277. Choose the correct option.

Why is Data Independence important in a DBMS?


A. It simplifies the implementation of security features
B. It allows for easier database replication
C. It reduces the impact of changes on higher-level schemas and applications
D. It speeds up query processing
Correct Answer : C

Q278. Choose the correct option.

What is the purpose of Referential Integrity Constraint in a relational database?


A. Ensures that primary keys are unique
B. Ensures that foreign key values match the primary key values in another table
C. Ensures that all fields in a record have values
D. Ensures that only authorized users can access certain data
Correct Answer : B

Q279. Choose the correct option.

Which type of integrity constraint ensures that a column in a database table can't have
NULL values?
A. Primary Key Constraint
B. Unique Constraint
C. NOT NULL Constraint
D. Default Constraint
Correct Answer : C

Q280. Choose the correct option.

What does the CHECK constraint in a database table allow you to do?
A. Enforce a condition on the values that can be inserted into a column
B. Enforce referential integrity between tables
C. Enforce uniqueness in a column or a combination of columns
D. Enforce that a column cannot have NULL values
Correct Answer : A

Q281. Choose the correct option.

Which integrity constraint ensures that each row in a table is uniquely identifiable?
A. Primary Key Constraint
B. Unique Constraint
C. Foreign Key Constraint
D. Check Constraint
Correct Answer : A

Q282. Choose the correct option.

What is the purpose of a Foreign Key Constraint in a relational database?


A. Ensures that a column can't have NULL values
B. Ensures that each row in a table is uniquely identifiable
C. Ensures that foreign key values match the primary key values in another table
D. Enforces a condition on the values that can be inserted into a column
Correct Answer : C

Q283. Choose the correct option.

What does a functional dependency in a relational database represent?


A. A relationship between two tables
B. A relationship between two attributes in the same table
C. A constraint between two primary keys
D. A constraint between two foreign keys
Correct Answer : B

Q284. Choose the correct option.

In functional dependencies, if attribute B is functionally dependent on attribute A, it is


denoted as:
A. A → B
B. B → A
C. A ↔ B
D. A ⊆ B
Correct Answer : B

Q285. Choose the correct option.

Which normal form ensures that there are no repeating groups and all attributes are fully
functionally dependent on the primary key?
A. First Normal Form (1NF)
B. Second Normal Form (2NF)
C. Third Normal Form (3NF)
D. Boyce-Codd Normal Form (BCNF)
Correct Answer : A

Q286. Choose the correct option.

What is the purpose of the NEW and OLD pseudo-variables in PL/SQL triggers?
A. It contains no partial dependencies
B. It contains no transitive dependencies
C. It contains no repeating groups
D. It contains no composite attributes
Correct Answer : B

Q287. Choose the correct option.


What is the purpose of decomposing a relation in the context of normalization?
A. To reduce redundancy and improve data integrity
B. To increase the size of the database
C. To speed up query processing
D. To simplify the data retrieval process
Correct Answer : A

Q288. Choose the correct option.

A relation is in BCNF if it is in 3NF and:


A. It contains no partial dependencies
B. It contains no transitive dependencies
C. It contains no repeating groups
D. It satisfies an additional constraint related to candidate keys
Correct Answer : D

Q289. Choose the correct option.

In the context of functional dependencies, what is a Full Functional Dependency (FFD)?


A. An attribute is functionally dependent on the entire primary key, not just a part of it
B. An attribute is functionally dependent on a non-prime attribute
C. An attribute is functionally dependent on a composite key
D. An attribute is functionally dependent on a superkey
Correct Answer : A

Q290. Choose the correct option.

What is a transitive dependency in a relational database?


A. An attribute is transitively related to another attribute if they share the same data type
B. An attribute is functionally dependent on another attribute, which is also functionally
dependent on a third attribute
C. An attribute is indirectly dependent on the primary key through another attribute
D. An attribute is dependent on a non-key attribute
Correct Answer : C
Q291. Choose the correct option.

What does De-Normalization in a relational database involve?


A. Converting a relation into a higher normal form
B. Introducing redundancy for the purpose of improving query performance
C. Removing duplicate records from a relation
D. Normalizing a relation into 1NF
Correct Answer : B

Q292. Choose the correct option.

In which normal form is a relation that is free from insertion, update, and deletion
anomalies?
A. First Normal Form (1NF)
B. Second Normal Form (2NF)
C. Third Normal Form (3NF)
D. Boyce-Codd Normal Form (BCNF)
Correct Answer : D

Q293. Choose the correct option.

What is the purpose of DDL (Data Definition Language) statements in a database system?
A. To manipulate data stored in the database
B. To perform queries on the database
C. To define, modify, or delete database structures
D. To control access permissions for database users
Correct Answer : C

Q294. Choose the correct option.

Which DDL statement is used to remove an existing table from the database?
A. REMOVE TABLE
B. DROP TABLE
C. DELETE TABLE
D. ERASE TABLE
Correct Answer : B

Q295. Choose the correct option.

Which DML statement is used to add new records into a table in a database?
A. ADD
B. INSERT
C. CREATE
D. UPDATE
Correct Answer : B

Q296. Choose the correct option.

What does the UPDATE statement in SQL do?


A. Deletes records from a table
B. Modifies existing records in a table
C. Adds new records to a table
D. Retrieves records from a table
Correct Answer : B

Q297. Choose the correct option.

Which DML statement is used to remove records from a table in a database?


A. REMOVE
B. ERASE
C. DELETE
D. DROP
Correct Answer : C

Q298. Choose the correct option.

In SQL, what does a JOIN operation do?


A. Combines rows from two or more tables based on a related column between them
B. Sorts the result set in ascending order
C. Filters rows based on a condition
D. Groups rows with the same values into aggregated data
Correct Answer : A

Q299. Choose the correct option.

What is a correlated subquery in SQL?


A. A subquery that is independent of the outer query
B. A subquery that references columns from the outer query
C. A subquery that always returns a single value
D. A subquery that contains aggregate functions
Correct Answer : B

Q300. Choose the correct option.

In SQL, what does the GRANT statement allow you to do?


A. Delete records from a table
B. Modify existing records in a table
C. Provide specific privileges to users or roles
D. Create new tables in the database
Correct Answer : C

Q301. Choose the correct option.

What does the term "SQL Injection" refer to in the context of database security threats?
A. Unauthorized access to a database by exploiting weak passwords
B. Malicious code inserted into SQL statements to gain unauthorized access or manipulate
data
C. Accidental deletion of important records by a database administrator
D. Data corruption due to hardware failure
Correct Answer : B
Q302. Choose the correct option.

Which of the following is a common countermeasure to mitigate the threat of data


interception during transmission?
A. Regular data backups
B. Data encryption using secure protocols (e.g., HTTPS)
C. Database normalization
D. Increasing the database server's processing power
Correct Answer : B

Q303. Choose the correct option.

What is the purpose of access control mechanisms in database security?


A. To optimize query performance
B. To prevent authorized users from accessing the database
C. To ensure that only authorized users can perform specific actions on the database
D. To increase storage space efficiency
Correct Answer : C

Q304. Choose the correct option.

What is the primary purpose of a stored procedure in a database?


A. To define a data type
B. To store and manage data
C. To encapsulate a sequence of SQL statements for reuse
D. To define a table schema
Correct Answer : C

Q305. Choose the correct option.

In PL/SQL, which parameter mode is used for passing values from a procedure back to the
caller?
A. IN
B. OUT
C. IN OUT
D. RETURN
Correct Answer : B

Q306. Choose the correct option.

What is one of the main advantages of using procedures in a database?


A. Improved data encryption
B. Enhanced query performance
C. Code reusability and modularity
D. Automatic data indexing
Correct Answer : C

Q307. Choose the correct option.

What is a transaction in the context of DBMS concurrency control?


A. A sequence of SQL statements
B. A database schema
C. A database index
D. A database table
Correct Answer : A

Q308. Choose the correct option.

Which of the following is a benefit of stored procedures regarding security and access
control?
A. Stored procedures can bypass user authentication
B. Stored procedures provide an additional layer of security by restricting direct table
access
C. Stored procedures have unlimited access to all database objects
D. Stored procedures can modify user privileges
Correct Answer : B
Q309. Choose the correct option.

Which type of trigger is automatically fired after an INSERT, UPDATE, or DELETE statement
on a table?
A. BEFORE trigger
B. AFTER trigger
C. DURING trigger
D. INSTEAD OF trigger
Correct Answer : B

Q310. Choose the correct option.

What will a subquery return if it does not find any matching rows in the database?
A. NULL
B. 0
C. Error
D. Empty string
Correct Answer : A

Q311. Choose the correct option.

Consider the following PL/SQL block:sqlBEGIN


DELETE FROM employees WHERE hire_date < SYSDATE - 365;
DBMS_OUTPUT.PUT_LINE('Old employee records deleted.');
END;
What does this PL/SQL block do?
A. Deletes all employee records.
B. Deletes employee records hired within the last year.
C. Deletes employee records hired more than a year ago.
D. Deletes employee records hired today.
Correct Answer : C

Q312. Choose the correct option.

Consider the following PL/SQL block:sqlDECLARE


v_count NUMBER;
BEGIN
SELECT COUNT(*) INTO v_count FROM orders WHERE status = 'PENDING';
IF v_count > 0 THEN
DBMS_OUTPUT.PUT_LINE('There are pending orders.');
ELSE
DBMS_OUTPUT
A. Prints the total number of orders.
B. Prints the number of pending orders.
C. Marks all orders as processed.
D. Deletes pending orders.
Correct Answer : B

Q313. Choose the correct option.

Which of the following statements is true about the Two-tier architecture?


A. It allows for better scalability than the Three-tier architecture.
B. It is easier to maintain and modify compared to the Three-tier architecture.
C. It requires less network traffic than the Three-tier architecture.
D. It provides better security and data isolation compared to the Three-tier architecture.
Correct Answer : C)

Q314. Choose the correct option.

What is the purpose of the JOIN operation in a relational database?


A. To add new records to a table
B. To remove records from a table
C. To combine data from multiple tables based on a related column
D. To modify existing records in a table
Correct Answer : C)

Q315. Choose the correct option.

Boyce-Codd Normal Form (BCNF) is an extension of which normal form?


A. First Normal Form (1NF)
B. Second Normal Form (2NF)
C. Third Normal Form (3NF)
D. Fourth Normal Form (4NF)
Correct Answer : B)

Q316. Choose the correct option.

Which type of database constraint ensures that a foreign key value matches a primary key
value in another table?
A. Unique constraint
B. Primary key constraint
C. Foreign key constraint
D. Not null constraint
Correct Answer : C)

Q317. Choose the correct option.

Which of the following is not a level of data abstraction in a database system?


A. Physical level
B. Logical level
C. External level
D. Semantic level
Correct Answer : D)

Q318. Choose the correct option.

What does DBA stand for in the context of databases?


A. Database Backup Administrator
B. Data Business Analyst
C. Database Architect
D. Database Administrator
Correct Answer : D)

Q319. Choose the correct option.

What is a database schema?


A. A collection of tables in a database
B. A diagram representing the structure of a database
C. A set of rules that define the database structure
D. A description of the database structure, including tables, fields, and relationships
Correct Answer : D)

Q320. Choose the correct option.

Which of the following statements is true about First Normal Form (1NF)?
A. It allows for multivalued dependencies.
B. It allows for partial dependencies.
C. It eliminates repeating groups and ensures atomicity of data.
D. It enforces referential integrity constraints.
Correct Answer : C)

Q321. Choose the correct option.

What is the purpose of the internal schema in a database system?


A. To define the logical view of the database for users
B. To specify the access controls and security settings for the database
C. To represent the physical storage structure of the database
D. To define the user views and queries for the database
Correct Answer : C)

Q322. Choose the correct option.

Which of the following database languages is used to define the structure and organization
of a database?
A. Data Manipulation Language (DML)
B. Data Definition Language (DDL)
C. Data Control Language (DCL)
D. Data Query Language (DQL)
Correct Answer : B)
Q323. Choose the correct option.

Which of the following is not a component of the database architecture?


A. Data warehouse
B. Data dictionary
C. Database server
D. Database client
Correct Answer : A)

Q324. Choose the correct option.

The ANSI-SPARC Architecture is based on the concept of separating the database into three
levels. Which of the following is NOT one of those levels?
A. Physical level
B. Logical level
C. External level
D. Presentation level
Correct Answer : D)

Q325. Choose the correct option.

Which of the following is a disadvantage of the Two-tier architecture?


A. Limited scalability and potential performance issues
B. Increased network traffic and latency
C. Complex application logic and maintenance
D. Lack of flexibility and extensibility
Correct Answer : A)

Q326. Choose the correct option.

What is an attribute in the context of the ER Model?


A. A table in a relational database
B. A unique identifier for an entity
C. A column or field in a table
D. A relationship between two entities
Correct Answer : C)

Q327. Choose the correct option.

What is a weak entity type in the ER Model?


A. An entity type with a composite key
B. An entity type that depends on another entity type for identification
C. An entity type that participates in a many-to-many relationship
D. An entity type that has no attributes
Correct Answer : B)

Q328. Choose the correct option.

How does the ER Model differ from the Relational Model?


A. The ER Model focuses on physical data storage, while the Relational Model focuses on
logical data organization.
B. The ER Model uses tables and relationships, while the Relational Model uses entities
and attributes.
C. The ER Model supports inheritance and polymorphism, while the Relational Model
does not.
D. The ER Model is more suitable for unstructured data, while the Relational Model is
designed for structured data.
Correct Answer : B)

Q329. Choose the correct option.

What is the result of normalizing a database?


A. Increased data redundancy
B. Decreased data integrity
C. Improved data storage efficiency
D. Reduced data access performance
Correct Answer : C)
Q330. Choose the correct option.

Which normal form requires the elimination of repeating groups and the identification of a
primary key?
A. First Normal Form (1NF)
B. Second Normal Form (2NF)
C. Third Normal Form (3NF)
D. Boyce-Codd Normal Form (BCNF)
Correct Answer : A)

Q331. Choose the correct option.

What does PL/SQL stand for?


A. Procedural Language/Structured Query Language
B. Programming Language/Structured Query Logic
C. Procedural Language/System Query Language
D. Programming Language/System Query Logic
Correct Answer : A)

Q332. Choose the correct option.

The CONTINUE statement is used to:


A. End the execution of a loop and resume with the next iteration
B. Terminate the execution of the program
C. Perform a specific action based on a condition
D. Define the structure of a function
Correct Answer : A)

Q333. Choose the correct option.

What is the purpose of a primary key in a database table?


A. To establish relationships between tables
B. To enforce data integrity constraints
C. To define the structure of a table
D. To provide a unique identifier for each row in a table
Correct Answer : D)

Q334. Choose the correct option.

Which of the following is not a component of a database system?


A. Data
B. Hardware
C. Software
D. Network
Correct Answer : a)

Q335. Choose the correct option.

Which normal form eliminates all types of functional dependencies?


A. First Normal Form (1NF)
B. Second Normal Form (2NF)
C. Third Normal Form (3NF)
D. Boyce-Codd Normal Form (BCNF)
Correct Answer : D)

Q336. Choose the correct option.

Which of the following is a characteristic of a database system?


A. Data redundancy
B. Data isolation
C. Data inconsistency
D. Data unavailability
Correct Answer : B)

Q337. Choose the correct option.

Which of the following is an example of a functional dependency?


A. A customer's name depends on their order history.
B. A product's price depends on its availability.
C. A student's grade depends on their attendance.
D. A book's author depends on its ISBN number.
Correct Answer : B)

Q338. Choose the correct option.

Which of the following is a conditional control statement?


A. FOR loop
B. WHILE loop
C. IF-ELSE statement
D. SWITCH statement
Correct Answer : C)

Q339. Choose the correct option.

What is the purpose of data normalization in a database?


A. To increase data redundancy
B. To improve data consistency
C. To simplify database queries
D. To reduce data integrity
Correct Answer : B)

Q340. Choose the correct option.

What is a database schema?


A. The physical storage structure of a database
B. A collection of related database tables
C. A graphical representation of the database structure
D. A description of the logical structure of a database
Correct Answer : D)

Q341. Choose the correct option.

What is a functional dependency in a database?


A. It represents the relationship between primary and foreign keys.
B. It determines the uniqueness of records in a table.
C. It describes the relationship between two or more attributes in a table.
D. It defines the normalization level of a database.
Correct Answer : C)

Q342. Choose the correct option.

What is a transitive dependency in a database?


A. It exists when an attribute depends on a non-key attribute.
B. It exists when an attribute depends on a part of the primary key.
C. It exists when an attribute depends on another attribute through a third attribute.
D. It exists when two attributes have a one-to-one relationship.
Correct Answer : C)

Q343. Choose the correct option.

What is the primary purpose of a database package in a DBMS?


A. To define database triggers
B. To encapsulate and group related procedures, functions, and variables
C. To establish database connections
D. To optimize query performance
Correct Answer : B)

Q344. Choose the correct option.

Which part of a procedure in a DBMS is responsible for specifying the operations to be


performed?
A. Procedure header
B. Procedure specification
C. Procedure body
D. Procedure parameters
Correct Answer : C)
Q345. Choose the correct option.

What is one of the advantages of using procedures in a DBMS?


A. Increased code duplication
B. Slower query performance
C. Enhanced security vulnerabilities
D. Reduced code redundancy
Correct Answer : D)

Q346. Choose the correct option.

What is the primary syntax for creating a trigger in a DBMS?


A. CREATE PROCEDURE
B. CREATE FUNCTION
C. CREATE TRIGGER
D. CREATE TABLE
Correct Answer : C)

Q347. Choose the correct option.

What is the role of a package specification in a database package?


A. To define package variables
B. To provide information about the package's procedures and functions
C. To specify package triggers
D. To establish database connections
Correct Answer : B)

Q348. Choose the correct option.

In a DBMS, what is the typical process of developing a package?


A. Write the package body first, then the specification
B. Write the package specification first, then the body
C. Develop procedures and triggers independently of packages
D. Develop triggers before procedures
Correct Answer : B)
Q349. Choose the correct option.

What is a "bodiless" package in a DBMS context?


A. A package without a body
B. A package with excessive code
C. A package with only triggers
D. A package with minimal documentation
Correct Answer : A)

Q350. Choose the correct option.

What is one of the advantages of using triggers in a DBMS?


A. Increased code modularity
B. Reduced control over data changes
C. Enhanced query performance
D. Automated enforcement of data integrity rules
Correct Answer : D)

Q351. Choose the correct option.

In a DBMS, what is the primary purpose of a database package body?


A. To define package variables
B. To provide information about the package's procedures and functions
C. To specify package triggers
D. To implement the actual code for package procedures
Correct Answer : D)

Q352. Choose the correct option.

What does DBA stand for in the context of databases?


A. Database Backup Administrator
B. Data Business Analyst
C. Database Architect
D. Database Administrator
Correct Answer : D)

Q353. Choose the correct option.

What part of a procedure in a DBMS is responsible for declaring the input and output
variables?
A. Procedure header
B. Procedure specification
C. Procedure body
D. Procedure parameters
Correct Answer : B)

Q354. Choose the correct option.

Which of the following is an advantage of using procedures in a DBMS?


A. Increased code redundancy
B. Slower execution of queries
C. Improved security vulnerabilities
D. Code reusability and maintainability
Correct Answer : D)

Q355. Choose the correct option.

What type of trigger is executed automatically after the triggering event?


A. After Trigger
B. Before Trigger
C. Instead of Trigger
D. Compound Trigger
Correct Answer : A)

Q356. Choose the correct option.

What is the purpose of the JOIN operation in a relational database?


A. To add new records to a table
B. To remove records from a table
C. To combine data from multiple tables based on a related column
D. To modify existing records in a table
Correct Answer : C)

Q357. Choose the correct option.

What is a package body in a DBMS?


A. A part of a package that contains package variables
B. A part of a package that specifies the package's procedures and functions
C. A part of a package that defines package triggers
D. A part of a package that implements the actual code for package procedures
Correct Answer : D)

Q358. Choose the correct option.

What is the typical sequence of steps for developing a package in a DBMS?


A. Develop triggers first, then procedures
B. Develop procedures and package specification simultaneously
C. Write the package specification first, then the package body
D. Write the package body first, then the specification
Correct Answer : C)

Q359. Choose the correct option.

In a DBMS, what is the term for a package that only contains the package specification
without a package body?
A. A minimal package
B. A comprehensive package
C. A bodiless package
D. A complete package
Correct Answer : C)
Q360. Choose the correct option.

Which of the following is an advantage of using packages in a DBMS?


A. Limited code organization
B. Increased code redundancy
C. Enhanced code isolation
D. Improved code modularity and reusability
Correct Answer : D)

Q361. Choose the correct option.

What is a common use of a database trigger in a DBMS?


A. To define package specifications
B. To encapsulate related procedures and functions
C. To monitor and respond to database events
D. To create database packages
Correct Answer : C)

Q362. Choose the correct option.

In a DBMS, what is the purpose of the procedure header?


A. To declare the procedure's input and output variables
B. To specify the operations to be performed by the procedure
C. To implement the actual code for the procedure
D. To define the package specification
Correct Answer : A)

Q363. Choose the correct option.

Which of the following is a benefit of using procedures in a DBMS?


A. Increased code duplication
B. Reduced security
C. Improved code organization and maintenance
D. Limited code reuse
Correct Answer : C)
Q364. Choose the correct option.

Boyce-Codd Normal Form (BCNF) is an extension of which normal form?


A. First Normal Form (1NF)
B. Second Normal Form (2NF)
C. Third Normal Form (3NF)
D. Fourth Normal Form (4NF)
Correct Answer : B)

Q365. Choose the correct option.

What type of trigger is executed automatically before a specific event, such as an INSERT or
UPDATE operation?
A. After Trigger
B. Before Trigger
C. Instead of Trigger
D. Compound Trigger
Correct Answer : B)

Q366. Choose the correct option.

What is a package specification in a DBMS?


A. A part of a package that contains package variables
B. A part of a package that specifies the package's procedures and functions
C. A part of a package that defines package triggers
D. A part of a package that implements the actual code for package procedures
Correct Answer : D)

Q367. Choose the correct option.

What is the typical sequence of steps for developing a package in a DBMS?


A. Develop triggers first, then procedures
B. Develop procedures and package specification simultaneously
C. Write the package specification first, then the package body
D. Write the package body first, then the specification
Correct Answer : C)

Q368. Choose the correct option.

What is a "bodiless" package in a DBMS context?


A. A package without a body
B. A package with excessive code
C. A package with only triggers
D. A package with minimal documentation
Correct Answer : A)

Q369. Choose the correct option.

What is the purpose of the internal schema in a database system?


A. To define the logical view of the database for users
B. To specify the access controls and security settings for the database
C. To represent the physical storage structure of the database
D. To define the user views and queries for the database
Correct Answer : C)

Q370. Choose the correct option.

Which of the following is an advantage of using triggers in a DBMS?


A. Limited code organization
B. Increased code redundancy
C. Enhanced code isolation
D. Improved code modularity and reusability
Correct Answer : D)

Q371. Choose the correct option.

What is the primary purpose of transaction management in a database system?


A. To optimize query performance
B. To ensure data consistency
C. To define database triggers
D. To establish database connections
Correct Answer : B)

Q372. Choose the correct option.

Which of the following is a property of a transaction in a database system?


A. Increased code duplication
B. Slower query performance
C. Atomicity
D. Reduced code redundancy
Correct Answer : C)

Q373. Choose the correct option.

What does the concept of "serializability" in concurrency control refer to?


A. The ability to lock data
B. The ability to execute transactions in parallel
C. The ability to perform database recovery
D. The ability to execute queries efficiently
Correct Answer : B)

Q374. Choose the correct option.

What is a database schema?


A. A collection of tables in a database
B. A diagram representing the structure of a database
C. A set of rules that define the database structure
D. A description of the database structure, including tables, fields, and relationships
Correct Answer : D)
Q375. Choose the correct option.

Why is concurrency control needed in a database management system (DBMS)?


A. To increase data redundancy
B. To slow down query execution
C. To ensure data consistency
D. To reduce code duplication
Correct Answer : C)

Q376. Choose the correct option.

Which of the following is a commonly used technique for concurrency control in a DBMS?
A. Optimistic concurrency control
B. Serializability control
C. Slower query performance
D. Increased code duplication
Correct Answer : B)

Q377. Choose the correct option.

What is a "transaction" in the context of a database management system (DBMS)?


A. A data dictionary
B. A single unit of work
C. A database schema
D. A database connection
Correct Answer : B)

Q378. Choose the correct option.

Which property of a transaction ensures that it either completes in its entirety or has no
effect at all?
A. Atomicity
B. Optimistic concurrency control
C. Slower query performance
D. Data redundancy
Correct Answer : A)

Q379. Choose the correct option.

What does the concept of "recoverability" in concurrency control refer to?


A. The ability to lock data
B. The ability to recover from system failures
C. The ability to perform database recovery
D. The ability to execute queries efficiently
Correct Answer : B)

Q380. Choose the correct option.

Which of the following is not a level of data abstraction in a database system?


A. Physical level
B. Logical level
C. External level
D. Semantic level
Correct Answer : D)

Q381. Choose the correct option.

In a multi-user DBMS, what issue can occur without proper concurrency control?
A. Faster query execution
B. Data consistency problems
C. Reduced code duplication
D. Increased code modularity
Correct Answer : B)

Q382. Choose the correct option.

What is the primary purpose of locking in concurrency control?


A. To eliminate transactions
B. To optimize query performance
C. To manage data access
D. To create database triggers
Correct Answer : C)

Q383. Choose the correct option.

Which of the following statements is true about First Normal Form (1NF)?
A. It allows for multivalued dependencies.
B. It allows for partial dependencies.
C. It eliminates repeating groups and ensures atomicity of data.
D. It enforces referential integrity constraints.
Correct Answer : C)

Q384. Choose the correct option.

Which database system component is responsible for managing transactions and ensuring
data integrity?
A. Database schema
B. Data dictionary
C. Concurrency control manager
D. Query optimizer
Correct Answer : C)

Q385. Choose the correct option.

What is the ACID property that ensures that transactions are performed correctly and
completely?
A. Atomicity
B. Consistency
C. Isolation
D. Durability
Correct Answer : A)

Q386. Choose the correct option.


What does the term "serializability" imply in the context of transaction execution?
A. Transactions occur in sequence
B. Transactions can execute concurrently
C. Transactions are aborted
D. Transactions are isolated
Correct Answer : A)

Q387. Choose the correct option.

Which type of database constraint ensures that a foreign key value matches a primary key
value in another table?
A. Unique constraint
B. Primary key constraint
C. Foreign key constraint
D. Not null constraint
Correct Answer : C)

Q388. Choose the correct option.

Why is "concurrency" a concern in a multi-user DBMS environment?


A. To simplify data retrieval
B. To ensure data consistency
C. To reduce query performance
D. To create redundant data
Correct Answer : B)

Q389. Choose the correct option.

In a locking-based concurrency control system, what does a "lock" prevent other


transactions from doing?
A. Accessing the locked data
B. Aborting the transaction
C. Executing queries
D. Creating database triggers
Correct Answer : A)

Q390. Choose the correct option.

What is the role of a "transaction manager" in a DBMS?


A. To design the database
B. To manage database connections
C. To coordinate transaction execution
D. To create database triggers
Correct Answer : C)

Q391. Choose the correct option.

Which property of a transaction ensures that it does not interfere with other transactions
while executing?
A. Atomicity
B. Consistency
C. Isolation
D. Durability
Correct Answer : C)

Q392. Choose the correct option.

Which property of a transaction ensures that it does not interfere with other transactions
while executing?
A. Atomicity
B. Consistency
C. Isolation
D. Durability
Correct Answer : C)

Q393. Choose the correct option.

What is the purpose of "recoverability" in the context of database transactions?


A. To ensure all transactions recover
B. To prevent data recovery issues
C. To recover from system failures
D. To lock database tables
Correct Answer : C)

Q394. Choose the correct option.

How can concurrent access to shared data lead to data inconsistency in a DBMS?
A. By preventing data updates
B. By enforcing data integrity rules
C. By allowing simultaneous updates
D. By reducing query performance
Correct Answer : C)

Q395. Choose the correct option.

Which of the following database languages is used to define the structure and organization
of a database?
A. Data Manipulation Language (DML)
B. Data Definition Language (DDL)
C. Data Control Language (DCL)
D. Data Query Language (DQL)
Correct Answer : B)

Q396. Choose the correct option.

What is a common drawback of "pessimistic" locking in concurrency control systems?


A. Increased code modularity
B. Reduced data consistency
C. Reduced query performance
D. Optimized query execution
Correct Answer : C)
Q397. Choose the correct option.

What does the term "transaction isolation" refer to in the context of concurrency control?
A. A transaction's lifespan
B. A transaction's ability to update data
C. A transaction's isolation level
D. A transaction's recovery
Correct Answer : C)

Q398. Choose the correct option.

Which property of a transaction ensures that the database remains in a consistent state
after transaction execution?
A. Atomicity
B. Consistency
C. Isolation
D. Durability
Correct Answer : B)

Q399. Choose the correct option.

In the context of transactions, what does "serializability" mean?


A. The ability to serialize data
B. The ability to execute transactions concurrently
C. The ability to recover from failures
D. The ability to perform queries efficiently
Correct Answer : A)

Q400. Choose the correct option.

Why is "concurrency control" important in a multi-user database environment?


A. To increase query performance
B. To ensure data consistency
C. To eliminate transactions
D. To optimize database storage
Correct Answer : B)

Q401. Choose the correct option.

What is the primary drawback of "optimistic" concurrency control in a DBMS?


A. Increased code modularity
B. Slower query performance
C. Risk of transaction conflicts
D. Enhanced data integrity
Correct Answer : C)

Q402. Choose the correct option.

What is the role of a "transaction log" in a DBMS with respect to concurrency control?
A. To manage database locks
B. To record transaction history
C. To optimize query performance
D. To create database triggers
Correct Answer : B)

Q403. Choose the correct option.

Which ACID property ensures that a transaction's effects on the database are permanent?
A. Atomicity
B. Consistency
C. Isolation
D. Durability
Correct Answer : D)

Q404. Choose the correct option.

What does "recoverability" encompass in the context of transactions and concurrency


control?
A. The ability to recover from system failures
B. The ability to execute transactions concurrently
C. The ability to lock database tables
D. The ability to perform efficient queries
Correct Answer : A)

Q405. Choose the correct option.

In a multi-user DBMS, what problem can arise when transactions are executed
concurrently without control?
A. Faster data retrieval
B. Enhanced data consistency
C. Reduced code duplication
D. Increased code modularity
Correct Answer : B)

Q406. Choose the correct option.

What is the primary purpose of "deadlock detection" mechanisms in a DBMS that uses
locking for concurrency control?
A. To prevent transaction conflicts
B. To optimize query performance
C. To eliminate transactions
D. To create database triggers
Correct Answer : C)

Q407. Choose the correct option.

What is a true statement regarding Two-tier architecture?


A. It allows for better scalability than the Three-tier architecture.
B. It is easier to maintain and modify compared to the Three-tier architecture.
C. It requires less network traffic than the Three-tier architecture.
D. It provides better security and data isolation compared to the Three-tier architecture.
Correct Answer : C)
Q408. Choose the correct option.

What is the function of the JOIN operation in relational databases?


A. To add new records to a table
B. To remove records from a table
C. To combine data from multiple tables based on a related column
D. To modify existing records in a table
Correct Answer : C)

Q409. Choose the correct option.

BCNF extends which normal form?


A. First Normal Form (1NF)
B. Second Normal Form (2NF)
C. Third Normal Form (3NF)
D. Fourth Normal Form (4NF)
Correct Answer : B)

Q410. Choose the correct option.

Which database constraint ensures the correspondence of foreign key and primary key
values in different tables?
A. Unique constraint
B. Primary key constraint
C. Foreign key constraint
D. Not null constraint
Correct Answer : C)

Q411. Choose the correct option.

What is absent as a level of data abstraction in a database system?


A. Physical level
B. Logical level
C. External level
D. Semantic level
Correct Answer : D)

Q412. Choose the correct option.

What does DBA represent in the database context?


A. Database Backup Administrator
B. Data Business Analyst
C. Database Architect
D. Database Administrator
Correct Answer : D)

Q413. Choose the correct option.

Define a database schema.


A. A collection of tables in a database
B. A diagram representing the structure of a database
C. A set of rules that define the database structure
D. A description of the database structure, including tables, fields, and relationships
Correct Answer : D)

Q414. Choose the correct option.

What is a true statement about First Normal Form (1NF)?


A. It allows for multivalued dependencies.
B. It allows for partial dependencies.
C. It eliminates repeating groups and ensures atomicity of data.
D. It enforces referential integrity constraints.
Correct Answer : C)

Q415. Choose the correct option.

What is the role of the internal schema in a database system?


A. To define the logical view of the database for users
B. To specify the access controls and security settings for the database
C. To represent the physical storage structure of the database
D. To define the user views and queries for the database
Correct Answer : C)

Q416. Choose the correct option.

Which language among the options is employed to define a database's structure and
organization?
A. Data Manipulation Language (DML)
B. Data Definition Language (DDL)
C. Data Control Language (DCL)
D. Data Query Language (DQL)
Correct Answer : B)

Q417. Choose the correct option.

What is not considered a component of the database architecture?


A. Data warehouse
B. Data dictionary
C. Database server
D. Database client
Correct Answer : A)

Q418. Choose the correct option.

In the ANSI-SPARC Architecture, which level among the options is NOT one of the three
separating database levels?
A. Physical level
B. Logical level
C. External level
D. Presentation level
Correct Answer : D)

Q419. Choose the correct option.


What drawback is associated with the Two-tier architecture?
A. Limited scalability and potential performance issues
B. Increased network traffic and latency
C. Complex application logic and maintenance
D. Lack of flexibility and extensibility
Correct Answer : A)

Q420. Choose the correct option.

In the context of the ER Model, how is an attribute defined?


A. A table in a relational database
B. A unique identifier for an entity
C. A column or field in a table
D. A relationship between two entities
Correct Answer : C)

Q421. Choose the correct option.

Define a weak entity type in the ER Model.


A. An entity type with a composite key
B. An entity type that depends on another entity type for identification
C. An entity type that participates in a many-to-many relationship
D. An entity type that has no attributes
Correct Answer : B)

Q422. Choose the correct option.

How does the ER Model differ from the Relational Model?


A. The ER Model focuses on physical data storage, while the Relational Model focuses on
logical data organization.
B. The ER Model uses tables and relationships, while the Relational Model uses entities
and attributes.
C. The ER Model supports inheritance and polymorphism, while the Relational Model
does not.
D. The ER Model is more suitable for unstructured data, while the Relational Model is
designed for structured data.
Correct Answer : B)

Q423. Choose the correct option.

What is the outcome of normalizing a database?


A. Increased data redundancy
B. Decreased data integrity
C. Improved data storage efficiency
D. Reduced data access performance
Correct Answer : C)

Q424. Choose the correct option.

Which normal form necessitates the removal of repeating groups and the identification of
a primary key?
A. First Normal Form (1NF)
B. Second Normal Form (2NF)
C. Third Normal Form (3NF)
D. Boyce-Codd Normal Form (BCNF)
Correct Answer : A)

Q425. Choose the correct option.

What does PL/SQL stand for in the context of databases?


A. Procedural Language/Structured Query Language
B. Programming Language/Structured Query Logic
C. Procedural Language/System Query Language
D. Programming Language/System Query Logic
Correct Answer : A)

Q426. Choose the correct option.


What is the purpose of the CONTINUE statement in database programming?
A. End the execution of a loop and resume with the next iteration
B. Terminate the execution of the program
C. Perform a specific action based on a condition
D. Define the structure of a function
Correct Answer : A)

Q427. Choose the correct option.

Why is a primary key essential in a database table?


A. To establish relationships between tables
B. To enforce data integrity constraints
C. To define the structure of a table
D. To provide a unique identifier for each row in a table
Correct Answer : D)

Q428. Choose the correct option.

Which option is not a constituent of a database system?


A. Data
B. Hardware
C. Software
D. Network
Correct Answer : a)

Q429. Choose the correct option.

Which normal form eradicates all kinds of functional dependencies?


A. First Normal Form (1NF)
B. Second Normal Form (2NF)
C. Third Normal Form (3NF)
D. Boyce-Codd Normal Form (BCNF)
Correct Answer : D)
Q430. Choose the correct option.

What feature characterizes a database system?


A. Data redundancy
B. Data isolation
C. Data inconsistency
D. Data unavailability
Correct Answer : B)

Q431. Choose the correct option.

Provide an instance of a functional dependency.


A. A customer's name depends on their order history.
B. A product's price depends on its availability.
C. A student's grade depends on their attendance.
D. A book's author depends on its ISBN number.
Correct Answer : B)

Q432. Choose the correct option.

Name a type of conditional control statement.


A. FOR loop
B. WHILE loop
C. IF-ELSE statement
D. SWITCH statement
Correct Answer : C)

Q433. Choose the correct option.

What role does data normalization play in a database?


A. To increase data redundancy
B. To improve data consistency
C. To simplify database queries
D. To reduce data integrity
Correct Answer : B)
Q434. Choose the correct option.

Define a database schema.


A. The physical storage structure of a database
B. A collection of related database tables
C. A graphical representation of the database structure
D. A description of the logical structure of a database
Correct Answer : D)

Q435. Choose the correct option.

Explain the concept of functional dependency in a database.


A. It represents the relationship between primary and foreign keys.
B. It determines the uniqueness of records in a table.
C. It describes the relationship between two or more attributes in a table.
D. It defines the normalization level of a database.
Correct Answer : C)

Q436. Choose the correct option.

What does a transitive dependency imply in the context of a database?


A. It exists when an attribute depends on a non-key attribute.
B. It exists when an attribute depends on a part of the primary key.
C. It exists when an attribute depends on another attribute through a third attribute.
D. It exists when two attributes have a one-to-one relationship.
Correct Answer : C)

Q437. Choose the correct option.

What is the primary function of a database package in a Database Management System


(DBMS)?
A. To define database triggers
B. To encapsulate and group related procedures, functions, and variables
C. To establish database connections
D. To optimize query performance
Correct Answer : B)

Q438. Choose the correct option.

Which part of a DBMS procedure is responsible for defining the operations to be executed?
A. Procedure header
B. Procedure specification
C. Procedure body
D. Procedure parameters
Correct Answer : C)

Q439. Choose the correct option.

What is one of the advantages of utilizing procedures in a DBMS?


A. Increased code duplication
B. Slower query performance
C. Enhanced security vulnerabilities
D. Reduced code redundancy
Correct Answer : D)

Q440. Choose the correct option.

What is the primary syntax for creating a trigger in a DBMS?


A. CREATE PROCEDURE
B. CREATE FUNCTION
C. CREATE TRIGGER
D. CREATE TABLE
Correct Answer : C)

Q441. Choose the correct option.

What role does a package specification play in a database package in a DBMS?


A. To define package variables
B. To provide information about the package's procedures and functions
C. To specify package triggers
D. To establish database connections
Correct Answer : B)

Q442. Choose the correct option.

What is the typical process of developing a package in a DBMS?


A. Write the package body first, then the specification
B. Write the package specification first, then the body
C. Develop procedures and triggers independently of packages
D. Develop triggers before procedures
Correct Answer : B)

Q443. Choose the correct option.

What is the term for a package in a DBMS that only contains the package specification and
lacks a package body?
A. A package without a body
B. A package with excessive code
C. A package with only triggers
D. A package with minimal documentation
Correct Answer : A)

Q444. Choose the correct option.

Name one advantage of using triggers in a DBMS.


A. Increased code modularity
B. Reduced control over data changes
C. Enhanced query performance
D. Automated enforcement of data integrity rules
Correct Answer : D)
Q445. Choose the correct option.

What is the main purpose of a database package body in a DBMS?


A. To define package variables
B. To provide information about the package's procedures and functions
C. To specify package triggers
D. To implement the actual code for package procedures
Correct Answer : D)

Q446. Choose the correct option.

In the context of databases, what does DBA stand for?


A. Database Backup Administrator
B. Data Business Analyst
C. Database Architect
D. Database Administrator
Correct Answer : D)

Q447. Choose the correct option.

Which part of a procedure in a DBMS declares input and output variables?


A. Procedure header
B. Procedure specification
C. Procedure body
D. Procedure parameters
Correct Answer : B)

Q448. Choose the correct option.

What is one of the benefits of using procedures in a DBMS?


A. Increased code redundancy
B. Slower execution of queries
C. Improved security vulnerabilities
D. Code reusability and maintainability
Correct Answer : D)
Q449. Choose the correct option.

What type of trigger is automatically executed after the triggering event in a DBMS?
A. After Trigger
B. Before Trigger
C. Instead of Trigger
D. Compound Trigger
Correct Answer : A)

Q450. Choose the correct option.

What is the purpose of the JOIN operation in a relational database?


A. To add new records to a table
B. To remove records from a table
C. To combine data from multiple tables based on a related column
D. To modify existing records in a table
Correct Answer : C)

Q451. Choose the correct option.

What is a package body in a DBMS?


A. A part of a package that contains package variables
B. A part of a package that specifies the package's procedures and functions
C. A part of a package that defines package triggers
D. A part of a package that implements the actual code for package procedures
Correct Answer : D)

Q452. Choose the correct option.

What is the typical sequence of steps for developing a package in a DBMS?


A. Develop triggers first, then procedures
B. Develop procedures and package specification simultaneously
C. Write the package specification first, then the package body
D. Write the package body first, then the specification
Correct Answer : C)

Q453. Choose the correct option.

What is the term for a package in a DBMS that only contains the package specification
without a package body?
A. A minimal package
B. A comprehensive package
C. A bodiless package
D. A complete package
Correct Answer : C)

Q454. Choose the correct option.

What is an advantage of using packages in a DBMS?


A. Limited code organization
B. Increased code redundancy
C. Enhanced code isolation
D. Improved code modularity and reusability
Correct Answer : D)

Q455. Choose the correct option.

What is a common application of a database trigger in a DBMS?


A. To define package specifications
B. To encapsulate related procedures and functions
C. To monitor and respond to database events
D. To create database packages
Correct Answer : C)

Q456. Choose the correct option.

In a DBMS, what does the procedure header define?


A. To declare the procedure's input and output variables
B. To specify the operations to be performed by the procedure
C. To implement the actual code for the procedure
D. To define the package specification
Correct Answer : A)

Q457. Choose the correct option.

What benefit is derived from using procedures in a DBMS?


A. Increased code duplication
B. Reduced security
C. Improved code organization and maintenance
D. Limited code reuse
Correct Answer : C)

Q458. Choose the correct option.

BCNF extends which normal form in the context of databases?


A. First Normal Form (1NF)
B. Second Normal Form (2NF)
C. Third Normal Form (3NF)
D. Fourth Normal Form (4NF)
Correct Answer : B)

Q459. Choose the correct option.

What kind of trigger is automatically executed before specific events like INSERT or
UPDATE operations in a DBMS?
A. After Trigger
B. Before Trigger
C. Instead of Trigger
D. Compound Trigger
Correct Answer : B)
Q460. Choose the correct option.

What does a package specification signify in a DBMS?


A. A part of a package that contains package variables
B. A part of a package that specifies the package's procedures and functions
C. A part of a package that defines package triggers
D. A part of a package that implements the actual code for package procedures
Correct Answer : D)

Q461. Choose the correct option.

What is the typical order of steps when developing a package in a DBMS?


A. Develop triggers first, then procedures
B. Develop procedures and package specification simultaneously
C. Write the package specification first, then the package body
D. Write the package body first, then the specification
Correct Answer : C)

Q462. Choose the correct option.

In the context of a DBMS, what does the term "bodiless" package refer to?
A. A package without a body
B. A package with excessive code
C. A package with only triggers
D. A package with minimal documentation
Correct Answer : A)

Q463. Choose the correct option.

What is the role of the internal schema in a database system?


A. To define the logical view of the database for users
B. To specify the access controls and security settings for the database
C. To represent the physical storage structure of the database
D. To define the user views and queries for the database
Correct Answer : C)
Q464. Choose the correct option.

What advantage is associated with using triggers in a DBMS?


A. Limited code organization
B. Increased code redundancy
C. Enhanced code isolation
D. Improved code modularity and reusability
Correct Answer : D)

Q465. Choose the correct option.

What is the primary objective of transaction management in a database system?


A. To optimize query performance
B. To ensure data consistency
C. To define database triggers
D. To establish database connections
Correct Answer : B)

Q466. Choose the correct option.

What property of a transaction characterizes its behavior in a database system?


A. Increased code duplication
B. Slower query performance
C. Atomicity
D. Reduced code redundancy
Correct Answer : C)

Q467. Choose the correct option.

In the context of concurrency control, what does "serializability" refer to?


A. The ability to lock data
B. The ability to execute transactions in parallel
C. The ability to perform database recovery
D. The ability to execute queries efficiently
Correct Answer : B)

Q468. Choose the correct option.

Define a database schema.


A. A collection of tables in a database
B. A diagram representing the structure of a database
C. A set of rules that define the database structure
D. A description of the database structure, including tables, fields, and relationships
Correct Answer : D)

Q469. Choose the correct option.

Why is concurrency control necessary in a Database Management System (DBMS)?


A. To increase data redundancy
B. To slow down query execution
C. To ensure data consistency
D. To reduce code duplication
Correct Answer : C)

Q470. Choose the correct option.

What is a commonly utilized method for concurrency control in a DBMS?


A. Optimistic concurrency control
B. Serializability control
C. Slower query performance
D. Increased code duplication
Correct Answer : B)

Q471. Choose the correct option.

How is a "transaction" defined within a Database Management System (DBMS)?


A. A data dictionary
B. A single unit of work
C. A database schema
D. A database connection
Correct Answer : B)

Q472. Choose the correct option.

Which transaction property ensures that it either completes entirely or has no effect at all?
A. Atomicity
B. Optimistic concurrency control
C. Slower query performance
D. Data redundancy
Correct Answer : A)

Q473. Choose the correct option.

What does the concept of "recoverability" signify in the context of concurrency control?
A. The ability to lock data
B. The ability to recover from system failures
C. The ability to perform database recovery
D. The ability to execute queries efficiently
Correct Answer : B)

Q474. Choose the correct option.

What level of data abstraction is NOT present in a database system?


A. Physical level
B. Logical level
C. External level
D. Semantic level
Correct Answer : D)

Q475. Choose the correct option.


In a multi-user DBMS, what problem can arise without proper concurrency control?
A. Faster query execution
B. Data consistency problems
C. Reduced code duplication
D. Increased code modularity
Correct Answer : B)

Q476. Choose the correct option.

What is the primary purpose of locking in the context of concurrency control?


A. To eliminate transactions
B. To optimize query performance
C. To manage data access
D. To create database triggers
Correct Answer : C)

Q477. Choose the correct option.

What is a true statement regarding First Normal Form (1NF)?


A. It allows for multivalued dependencies.
B. It allows for partial dependencies.
C. It eliminates repeating groups and ensures atomicity of data.
D. It enforces referential integrity constraints.
Correct Answer : C)

Q478. Choose the correct option.

Which component of a database system is responsible for managing transactions and


ensuring data integrity?
A. Database schema
B. Data dictionary
C. Concurrency control manager
D. Query optimizer
Correct Answer : C)
Q479. Choose the correct option.

Which ACID property ensures that transactions are executed accurately and completely?
A. Atomicity
B. Consistency
C. Isolation
D. Durability
Correct Answer : A)

Q480. Choose the correct option.

In the context of transaction execution, what does "serializability" imply?


A. Transactions occur in sequence
B. Transactions can execute concurrently
C. Transactions are aborted
D. Transactions are isolated
Correct Answer : A)

Q481. Choose the correct option.

What type of database constraint guarantees that a foreign key aligns with a primary key in
another table?
A. Unique constraint
B. Primary key constraint
C. Foreign key constraint
D. Not null constraint
Correct Answer : C)

Q482. Choose the correct option.

Why is "concurrency" a concern in a multi-user DBMS environment?


A. To simplify data retrieval
B. To ensure data consistency
C. To reduce query performance
D. To create redundant data
Correct Answer : B)

Q483. Choose the correct option.

In a locking-based concurrency control system, what does a "lock" prevent other


transactions from doing?
A. Accessing the locked data
B. Aborting the transaction
C. Executing queries
D. Creating database triggers
Correct Answer : A)

Q484. Choose the correct option.

What is the function of a "transaction manager" in a DBMS?


A. To design the database
B. To manage database connections
C. To coordinate transaction execution
D. To create database triggers
Correct Answer : C)

Q485. Choose the correct option.

Which property of a transaction ensures it does not disrupt other transactions during
execution?
A. Atomicity
B. Consistency
C. Isolation
D. Durability
Correct Answer : C)

Q486. Choose the correct option.


What does "recoverability" mean concerning database transactions?
A. Atomicity
B. Consistency
C. Isolation
D. Durability
Correct Answer : C)

Q487. Choose the correct option.

How can simultaneous access to shared data cause data inconsistency in a DBMS?
A. To ensure all transactions recover
B. To prevent data recovery issues
C. To recover from system failures
D. To lock database tables
Correct Answer : C)

Q488. Choose the correct option.

Which database language is used to define a database's structure and organization?


A. By preventing data updates
B. By enforcing data integrity rules
C. By allowing simultaneous updates
D. By reducing query performance
Correct Answer : C)

Q489. Choose the correct option.

What is a common drawback of "pessimistic" locking in concurrency control systems?


A. Data Manipulation Language (DML)
B. Data Definition Language (DDL)
C. Data Control Language (DCL)
D. Data Query Language (DQL)
Correct Answer : B)
Q490. Choose the correct option.

What does "transaction isolation" refer to in the context of concurrency control?


A. Increased code modularity
B. Reduced data consistency
C. Reduced query performance
D. Optimized query execution
Correct Answer : C)

Q491. Choose the correct option.

What property of a transaction ensures the database remains consistent after execution?
A. A transaction's lifespan
B. A transaction's ability to update data
C. A transaction's isolation level
D. A transaction's recovery
Correct Answer : C)

Q492. Choose the correct option.

In the realm of transactions, what does "serializability" signify?


A. Atomicity
B. Consistency
C. Isolation
D. Durability
Correct Answer : B)

Q493. Choose the correct option.

Why is "concurrency control" crucial in a multi-user database environment?


A. The ability to serialize data
B. The ability to execute transactions concurrently
C. The ability to recover from failures
D. The ability to perform queries efficiently
Correct Answer : A)

Q494. Choose the correct option.

What is the primary disadvantage of "optimistic" concurrency control in a DBMS?


A. To increase query performance
B. To ensure data consistency
C. To eliminate transactions
D. To optimize database storage
Correct Answer : B)

Q495. Choose the correct option.

What role does a "transaction log" play in a DBMS concerning concurrency control?
A. Increased code modularity
B. Slower query performance
C. Risk of transaction conflicts
D. Enhanced data integrity
Correct Answer : C)

Q496. Choose the correct option.

Which ACID property guarantees that a transaction's effects on the database are
permanent?
A. To manage database locks
B. To record transaction history
C. To optimize query performance
D. To create database triggers
Correct Answer : B)

Q497. Choose the correct option.

What does "recoverability" encompass in the context of transactions and concurrency


control?
A. Atomicity
B. Consistency
C. Isolation
D. Durability
Correct Answer : D)

Q498. Choose the correct option.

In a multi-user DBMS, what issue can arise when transactions are executed concurrently
without control?
A. The ability to recover from system failures
B. The ability to execute transactions concurrently
C. The ability to lock database tables
D. The ability to perform efficient queries
Correct Answer : A)

Q499. Choose the correct option.

What is the main purpose of "deadlock detection" mechanisms in a DBMS employing


locking for concurrency control?
A. Faster data retrieval
B. Enhanced data consistency
C. Reduced code duplication
D. Increased code modularity
Correct Answer : B)

Q500. Choose the correct option.

What is the primary purpose of "deadlock detection" mechanisms in a DBMS that uses
locking for concurrency control?
A. To prevent transaction conflicts
B. To optimize query performance
C. To eliminate transactions
D. To create database triggers
Correct Answer : C)
Q501. Choose the correct option.

What is the purpose of the BORROW_BOOK stored procedure?


A. To return a borrowed book to the library.
B. To check if a book is available for borrowing.
C. To add a new book to the library catalog.
D. To automate the book borrowing process by updating records in the database.
Correct Answer : D

Q502. Choose the correct option.

What are the input parameters of the BORROW_BOOK stored procedure?


A. book_title and borrower_name
B. book_id and borrower_id
C. book_genre and borrow_date
D. author_id and book_id
Correct Answer : B

Q503. Choose the correct option.

What should the BORROW_BOOK procedure do if the book is not available?


A. Delete the book from the database.
B. Display a message saying the book is unavailable.
C. Reduce the available copies count and add a record in the Borrowers table.
D. Ignore the request and do nothing.
Correct Answer : B

Q504. Choose the correct option.

In the BORROW_BOOK procedure, where is the information about the borrowed book and
borrower stored?
A. In the Books table.
B. In the Authors table.
C. In the Borrowers table.
D. In the Readers table.
Correct Answer : C

Q505. Choose the correct option.

What should the BORROW_BOOK procedure do after successfully borrowing the book?
A. Update the book's publication date.
B. Update the borrower's contact information.
C. Reduce the available copies count in the Books table.
D. Add a new record in the Authors table.
Correct Answer : C

Q506. Choose the correct option.

Which SQL statement is correct for updating the available_copies of a book after it's
borrowed using the BORROW_BOOK stored procedure?
A. UPDATE Books SET available_copies = available_copies - 1 WHERE book_id =
<book_id>;
B. MODIFY Books SET available_copies = available_copies - 1 WHERE book_id =
<book_id>;
C. CHANGE Books SET available_copies = available_copies - 1 WHERE book_id =
<book_id>;
D. ALTER Books SET available_copies = available_copies - 1 WHERE book_id = <book_id>;
Correct Answer : A

Q507. Choose the correct option.

Which SQL statement is correct for updating the available_copies of a book after it's
borrowed using the BORROW_BOOK stored procedure?
A. UPDATE Books SET available_copies = available_copies - 1 WHERE book_id =
<book_id>;
B. MODIFY Books SET available_copies = available_copies - 1 WHERE book_id =
<book_id>;
C. CHANGE Books SET available_copies = available_copies - 1 WHERE book_id =
<book_id>;
D. ALTER Books SET available_copies = available_copies - 1 WHERE book_id = <book_id>;
Correct Answer : A

Q508. Choose the correct option.

Which SQL statement is correct for inserting a new record into the Borrowers table after
borrowing a book using the BORROW_BOOK stored procedure?
A. INSERT INTO Borrowers (book_id, borrower_id, borrow_date) VALUES (<book_id>,
<borrower_id>, SYSDATE);
B. ADD INTO Borrowers (book_id, borrower_id, borrow_date) VALUES (<book_id>,
<borrower_id>, CURRENT_DATE);
C. CREATE INTO Borrowers (book_id, borrower_id, borrow_date) VALUES (<book_id>,
<borrower_id>, NOW());
D. NEW INTO Borrowers (book_id, borrower_id, borrow_date) VALUES (<book_id>,
<borrower_id>, TODAY());
Correct Answer : A

Q509. Choose the correct option.

What is the purpose of the SYSDATE function in the context of the BORROW_BOOK stored
procedure?
A. It represents the current date and time when the book was added to the library.
B. It represents the current date and time when the book was borrowed.
C. It represents the date when the book was published.
D. It represents the due date for returning the borrowed book.
Correct Answer : B

Q510. Choose the correct option.

In the BORROW_BOOK stored procedure, what should be done before attempting to


reduce the available_copies count?
A. Check if the book exists in the library.
B. Check if the borrower has a valid library card.
C. Check if the book is in good condition.
D. Check if the borrower has any outstanding fines.
Correct Answer : A

Q511. Choose the correct option.

Which of the following SQL statements should be used to validate if a book with a specific
book_id exists before borrowing it in the BORROW_BOOK stored procedure?
A. SELECT * FROM Books WHERE book_id = <book_id>;
B. IF EXISTS (SELECT * FROM Books WHERE book_id = <book_id>) THEN ... END IF;
C. CHECK IF (SELECT COUNT(*) FROM Books WHERE book_id = <book_id>) > 0 THEN ...
END IF;
D. IF (SELECT COUNT(*) FROM Books WHERE borrower_id = <book_id>) > 0 THEN ... END
IF;
Correct Answer : B

Q512. Choose the correct option.

What is the purpose of the RETURN_BOOK stored procedure?


A. To check if a book is available for borrowing.
B. To automate the book borrowing process by updating records in the database.
C. To mark a borrowed book as returned and update the records in the database.
D. To retrieve a list of overdue books.
Correct Answer : C

Q513. Choose the correct option.

Which input parameters are required for the RETURN_BOOK stored procedure?
A. book_title and borrower_name
B. book_id and borrower_id
C. book_genre and borrow_date
D. author_id and book_id
Correct Answer : B

Q514. Choose the correct option.


What action should the RETURN_BOOK procedure perform first?
A. Check if the book exists in the library.
B. Verify if the borrower has a valid library card.
C. Mark the book as returned by updating the return_date in the Borrowers table.
D. Calculate the late fee for overdue books.
Correct Answer : C

Q515. Choose the correct option.

Which SQL statement is correct for updating the return_date in the Borrowers table to
mark a book as returned in the RETURN_BOOK procedure?
A. UPDATE Borrowers SET return_date = SYSDATE WHERE book_id = <book_id> AND
borrower_id = <borrower_id>;
B. MODIFY Borrowers SET return_date = NOW() WHERE book_id = <book_id> AND
borrower_id = <borrower_id>;
C. ALTER Borrowers SET return_date = CURRENT_DATE WHERE book_id = <book_id> AND
borrower_id = <borrower_id>;
D. CHANGE Borrowers SET return_date = TODAY() WHERE book_id = <book_id> AND
borrower_id = <borrower_id>;
Correct Answer : A

Q516. Choose the correct option.

What action should the RETURN_BOOK procedure perform after updating the return_date
in the Borrowers table?
A. Increase the available copies count in the Books table for the corresponding book.
B. Decrease the available copies count in the Books table for the corresponding book.
C. Check if the book is damaged and needs repair.
D. Notify the borrower about the return status.
Correct Answer : A

Q517. Choose the correct option.

What is the primary advantage of using views in a database?


A. Simplifying complex queries
B. Increasing data redundancy
C. Enhancing data integrity
D. Improving query performance
Correct Answer : A

Q518. Choose the correct option.

In SQL, which type of JOIN returns all rows from the left table, and the matched rows from
the right table?
A. LEFT JOIN
B. INNER JOIN
C. RIGHT JOIN
D. FULL OUTER JOIN
Correct Answer : A

Q519. Choose the correct option.

What is the main purpose of a restart recovery in a database system?


A. To improve data security
B. To recover from system and user failures
C. To maximize data storage
D. To track user activity
Correct Answer : B

Q520. Choose the correct option.

Which SQL statement is used to revoke previously granted permissions?


A. REVOKE
B. GRANT
C. CREATE
D. DELETE
Correct Answer : A
Q521. Choose the correct option.

What is a transaction in a database?


A. A single data record
B. A collection of tables
C. A sequence of SQL statements
D. A user account
Correct Answer : C

Q522. Choose the correct option.

Which SQL statement is used to create a new table in a database?


A. CREATE TABLE
B. ALTER TABLE
C. DROP TABLE
D. INSERT INTO
Correct Answer : A

Q523. Choose the correct option.

Which SQL keyword is used to negate the result of a subquery?


A. NOT
B. LIKE
C. EXISTS
D. IN
Correct Answer : A

Q524. Choose the correct option.

Which SQL statement is used to remove rows from a table based on a specified condition?
A. DELETE FROM
B. SELECT * FROM
C. INSERT INTO
D. UPDATE
Correct Answer : A
Q525. Choose the correct option.

In a PL/SQL package, where are the private variables and cursors declared and defined?
A. Package Header
B. Package Specification
C. Package Body
D. Package Interface
Correct Answer : C

Q526. Choose the correct option.

What is the primary reason to denormalize a database?


A. To optimize read-heavy workloads
B. To minimize data integrity issues
C. To maximize data redundancy
D. To simplify query optimization
Correct Answer : A

Q527. Choose the correct option.

What is the SQL statement for modifying existing data in a table?


A. UPDATE
B. INSERT INTO
C. DELETE FROM
D. ALTER TABLE
Correct Answer : A

Q528. Choose the correct option.

Which trigger type is fired before a DELETE operation?


A. BEFORE DELETE
B. AFTER DELETE
C. BEFORE INSERT
D. AFTER INSERT
Correct Answer : A

Q529. Choose the correct option.

Which type of lock allows a transaction to both read and write data exclusively, blocking all
other transactions?
A. Shared Locks
B. Exclusive Locks
C. Read Locks
D. Write Locks
Correct Answer : B

Q530. Choose the correct option.

Which recovery technique involves applying all the changes in the log since the last
checkpoint?
A. Rollforward recovery
B. Rollback recovery
C. Point-in-time recovery
D. Restart recovery
Correct Answer : A

Q531. Choose the correct option.

Which property of transactions ensures that a transaction can be undone if needed


(rollback capability)?
A. Atomicity
B. Consistency
C. Isolation
D. Durability
Correct Answer : A

Q532. Choose the correct option.


Why is concurrency control needed in a multi-user database system?
A. To reduce the number of users
B. To increase data storage
C. To prevent data corruption
D. To improve query performance
Correct Answer : C

Q533. Choose the correct option.

What is the primary purpose of the recovery process in a database system?


A. To enhance data security
B. To reduce query complexity
C. To restore the database after a failure
D. To improve data storage
Correct Answer : C

Q534. Choose the correct option.

What is a logical error in the context of database recovery?


A. An error caused by a user
B. An error caused by hardware
C. An error in the database schema
D. An error in the DBMS logic
Correct Answer : C

Q535. Choose the correct option.

In database recovery, what is an instance recovery?


A. Recovery of the entire database
B. Recovery of a specific table
C. Recovery of the DBMS
D. Recovery of a database instance
Correct Answer : D
Q536. Choose the correct option.

Which model is based on the mathematical concept of sets and relations?


A. Hierarchical model
B. Relational model
C. ER model
D. Object-oriented model
Correct Answer : B

Q537. Choose the correct option.

What is the purpose of the transaction log in a database system?


A. To record all queries executed
B. To track user activity
C. To maintain data consistency
D. To provide backup data
Correct Answer : C

Q538. Choose the correct option.

Which of the following statements about a bodiless package is true?


A. It contains both a specification and a body
B. It does not contain any procedures or functions
C. It is not allowed in PL/SQL
D. It is only used for data storage
Correct Answer : B

Q539. Choose the correct option.

Which of the following is a part of a PL/SQL procedure?


A. Header
B. Body
C. Exception
D. All of the above
Correct Answer : D

Q540. Choose the correct option.

In a two-phase locking protocol, when is a transaction allowed to release locks?


A. After it has acquired all locks
B. Before it has acquired any locks
C. Simultaneously with acquiring locks
D. It cannot release locks
Correct Answer : A

Q541. Choose the correct option.

What is the primary difference between a "for" loop and a "while" loop in programming?
A. A "for" loop has a defined number of iterations
B. A "while" loop has a loop counter
C. A "for" loop cannot exit prematurely
D. A "while" loop cannot iterate
Correct Answer : A

Q542. Choose the correct option.

In SQL, which clause is used to filter rows in the result set of a SELECT statement based on
a specified condition?
A. WHERE
B. FROM
C. SELECT
D. HAVING
Correct Answer : A

Q543. Choose the correct option.

What does an ER diagram depict?


A. The logical structure
B. The physical storage
C. The query optimization
D. The data retrieval
Correct Answer : A

Q544. Choose the correct option.

What is a PL/SQL procedure used for?


A. Data retrieval
B. Data manipulation
C. Data storage
D. Data validation
Correct Answer : B

Q545. Choose the correct option.

What is the primary goal of concurrency control in a database system?


A. To maximize data storage
B. To minimize query complexity
C. To ensure data consistency
D. To eliminate data redundancy
Correct Answer : C

Q546. Choose the correct option.

Which data model represents data as a network of nodes connected by edges?


A. Hierarchical model
B. Relational model
C. ER model
D. Object-oriented model
Correct Answer : A

Q547. Choose the correct option.


What is normalization in the context of the relational model?
A. A process of simplifying data
B. A process of adding data
C. A process of visualizing data
D. A process of encrypting data
Correct Answer : A

Q548. Choose the correct option.

What is the purpose of a package specification in PL/SQL?


A. To define the interface of the package
B. To store the package's data
C. To define the package's procedures and functions
D. To define triggers for the package
Correct Answer : A

Q549. Choose the correct option.

What is a common use case for a cursor in database programming?


A. Fetching and processing rows from a result set
B. Creating database tables
C. Defining database views
D. Indexing database columns
Correct Answer : A

Q550. Choose the correct option.

Data independence refers to:


A. The ability to hide data
B. The ability to access data
C. The ability to update data
D. The ability to delete data
Correct Answer : A
Q551. Choose the correct option.

Which trigger type is fired when an UPDATE operation occurs on a table?


A. BEFORE UPDATE
B. AFTER UPDATE
C. BEFORE DELETE
D. AFTER DELETE
Correct Answer : B

Q552. Choose the correct option.

What is the purpose of a shared lock in a locking system?


A. Allows multiple transactions to read data
B. Allows exclusive access during updates
C. Prevents all transactions from accessing data
D. Ensures data durability
Correct Answer : A

Q553. Choose the correct option.

What is a transaction log in the context of database recovery?


A. A record of user activities
B. A record of schema changes
C. A record of changes made to the database
D. A record of system errors
Correct Answer : C

Q554. Choose the correct option.

What is the primary purpose of a transaction log in the recovery process?


A. To track user activity
B. To record changes made to the database
C. To prevent data access
D. To improve query performance
Correct Answer : B

Q555. Choose the correct option.

Which part of a PL/SQL package is used for declaring global variables and cursors that can
be used throughout the package?
A. Package Header
B. Package Specification
C. Package Body
D. Package Interface
Correct Answer : A

Q556. Choose the correct option.

What is the purpose of the weak entity in the ER model?


A. It depends on a strong entity
B. It depends on an attribute
C. It has no purpose
D. It represents a table
Correct Answer : A

Q557. Choose the correct option.

What is the primary purpose of database recovery?


A. To improve query performance
B. To ensure data consistency
C. To maximize data storage
D. To prevent data access
Correct Answer : B

Q558. Choose the correct option.

What does the term "tuple" refer to in the relational model?


A. A record
B. An attribute
C. A relationship
D. A table
Correct Answer : A

Q559. Choose the correct option.

What is the purpose of a default constraint in a database?


A. To ensure data security
B. To ensure data consistency
C. To provide a default value
D. To enforce data integrity
Correct Answer : C

Q560. Choose the correct option.

Which normal form eliminates partial and transitive dependencies?


A. 2NF
B. 3NF
C. BCNF
D. 4NF
Correct Answer : D

Q561. Choose the correct option.

In the relational model, what is a tuple also known as?


A. Row
B. Column
C. Table
D. Database
Correct Answer : A

Q562. Choose the correct option.


Which DBMS architecture is characterized by a peer-to-peer network model?
A. Client-Server
B. Hierarchical
C. Network
D. Centralized
Correct Answer : C

Q563. Choose the correct option.

In the context of database programming, what is the primary purpose of a cursor?


A. To retrieve and manipulate data from a result set
B. To create a database table
C. To define a database schema
D. To insert data into a table
Correct Answer : A

Q564. Choose the correct option.

What does the ACID acronym stand for in the context of database transactions?
A. Atomicity, Consistency, Integrity, Durability
B. Availability, Consistency, Isolation, Durability
C. Atomicity, Consistency, Isolation, Durability
D. Association, Connectivity, Integration, Durability
Correct Answer : C

Q565. Choose the correct option.

Which normal form is stronger than 3NF but not as strong as BCNF?
A. 2NF
B. 3NF
C. 4NF
D. 5NF
Correct Answer : C
Q566. Choose the correct option.

Which SQL statement is used to insert data into a table?


A. INSERT INTO
B. UPDATE
C. DELETE FROM
D. SELECT * FROM
Correct Answer : A

Q567. Choose the correct option.

What is the highest level of data independence in a DBMS?


A. Logical
B. Physical
C. Conceptual
D. Structural
Correct Answer : C

Q568. Choose the correct option.

Which SQL keyword is used to combine multiple conditions in a WHERE clause with logical
OR?
A. OR
B. AND
C. NOT
D. XOR
Correct Answer : A

Q569. Choose the correct option.

Which SQL statement is used to add a new table to a database?


A. CREATE TABLE
B. ALTER TABLE
C. DROP TABLE
D. INSERT INTO
Correct Answer : A

Q570. Choose the correct option.

What is the main purpose of a database log in the recovery process?


A. To track user activity
B. To store database schema information
C. To record changes made to the database
D. To improve query performance
Correct Answer : C

Q571. Choose the correct option.

Which programming construct allows you to create a controlled repetition of code?


A. Loop control structures
B. Sequential control
C. Conditional statements
D. Cursors
Correct Answer : A

Q572. Choose the correct option.

What does the SQL statement "ALTER TABLE" allow you to do?
A. Modify the structure of an existing table
B. Create a new table
C. Delete a table
D. Insert data into a table
Correct Answer : A

Q573. Choose the correct option.

What is the primary function of the SQL REVOKE statement?


A. To remove permissions from users or roles for certain actions on database objects
B. To create a new table
C. To delete data from a table
D. To insert data into a table
Correct Answer : A

Q574. Choose the correct option.

Which DBMS architecture allows multiple users to access the database concurrently?
A. Client-Server
B. Centralized
C. Hierarchical
D. Flat File
Correct Answer : A

Q575. Choose the correct option.

In SQL, which statement is used to change the structure of an existing table?


A. ALTER TABLE
B. DROP TABLE
C. CREATE TABLE
D. INSERT INTO
Correct Answer : A

Q576. Choose the correct option.

What is the primary benefit of using a view in a database?


A. Simplifying complex queries
B. Increasing data redundancy
C. Enhancing data integrity
D. Indexing database columns
Correct Answer : A

Q577. Choose the correct option.


What does BCNF (Boyce-Codd Normal Form) ensure regarding functional dependencies?
A. No partial dependencies
B. No transitive dependencies
C. No repeating groups
D. All of the above
Correct Answer : D

Q578. Choose the correct option.

Why is database recovery needed in a database management system?


A. To reduce the number of users
B. To recover from system and user failures
C. To increase data storage
D. To improve query optimization
Correct Answer : B

Q579. Choose the correct option.

What is the purpose of the SQL WHERE clause in a SELECT statement?


A. To specify which rows to retrieve based on a condition
B. To specify the order of retrieved rows
C. To group the retrieved rows
D. To join tables
Correct Answer : A

Q580. Choose the correct option.

Which data model represents data as a collection of entities, attributes, and relationships?
A. Relational model
B. ER model
C. Object-oriented model
D. Hierarchical model
Correct Answer : B
Q581. Choose the correct option.

What is the syntax for creating a PL/SQL trigger?


A. CREATE TRIGGER
B. BEGIN TRIGGER
C. DECLARE TRIGGER
D. DEFINE TRIGGER
Correct Answer : A

Q582. Choose the correct option.

What is the primary goal of a database recovery manager?


A. To ensure data consistency
B. To track user activity
C. To maximize data storage
D. To prevent data access
Correct Answer : A

Q583. Choose the correct option.

In SQL, what is the purpose of the "OR" operator in a WHERE clause?


A. It combines conditions using logical OR
B. It negates a condition
C. It combines conditions using logical AND
D. It performs a subtraction
Correct Answer : A

Q584. Choose the correct option.

Which locking technique allows multiple transactions to read the same data
simultaneously but ensures exclusive access during updates?
A. Shared Locks
B. Exclusive Locks
C. Read Locks
D. Write Locks
Correct Answer : A

Q585. Choose the correct option.

What is the primary purpose of a DBMS?


A. Data manipulation
B. Data storage
C. Data retrieval
D. Data processing
Correct Answer : C

Q586. Choose the correct option.

In an ER diagram, what is the purpose of a double diamond shape?


A. Represents a weak relationship
B. Represents a strong relationship
C. Denotes an attribute
D. Signifies a constraint
Correct Answer : B

Q587. Choose the correct option.

Which integrity constraint allows you to specify a condition that must be met for data to
be inserted or updated?
A. Primary Key Constraint
B. Foreign Key Constraint
C. Check Constraint
D. Default Constraint
Correct Answer : C

Q588. Choose the correct option.

What does the SQL IN keyword do in a subquery?


A. It checks if a value exists in a set of values
B. It checks if a value does not exist in a set of values
C. It checks if a value is NULL
D. It checks if a value is empty
Correct Answer : A

Q589. Choose the correct option.

What is the primary purpose of an "else if" clause in an "if-else" statement in


programming?
A. To provide an additional condition to test
B. To exit the program
C. To declare a variable
D. To create a loop
Correct Answer : A

Q590. Choose the correct option.

In an ER diagram, what is the purpose of a dashed line connecting entities?


A. Denotes a strong relationship
B. Denotes a weak relationship
C. Indicates an attribute
D. Represents a constraint
Correct Answer : B

Q591. Choose the correct option.

What is the primary goal of a recovery point in database recovery?


A. To prevent data access
B. To ensure data consistency
C. To maximize data storage
D. To record changes made to the database
Correct Answer : B
Q592. Choose the correct option.

What is the purpose of a "do-while" loop in programming?


A. To ensure that a block of code is executed at least once
B. To create a database
C. To define a function
D. To declare a variable
Correct Answer : A

Q593. Choose the correct option.

What is the primary goal of the durability property of transactions?


A. To ensure data consistency
B. To maximize query performance
C. To guarantee data persistence
D. To prevent deadlocks
Correct Answer : C

Q594. Choose the correct option.

Which type of error occurs when a user enters incorrect data into the database?
A. System error
B. User error
C. Hardware error
D. Network error
Correct Answer : B

Q595. Choose the correct option.

What does it mean for an attribute to be "fully functionally dependent" in a relation?


A. It depends on a partial key
B. It depends on a superkey
C. It depends on another relation
D. It depends on a foreign key
Correct Answer : B
Q596. Choose the correct option.

What is a disadvantage of using triggers in a database?


A. Slower database performance
B. Increased data security
C. Improved data integrity
D. Easier debugging
Correct Answer : A

Q597. Choose the correct option.

Which model is often used for modeling real-world entities and their relationships in
databases?
A. Hierarchical model
B. Object-oriented model
C. Relational model
D. ER model
Correct Answer : D

Q598. Choose the correct option.

In the relational model, what is an attribute?


A. A column
B. A table
C. A record
D. A key
Correct Answer : A

Q599. Choose the correct option.

In a database, when should denormalization be considered?


A. When optimizing query performance
B. When reducing data redundancy
C. When ensuring data integrity
D. When achieving 1NF
Correct Answer : A

Q600. Choose the correct option.

In an ER diagram, what does a diamond shape represent?


A. Relationship
B. Entity
C. Attribute
D. Table
Correct Answer : A

Q601. Choose the correct option.

In the context of normalization, what does "functional dependency" mean?


A. An attribute uniquely determines another attribute
B. An attribute is not dependent on any other attribute
C. An attribute is functionally related to a key
D. An attribute can be null
Correct Answer : A

Q602. Choose the correct option.

What is the primary goal of the recovery manager in a database system?


A. To improve query performance
B. To ensure data consistency
C. To maximize data storage
D. To prevent deadlocks
Correct Answer : B

Q603. Choose the correct option.

Which SQL statement is used to change existing data in a table?


A. UPDATE
B. INSERT INTO
C. DELETE FROM
D. ALTER TABLE
Correct Answer : A

Q604. Choose the correct option.

In database recovery, what is a point-in-time recovery?


A. Recovery to a specific time
B. Recovery to the last checkpoint
C. Recovery of the entire database
D. Recovery after a hardware failure
Correct Answer : A

Q605. Choose the correct option.

Which type of trigger is fired after a DELETE operation?


A. BEFORE DELETE
B. AFTER DELETE
C. BEFORE INSERT
D. AFTER INSERT
Correct Answer : B

Q606. Choose the correct option.

Which data model is based on the concept of a tree-like structure with parent-child
relationships?
A. Object-oriented model
B. Relational model
C. Hierarchical model
D. ER model
Correct Answer : C
Q607. Choose the correct option.

What is the key difference between 3NF and BCNF in normalization?


A. BCNF eliminates all types of dependencies, while 3NF does not
B. 3NF eliminates all types of dependencies, while BCNF does not
C. BCNF allows repeating groups, while 3NF does not
D. 3NF is suitable for hierarchical data, while BCNF is not
Correct Answer : A

Q608. Choose the correct option.

In the context of normalization, when is it necessary to consider higher normal forms like
4NF and 5NF?
A. When dealing with complex multi-valued dependencies
B. When optimizing query performance
C. When minimizing data redundancy
D. When enforcing foreign key constraints
Correct Answer : A

Q609. Choose the correct option.

What is a common way to exit a loop prematurely in programming?


A. Using a "break" statement
B. Using a "return" statement
C. Using a "continue" statement
D. Using an "if" statement
Correct Answer : A

Q610. Choose the correct option.

What is the primary goal of normalization in a relational database?


A. To minimize data redundancy
B. To maximize data integrity
C. To optimize query performance
D. To reduce data visualization
Correct Answer : A

Q611. Choose the correct option.

Which control structure allows you to make decisions in code based on certain conditions?
A. Conditional statements
B. Iterative control
C. Sequential control
D. Cursors
Correct Answer : A

Q612. Choose the correct option.

Which locking technique allows multiple transactions to read the same data and also
allows concurrent writes, resolving conflicts later?
A. Shared Locks
B. Exclusive Locks
C. Read Locks
D. Write Locks
Correct Answer : A

Q613. Choose the correct option.

What is the purpose of the SQL statement "DROP TABLE"?


A. Delete an existing table
B. Create a new table
C. Modify an existing table
D. Insert data into a table
Correct Answer : A

Q614. Choose the correct option.

What is the primary purpose of a "for" loop in programming?


A. To repeat a block of code a specified number of times
B. To make decisions
C. To define a function
D. To declare a variable
Correct Answer : A

Q615. Choose the correct option.

Which part of a package contains the declarations and definitions of the procedures and
functions?
A. Package Header
B. Package Specification
C. Package Body
D. Package Interface
Correct Answer : C

Q616. Choose the correct option.

What is the primary purpose of an "if" statement in programming?


A. To execute code conditionally
B. To create a loop
C. To call a function
D. To define a variable
Correct Answer : A

Q617. Choose the correct option.

What does DBMS stand for?


A. Database Management System
B. Data Backup and Storage
C. Data Business Model
D. Digital Business Solution
Correct Answer : A
Q618. Choose the correct option.

In the relational model, what does a foreign key do?


A. Links two tables
B. Represents a primary key
C. Stores binary data
D. Stores metadata
Correct Answer : A

Q619. Choose the correct option.

In programming, what is the primary purpose of sequential control statements?


A. To define the order of execution of statements
B. To make decisions
C. To create loops
D. To declare variables
Correct Answer : A

Q620. Choose the correct option.

What is the primary purpose of a cursor in database programming?


A. To retrieve and manipulate data in a database
B. To create a new table
C. To define a database schema
D. To insert data into a table
Correct Answer : A

Q621. Choose the correct option.

What is the primary purpose of a checkpoint in database recovery?


A. To prevent data access
B. To ensure data consistency
C. To maximize data storage
D. To record changes made to the database
Correct Answer : B
Q622. Choose the correct option.

In a "while" loop, what happens if the condition is initially false?


A. The loop code is never executed
B. The loop code is executed once
C. The loop code runs indefinitely
D. An error is thrown
Correct Answer : A

Q623. Choose the correct option.

Which of the following statements is true about the SQL "AND" operator in a WHERE
clause?
A. All conditions must be true for the row to be selected
B. At least one condition must be true for the row to be selected
C. The order of conditions does not matter
D. It is equivalent to "OR"
Correct Answer : A

Q624. Choose the correct option.

In the context of normalization, what is a transitive dependency?


A. An attribute determines another attribute
B. An attribute determines itself
C. An attribute determines a key
D. An attribute has no dependencies
Correct Answer : A

Q625. Choose the correct option.

What is a package in PL/SQL?


A. A container for PL/SQL code
B. A database table
C. A database schema
D. A SQL statement
Correct Answer : A

Q626. Choose the correct option.

In PL/SQL, what parameter mode is typically used for input-only parameters in


procedures?
A. IN
B. OUT
C. IN OUT
D. None of the above
Correct Answer : A

Q627. Choose the correct option.

Which type of integrity constraint enforces business rules and domain constraints on data?
A. Primary Key Constraint
B. Foreign Key Constraint
C. Check Constraint
D. Default Constraint
Correct Answer : C

Q628. Choose the correct option.

What is a deadlock in the context of concurrency control?


A. A database failure
B. A transaction error
C. A situation where transactions are stuck
D. A data inconsistency issue
Correct Answer : C

Q629. Choose the correct option.


What is a database?
A. A collection of tables
B. A collection of records
C. A collection of software
D. A collection of hardware
Correct Answer : A

Q630. Choose the correct option.

What is the primary purpose of the isolation property of transactions?


A. To ensure data consistency
B. To maximize concurrency
C. To guarantee data durability
D. To enforce transaction limits
Correct Answer : B

Q631. Choose the correct option.

Which of the following is not a property of transactions?


A. Atomicity
B. Availability
C. Consistency
D. Durability
Correct Answer : B

Q632. Choose the correct option.

In a "for" loop, what does the loop counter do?


A. Tracks the number of iterations in the loop
B. Executes the loop code
C. Ends the loop
D. Declares a variable
Correct Answer : A
Q633. Choose the correct option.

Which model allows for complex objects and inheritance relationships in database design?
A. Object-oriented model
B. Relational model
C. ER model
D. Hierarchical model
Correct Answer : A

Q634. Choose the correct option.

Which of the following is true about parameter modes in PL/SQL procedures?


A. IN parameter is used for output values
B. OUT parameter is used for input values
C. IN OUT parameter can be both input and output
D. None of the above
Correct Answer : C

Q635. Choose the correct option.

Which normal form eliminates partial dependencies?


A. 2NF
B. 3NF
C. BCNF
D. 4NF
Correct Answer : A

Q636. Choose the correct option.

Data independence allows changes in the _______ level to be made without affecting the
_______ level
A. Logical, Physical
B. Physical, Logical
C. Conceptual, Logical
D. Logical, Conceptual
Correct Answer : B

Q637. Choose the correct option.

In a serializable schedule, which of the following is true?


A. Transactions can execute concurrently
B. Transactions must execute one after the other
C. Transactions can execute in any order
D. Transactions cannot be rolled back
Correct Answer : B

Q638. Choose the correct option.

Which normal form eliminates transitive dependencies?


A. 2NF
B. 3NF
C. BCNF
D. 4NF
Correct Answer : B

Q639. Choose the correct option.

What does the "break" statement do in programming?


A. Exits the loop prematurely
B. Returns a value
C. Continues to the next iteration
D. Declares a variable
Correct Answer : A

Q640. Choose the correct option.

Which error type occurs due to problems in the network or communication between
components?
A. System error
B. User error
C. Hardware error
D. Network error
Correct Answer : D

Q641. Choose the correct option.

In an ER diagram, what is the minimum cardinality of a strong (total) relationship?


A. 0
B. 1
C. 2
D. Many
Correct Answer : B

Q642. Choose the correct option.

Which statement is used to invoke a procedure from within another procedure or PL/SQL
block?
A. EXECUTE
B. CALL
C. RUN
D. BEGIN
Correct Answer : D

Q643. Choose the correct option.

Which type of trigger is fired before an UPDATE operation?


A. BEFORE UPDATE
B. AFTER UPDATE
C. BEFORE INSERT
D. AFTER INSERT
Correct Answer : A
Q644. Choose the correct option.

What is the purpose of the decomposition process in normalization?


A. To break tables into smaller, related tables
B. To combine tables into a single, large table
C. To create circular references
D. To enforce foreign key constraints
Correct Answer : A

Q645. Choose the correct option.

What is the primary function of SQL JOIN statements?


A. To combine rows from two or more tables based on a related column
B. To create a new table
C. To delete rows from a table
D. To insert data into a table
Correct Answer : A

Q646. Choose the correct option.

What is the main goal of a recovery manager in a database system?


A. To increase data storage
B. To improve query performance
C. To restore the database after a failure
D. To enforce data integrity
Correct Answer : C

Q647. Choose the correct option.

What does ER stand for in the ER model?


A. Entity-Relationship
B. Efficient Retrieval
C. Extended Relations
D. Entity-Record
Correct Answer : A
Q648. Choose the correct option.

What is a PL/SQL trigger used for?


A. Data retrieval
B. Data manipulation
C. Event-driven programming
D. Data validation
Correct Answer : C

Q649. Choose the correct option.

Which property of a transaction ensures that it leaves the database in a consistent state
regardless of failures?
A. Atomicity
B. Consistency
C. Isolation
D. Durability
Correct Answer : D

Q650. Choose the correct option.

In the relational model, what is the purpose of a primary key?


A. To uniquely identify rows
B. To establish relationships
C. To store binary data
D. To enforce data integrity
Correct Answer : A

Q651. Choose the correct option.

What does the SQL EXISTS keyword do in a subquery?


A. It checks if the subquery returns any rows
B. It checks if a column exists
C. It checks if a value is NULL
D. It checks if a value is empty
Correct Answer : A

Q652. Choose the correct option.

Which error type occurs when a user attempts to access data that they are not authorized
to access?
A. System error
B. User error
C. Hardware error
D. Access error
Correct Answer : D

Q653. Choose the correct option.

What is the purpose of a recovery manager in a database system?


A. To ensure data consistency
B. To prevent user errors
C. To restore the database after a failure
D. To improve query performance
Correct Answer : C

Q654. Choose the correct option.

Which property of transactions ensures that concurrent transactions do not interfere with
each other?
A. Atomicity
B. Consistency
C. Isolation
D. Durability
Correct Answer : C

Q655. Choose the correct option.


In a "do-while" loop, when is the loop condition evaluated?
A. After executing the loop code at least once
B. Before executing the loop code
C. Before declaring variables
D. After declaring variables
Correct Answer : A

Q656. Choose the correct option.

Which locking technique allows multiple transactions to read the same data but prevents
any updates until the first transaction completes?
A. Shared Locks
B. Exclusive Locks
C. Read Locks
D. Write Locks
Correct Answer : C

Q657. Choose the correct option.

Which level of data independence deals with the physical storage of data?
A. Physical
B. Logical
C. Conceptual
D. Structural
Correct Answer : A

Q658. Choose the correct option.

Which type of lock allows multiple transactions to read data concurrently but prevents any
write operations?
A. Shared Locks
B. Exclusive Locks
C. Read Locks
D. Write Locks
Correct Answer : A

Q659. Choose the correct option.

What is the main drawback of denormalization in a database?


A. Increased data redundancy
B. Improved query performance
C. Enhanced data integrity
D. Simplified data visualization
Correct Answer : A

Q660. Choose the correct option.

Which normal form allows multi-valued dependencies to be eliminated?


A. 2NF
B. 3NF
C. BCNF
D. 4NF
Correct Answer : C

Q661. Choose the correct option.

In SQL, which statement is used to add new rows of data to a table?


A. INSERT INTO
B. DELETE FROM
C. SELECT * FROM
D. UPDATE
Correct Answer : A

Q662. Choose the correct option.

What is the primary goal of the redo log in database recovery?


A. To undo changes made to the database
B. To track user activity
C. To record changes made to the database
D. To store database schema information
Correct Answer : C

Q663. Choose the correct option.

Which DBMS architecture is suitable for large-scale, distributed systems?


A. Hierarchical
B. Network
C. Centralized
D. Distributed
Correct Answer : D

Q664. Choose the correct option.

Which of the following is not a benefit of using PL/SQL packages?


A. Improved code organization
B. Enhanced data security
C. Simplified debugging
D. Increased database performance
Correct Answer : D

Q665. Choose the correct option.

What is the primary objective of normalizing a relational database?


A. To reduce data redundancy
B. To maximize data visualization
C. To optimize query performance
D. To introduce repeating groups
Correct Answer : A

Q666. Choose the correct option.

What is the primary goal of a database recovery technique?


A. To introduce data redundancy
B. To improve data security
C. To restore the database to a consistent state
D. To maximize query performance
Correct Answer : C

Q667. Choose the correct option.

What is the purpose of a check constraint in a database?


A. To ensure data security
B. To ensure data consistency
C. To ensure data retrieval
D. To ensure data validity
Correct Answer : D

Q668. Choose the correct option.

What does the two-phase locking protocol entail in concurrency control?


A. Locks are acquired and released in two phases
B. Locks are acquired and released simultaneously
C. Locks are never released
D. Locks are only acquired, not released
Correct Answer : A

Q669. Choose the correct option.

In which type of DBMS architecture is data stored in a parent-child relationship?


A. Client-Server
B. Hierarchical
C. Network
D. Distributed
Correct Answer : B
Q670. Choose the correct option.

In database programming, what is the primary purpose of a view?


A. To provide a virtual representation of data
B. To define a loop
C. To create a cursor
D. To execute a control structure
Correct Answer : A

Q671. Choose the correct option.

Which type of error occurs due to a hardware malfunction, such as a disk failure?
A. System error
B. User error
C. Hardware error
D. Network error
Correct Answer : C

Q672. Choose the correct option.

Which of the following is a common type of conditional statement in programming?


A. If-else
B. For loop
C. While loop
D. Switch-case
Correct Answer : A

Q673. Choose the correct option.

In an ER diagram, what is the purpose of a solid line connecting entities?


A. Denotes a strong relationship
B. Denotes a weak relationship
C. Indicates an attribute
D. Represents a constraint
Correct Answer : A
Q674. Choose the correct option.

Which normal form allows multi-valued dependencies to be eliminated and enforces a


constraint on join dependencies?
A. 2NF
B. 3NF
C. BCNF
D. 4NF
Correct Answer : D

Q675. Choose the correct option.

Which type of data independence ensures that application programs are unaffected by
changes in data storage?
A. Logical Data Independence
B. Physical Data Independence
C. Structural Data Independence
D. None of the above
Correct Answer : A

Q676. Choose the correct option.

Which normal form is also known as the "elementary key normal form"?
A. 1NF
B. 2NF
C. 3NF
D. BCNF
Correct Answer : A

Q677. Choose the correct option.

Which normal form allows multi-valued dependencies to exist, but not partial or transitive
dependencies?
A. 2NF
B. 3NF
C. BCNF
D. 4NF
Correct Answer : A

Q678. Choose the correct option.

What is an entity set in the context of the ER model?


A. A collection of entities
B. A collection of attributes
C. A collection of records
D. A collection of keys
Correct Answer : A

Q679. Choose the correct option.

Which parameter mode in PL/SQL allows a procedure to return a value to the caller?
A. IN
B. OUT
C. IN OUT
D. None of the above
Correct Answer : B

Q680. Choose the correct option.

Which recovery technique involves rolling back a specific transaction that caused an error?
A. Rollforward recovery
B. Rollback recovery
C. Point-in-time recovery
D. Restart recovery
Correct Answer : B

Q681. Choose the correct option.


Which of the following is a benefit of using a strict two-phase locking protocol?
A. Improved concurrency
B. Potential for deadlocks
C. Reduced transaction isolation
D. Faster transaction processing
Correct Answer : C

Q682. Choose the correct option.

Which recovery technique involves restoring the database to a previous state using a
backup copy?
A. Rollforward recovery
B. Rollback recovery
C. Point-in-time recovery
D. Restart recovery
Correct Answer : C

Q683. Choose the correct option.

In a client-server DBMS architecture, what does the client do?


A. Manages the database
B. Requests and displays data
C. Provides data security
D. Stores the data
Correct Answer : B

Q684. Choose the correct option.

Which DBMS architecture stores data in a tree-like structure?


A. Hierarchical
B. Network
C. Relational
D. Object-Oriented
Correct Answer : A
Q685. Choose the correct option.

In a database, what is the purpose of the primary key?


A. To uniquely identify rows
B. To enforce data integrity
C. To provide data security
D. To display data
Correct Answer : A

Q686. Choose the correct option.

What is full functional dependency (FFD) in the context of normalization?


A. An attribute depends on a proper subset of a candidate key
B. An attribute depends on the entire candidate key
C. An attribute has no dependencies
D. An attribute depends on another relation
Correct Answer : B

Q687. Choose the correct option.

Which type of relationship in an ER diagram indicates total participation of entities?


A. Total relationship
B. Partial relationship
C. Strong relationship
D. Weak relationship
Correct Answer : A

Q688. Choose the correct option.

What is one advantage of using a PL/SQL package?


A. Improved code organization
B. Faster SQL execution
C. Easier debugging
D. All of the above
Correct Answer : D

Q689. Choose the correct option.

Which SQL keyword is used to combine multiple conditions in a WHERE clause with logical
AND?
A. AND
B. OR
C. NOT
D. XOR
Correct Answer : A

Q690. Choose the correct option.

What is a functional dependency in a relational database?


A. A relationship between keys
B. A data type constraint
C. A data integrity rule
D. A data visualization concept
Correct Answer : A

Q691. Choose the correct option.

Which type of control structure is used for repeatedly executing a block of code as long as
a condition is true?
A. Iterative control
B. Sequential control
C. Conditional control
D. Cursor control
Correct Answer : A

Q692. Choose the correct option.


What is the primary purpose of the undo log in database recovery?
A. To undo changes made to the database
B. To track user activity
C. To record changes made to the database
D. To store database schema information
Correct Answer : A

Q693. Choose the correct option.

What is the purpose of integrity constraints in a database?


A. To ensure data security
B. To ensure data consistency
C. To ensure data retrieval
D. To ensure data visualization
Correct Answer : B

Q694. Choose the correct option.

Which type of relationship in an ER diagram indicates partial participation of entities?


A. Total relationship
B. Partial relationship
C. Strong relationship
D. Weak relationship
Correct Answer : B

Q695. Choose the correct option.

Which type of cursor in database programming allows both read and write operations on a
database table?
A. Updatable cursor
B. Read-only cursor
C. Static cursor
D. Dynamic cursor
Correct Answer : A
Q696. Choose the correct option.

Which type of trigger is fired before an INSERT operation?


A. BEFORE INSERT
B. AFTER INSERT
C. BEFORE UPDATE
D. AFTER UPDATE
Correct Answer : A

Q697. Choose the correct option.

What is the primary purpose of a lock manager in a database system?


A. To track user activity
B. To maintain data consistency
C. To ensure data durability
D. To manage lock requests
Correct Answer : D

Q698. Choose the correct option.

In the context of database recovery, what is a system error?


A. An error caused by the DBMS itself
B. An error caused by a user
C. An error in the database schema
D. An error in the network connection
Correct Answer : A

Q699. Choose the correct option.

What is the primary goal of a database checkpoint?


A. To prevent data access
B. To ensure data consistency
C. To maximize data storage
D. To record changes made to the database
Correct Answer : B

Q700. Choose the correct option.

What is the main purpose of a PL/SQL package specification?


A. To contain the actual code for procedures
B. To declare the package's interface
C. To store data for the package
D. To declare global variables for the package
Correct Answer : B

Q701. Choose the correct option.

In the context of normalization, what is a candidate key?


A. An attribute that uniquely identifies a tuple
B. An attribute that is not a key
C. An attribute that allows NULL values
D. An attribute that repeats frequently
Correct Answer : A

Q702. Choose the correct option.

Which DBMS architecture stores data in a tabular format with rows and columns?
A. Hierarchical
B. Network
C. Relational
D. Object-Oriented
Correct Answer : C

Q703. Choose the correct option.

Which of the following is not a primary function of a DBMS?


A. Data retrieval
B. Data integrity
C. Data security
D. Data visualization
Correct Answer : D

Q704. Choose the correct option.

In the context of database recovery, what is a rollback?


A. A recovery technique
B. An error in the database schema
C. A user-initiated undo operation
D. A checkpoint operation
Correct Answer : C

Q705. Choose the correct option.

What is the purpose of a "switch-case" statement in programming?


A. To perform different actions based on the value of an expression
B. To repeat code
C. To define a variable
D. To create a loop
Correct Answer : A

Q706. Choose the correct option.

What is the purpose of a foreign key in a database?


A. To enforce data integrity
B. To provide data security
C. To retrieve data
D. To display data
Correct Answer : A

Q707. Choose the correct option.

What is the syntax for creating a PL/SQL function?


A. CREATE FUNCTION
B. FUNCTION CREATE
C. DECLARE FUNCTION
D. DEFINE FUNCTION
Correct Answer : A

Q708. Choose the correct option.

What is a data model in the context of databases?


A. A representation of data
B. A collection of tables
C. A programming language
D. A database schema
Correct Answer : A

Q709. Choose the correct option.

Which normal form eliminates repeating groups in a relation?


A. 1NF
B. 2NF
C. 3NF
D. BCNF
Correct Answer : C

Q710. Choose the correct option.

Which parameter mode in PL/SQL allows you to pass values into a procedure?
A. IN
B. OUT
C. IN OUT
D. None of the above
Correct Answer : A
Q711. Choose the correct option.

In a relational database, what is a foreign key?


A. A key used for encryption
B. A key used for data storage
C. A key used for data retrieval
D. A key used for data integrity
Correct Answer : D

Q712. Choose the correct option.

Which type of integrity constraint enforces referential integrity between tables?


A. Primary Key Constraint
B. Foreign Key Constraint
C. Check Constraint
D. Default Constraint
Correct Answer : B

Q713. Choose the correct option.

In a transaction, which property ensures that it either fully completes or has no effect on
the database?
A. Atomicity
B. Consistency
C. Isolation
D. Durability
Correct Answer : A

Q714. Choose the correct option.

Which error type occurs due to a violation of data integrity constraints, such as unique
keys or referential integrity?
A. System error
B. User error
C. Integrity error
D. Security error
Correct Answer : C

Q715. Choose the correct option.

In a PL/SQL package, where are the public procedures and functions declared?
A. Package Header
B. Package Specification
C. Package Body
D. Package Interface
Correct Answer : B

Q716. Choose the correct option.

Which SQL statement is used to remove a table from a database?


A. DROP TABLE
B. ALTER TABLE
C. CREATE TABLE
D. INSERT INTO
Correct Answer : A

Q717. Choose the correct option.

What is the primary purpose of a PL/SQL trigger?


A. To define package procedures and functions
B. To declare variables within a package
C. To respond to specific database events
D. To store data within a package
Correct Answer : C

Q718. Choose the correct option.

What is the purpose of a "while" loop in programming?


A. To repeat a block of code while a condition is true
B. To make a decision
C. To define a function
D. To declare a variable
Correct Answer : A

Q719. Choose the correct option.

What is the primary purpose of conditional statements in programming?


A. To make decisions
B. To control loops
C. To define subroutines
D. To declare variables
Correct Answer : A

Q720. Choose the correct option.

What is a SQL subquery?


A. A query inside another query
B. A query that returns multiple rows
C. A query that joins multiple tables
D. A query that aggregates data
Correct Answer : A

Q721. Choose the correct option.

What is an advantage of using PL/SQL procedures?


A. Improved performance
B. Increased data security
C. Reduced code redundancy
D. All of the above
Correct Answer : D

Q722. Choose the correct option.

What is the primary goal of a DBMS's security features?


A. Data storage
B. Data retrieval
C. Data integrity
D. Data confidentiality
Correct Answer : D

Q723. Choose the correct option.

In a database system, what is the primary purpose of a commit statement?


A. To release all locks
B. To start a new transaction
C. To permanently save changes
D. To execute a query
Correct Answer : C

Q724. Choose the correct option.

What is a consistent state of a database?


A. A state where all data is the same
B. A state that complies with the database schema
C. A state where all transactions are complete
D. A state without locks
Correct Answer : B

Q725. Choose the correct option.

Which of the following is not a commonly used conditional operator in programming?


A. Multiplication operator (*)
B. Greater than operator (>)
C. Logical AND operator (&&)
D. Equal to operator (==)
Correct Answer : A
Q726. Choose the correct option.

In a relation, if attribute B is functionally dependent on attribute A, what does it mean?


A. Attribute B uniquely determines Attribute A
B. Attribute A uniquely determines Attribute B
C. Attribute A and B are unrelated
D. Attribute A and B are both primary keys
Correct Answer : B

Q727. Choose the correct option.

What is a cursor in the context of database programming?


A. A database query tool
B. A control structure
C. A database table
D. A database programming language
Correct Answer : A

Q728. Choose the correct option.

What is the primary purpose of a package body in PL/SQL?


A. To define the package's interface
B. To store data for the package
C. To contain the actual code for procedures
D. To declare variables for the package
Correct Answer : C

Q729. Choose the correct option.

What is a key attribute in the context of the ER model?


A. An attribute that is key
B. An attribute that is large
C. An entity that is key
D. A relationship that is key
Correct Answer : A
Q730. Choose the correct option.

In the context of programming, what is a "view"?


A. A virtual representation of data
B. A control structure
C. A loop in code
D. A cursor in a database
Correct Answer : A

Q731. Choose the correct option.

Which integrity constraint ensures that a column cannot have NULL values?
A. Primary Key Constraint
B. Foreign Key Constraint
C. Check Constraint
D. Default Constraint
Correct Answer : A

Q732. Choose the correct option.

What is the primary goal of a rollback operation in database recovery?


A. To restore the database to a consistent state
B. To prevent user errors
C. To improve data security
D. To maximize data storage
Correct Answer : A

Q733. Choose the correct option.

What is a data corruption error in the context of database recovery?


A. An error caused by a user
B. An error caused by hardware
C. An error in the database schema
D. An error that corrupts data in the database
Correct Answer : D

Q734. Choose the correct option.

Which parameter mode in PL/SQL allows a procedure to modify the value of the parameter
passed to it?
A. IN
B. OUT
C. IN OUT
D. None of the above
Correct Answer : C

Q735. Choose the correct option.

In a programming context, what does the "else" part of an "if-else" statement do?
A. It provides an alternative code block to execute if the condition is false
B. It repeats a loop
C. It declares a variable
D. It defines a function
Correct Answer : A

Q736. Choose the correct option.

What is the purpose of decomposition in the context of normalization?


A. To break down a table into smaller, related tables
B. To combine tables into a single large table
C. To create repeating groups
D. To enforce data integrity
Correct Answer : A

Q737. Choose the correct option.

Which error type occurs when the database management system itself fails or crashes?
A. System error
B. User error
C. Hardware error
D. Network error
Correct Answer : A

Q738. Choose the correct option.

What is the primary goal of BCNF (Boyce-Codd Normal Form)?


A. To minimize data redundancy
B. To eliminate data integrity issues
C. To optimize query performance
D. To ensure all attributes are keys
Correct Answer : B

Q739. Choose the correct option.

Which data model is suitable for representing hierarchical structures like organization
charts?
A. Object-oriented model
B. Relational model
C. ER model
D. Hierarchical model
Correct Answer : D

Q740. Choose the correct option.

Which type of data independence deals with the logical structure of the data?
A. Physical
B. Logical
C. Conceptual
D. Structural
Correct Answer : B
Q741. Choose the correct option.

Which type of DBMS architecture is known for its flexibility and scalability?
A. Distributed
B. Centralized
C. Hierarchical
D. Relational
Correct Answer : A

Q742. Choose the correct option.

What is the primary purpose of the SQL DELETE statement?


A. To remove rows from a table based on a condition
B. To insert new rows into a table
C. To update existing rows in a table
D. To create a new table
Correct Answer : A

Q743. Choose the correct option.

What is the primary purpose of the SQL GRANT statement?


A. To give permissions to users or roles to perform certain actions on database objects
B. To create a new table
C. To delete data from a table
D. To insert data into a table
Correct Answer : A

Q744. Choose the correct option.

What is the main difference between "if-else" and "switch-case" statements in


programming?
A. "if-else" tests a condition, while "switch-case" tests a value
B. "if-else" uses a loop
C. "switch-case" defines a variable
D. "switch-case" repeats code
Correct Answer : A

Q745. Choose the correct option.

In an ER diagram, what symbol represents an entity?


A. Rectangle
B. Oval
C. Diamond
D. Square
Correct Answer : A

Q746. Choose the correct option.

In a relation, what is a superkey?


A. An attribute that is not unique
B. An attribute that is a candidate key
C. A combination of attributes that uniquely identifies a tuple
D. An attribute that is not part of any key
Correct Answer : C

Q747. Choose the correct option.

Which SQL statement is used to control access to database objects?


A. GRANT
B. REVOKE
C. CREATE
D. DELETE
Correct Answer : A

Q748. Choose the correct option.

In an ER diagram, what does a crow's foot symbol represent?


A. Many entities
B. Weak relationship
C. Entity identification
D. A partial entity
Correct Answer : B

Q749. Choose the correct option.

Which normal form deals with atomic (indivisible) values in each column of a table?
A. 1NF
B. 2NF
C. 3NF
D. BCNF
Correct Answer : A

Q750. Choose the correct option.

What type of SQL JOIN returns only the rows that have matching values in both tables
being joined?
A. INNER JOIN
B. LEFT JOIN
C. RIGHT JOIN
D. FULL OUTER JOIN
Correct Answer : A

Q751. Choose the correct option.

What does 2NF (Second Normal Form) require in addition to 1NF?


A. No partial dependencies
B. Transitive dependencies
C. No repeating groups
D. Full functional dependencies
Correct Answer : B

Q752. Choose the correct option.


What is the primary focus of the relational model?
A. Data storage
B. Data retrieval
C. Data visualization
D. Data integrity
Correct Answer : B

Q753. Choose the correct option.

Which SQL keyword is used to create a subquery?


A. SELECT
B. FROM
C. WHERE
D. IN
Correct Answer : D

Q754. Choose the correct option.

What is a disadvantage of using a strict two-phase locking protocol in a database system?


A. Improved concurrency
B. Potential for deadlocks
C. Simpler implementation
D. Reduced data consistency
Correct Answer : B

Q755. Choose the correct option.

What does the term "cardinality" represent in an ER diagram?


A. The size of entities
B. The number of attributes
C. The type of relationship
D. The data type
Correct Answer : C
Q756. Choose the correct option.

Which DBMS architecture is suitable for small-scale applications with low data volume?
A. Client-Server
B. Distributed
C. Centralized
D. Hierarchical
Correct Answer : C

Q757. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

Retrieve the names of authors who have written books with more available copies than
the average available copies of all books in the library.
A. SELECT author_name FROM Authors WHERE author_id = (SELECT author_id FROM
Books WHERE available_copies > (SELECT AVG(available_copies) FROM Books))
B. SELECT author_name FROM Authors WHERE author_id IN (SELECT author_id FROM
Books WHERE available_copies > (SELECT AVG(available_copies) FROM Books))
C. SELECT author_name FROM Authors WHERE author_id IN (SELECT author_id FROM
Books WHERE available_copies >= (SELECT AVG(available_copies) FROM Books))
D. SELECT author_name FROM Authors WHERE author_id = (SELECT author_id FROM
Books WHERE available_copies >= (SELECT AVG(available_copies) FROM Books))
Correct Answer : B

Q758. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

Find the titles of books that were borrowed before any book by a specific author.
A. SELECT title FROM Books WHERE book_id = (SELECT book_id FROM Borrowers WHERE
borrow_date < ALL (SELECT borrow_date FROM Borrowers WHERE book_id IN (SELECT
book_id FROM Books WHERE author_id = [author_id])))
B. SELECT title FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers WHERE
borrow_date < ALL (SELECT borrow_date FROM Borrowers WHERE book_id IN (SELECT
book_id FROM Books WHERE author_id = [author_id])))
C. SELECT title FROM Books WHERE book_id = (SELECT book_id FROM Borrowers WHERE
borrow_date < ANY (SELECT borrow_date FROM Borrowers WHERE book_id IN (SELECT
book_id FROM Books WHERE author_id = [author_id])))
D. SELECT title FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers WHERE
borrow_date < ANY (SELECT borrow_date FROM Borrowers WHERE book_id IN (SELECT
book_id FROM Books WHERE author_id = [author_id])))
Correct Answer : B

Q759. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

List the authors who have written books that were never borrowed.
A. SELECT author_name FROM Authors WHERE author_id NOT IN (SELECT author_id
FROM Books)
B. SELECT author_name FROM Authors WHERE author_id NOT IN (SELECT author_id
FROM Borrowers WHERE book_id IN (SELECT book_id FROM Books))
C. SELECT author_name FROM Authors WHERE author_id NOT IN (SELECT author_id
FROM Borrowers WHERE book_id NOT IN (SELECT book_id FROM Books))
D. SELECT author_name FROM Authors WHERE author_id IN (SELECT author_id FROM
Books WHERE book_id NOT IN (SELECT book_id FROM Borrowers))
Correct Answer : B

Q760. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

Find the titles of books borrowed by a borrower named 'John' on the same day they were
borrowed.
A. SELECT title FROM Books WHERE book_id = (SELECT book_id FROM Borrowers WHERE
borrower_id = (SELECT borrower_id FROM Borrowers WHERE borrower_name = 'John')
AND borrow_date = return_date)
B. SELECT title FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers WHERE
borrower_id = (SELECT borrower_id FROM Borrowers WHERE borrower_name = 'John')
AND borrow_date = return_date)
C. SELECT title FROM Books WHERE book_id = (SELECT book_id FROM Borrowers WHERE
borrower_id = (SELECT borrower_id FROM Borrowers WHERE borrower_name = 'John')
AND borrow_date = borrow_date)
D. SELECT title FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers WHERE
borrower_id = (SELECT borrower_id FROM Borrowers WHERE borrower_name = 'John')
AND borrow_date = borrow_date)
Correct Answer : B

Q761. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

Get the titles of books borrowed by a borrower whose name contains 'Smith'.
A. SELECT B.title FROM Books AS B JOIN Borrowers AS Br ON B.book_id = Br.book_id
WHERE Br.borrower_name = 'Smith'
B. SELECT B.title FROM Books AS B JOIN Borrowers AS Br ON B.book_id = Br.book_id
WHERE Br.borrower_name LIKE '%Smith%'
C. SELECT B.title FROM Books AS B JOIN Borrowers AS Br ON B.book_id = Br.book_id
WHERE Br.borrower_name = '%Smith%'
D. SELECT B.title FROM Books AS B JOIN Borrowers AS Br ON B.book_id = Br.book_id
WHERE Br.borrower_name = 'Smith%'
Correct Answer : B

Q762. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_
Retrieve the names of authors and the titles of their books.
A. SELECT A.author_name, B.title FROM Authors AS A JOIN Books AS B ON A.author_id =
B.author_id
B. SELECT A.author_name, B.title FROM Authors AS A LEFT JOIN Books AS B ON
A.author_id = B.author_id
C. SELECT A.author_name, B.title FROM Authors AS A RIGHT JOIN Books AS B ON
A.author_id = B.author_id
D. SELECT A.author_name, B.title FROM Authors AS A FULL JOIN Books AS B ON
A.author_id = B.author_id
Correct Answer : A

Q763. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

List the borrowers who borrowed books and include the author's name for each borrowed
book.
A. SELECT Br.borrower_name, B.title, A.author_name FROM Borrowers AS Br JOIN Books
AS B ON Br.book_id = B.book_id LEFT JOIN Authors AS A ON B.author_id = A.author_id
B. SELECT Br.borrower_name, B.title, A.author_name FROM Borrowers AS Br JOIN Books
AS B ON Br.book_id = B.book_id
C. SELECT Br.borrower_name, B.title, A.author_name FROM Borrowers AS Br LEFT JOIN
Books AS B ON Br.book_id = B.book_id JOIN Authors AS A ON B.author_id = A.author_id
D. SELECT Br.borrower_name, B.title, A.author_name FROM Borrowers AS Br FULL JOIN
Books AS B ON Br.book_id = B.book_id JOIN Authors AS A ON B.author_id = A.author_id
Correct Answer : A

Q764. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

Find the titles of books borrowed by borrowers with a specific name.


A. SELECT B.title FROM Books AS B JOIN Borrowers AS Br ON B.book_id = Br.book_id
WHERE Br.borrower_name = 'John'
B. SELECT B.title FROM Books AS B JOIN Borrowers AS Br ON B.book_id = Br.book_id
WHERE Br.borrower_name LIKE 'John'
C. SELECT B.title FROM Books AS B JOIN Borrowers AS Br ON B.book_id = Br.book_id
WHERE Br.borrower_name = '%John%'
D. SELECT B.title FROM Books AS B JOIN Borrowers AS Br ON B.book_id = Br.book_id
WHERE Br.borrower_name LIKE '%John%'
Correct Answer : A

Q765. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

Retrieve the authors and the total number of copies of their books available in the library.
A. SELECT A.author_name, COUNT(B.available_copies) AS total_available_copies FROM
Authors AS A JOIN Books AS B ON A.author_id = B.author_id GROUP BY A.author_name
B. SELECT A.author_name, SUM(B.available_copies) AS total_available_copies FROM
Authors AS A JOIN Books AS B ON A.author_id = B.author_id GROUP BY A.author_name
C. SELECT A.author_name, AVG(B.available_copies) AS total_available_copies FROM
Authors AS A JOIN Books AS B ON A.author_id = B.author_id GROUP BY A.author_name
D. SELECT A.author_name, MAX(B.available_copies) AS total_available_copies FROM
Authors AS A JOIN Books AS B ON A.author_id = B.author_id GROUP BY A.author_name
Correct Answer : B

Q766. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

List the borrowers who have borrowed multiple books, along with the titles of those
books.
A. SELECT Br.borrower_name, B.title FROM Borrowers AS Br JOIN Books AS B ON
Br.book_id = B.book_id GROUP BY Br.borrower_name, B.title HAVING COUNT(B.book_id)
=1
B. SELECT Br.borrower_name, B.title FROM Borrowers AS Br JOIN Books AS B ON
Br.book_id = B.book_id GROUP BY Br.borrower_name, B.title HAVING COUNT(B.book_id)
>1
C. SELECT Br.borrower_name, B.title FROM Borrowers AS Br JOIN Books AS B ON
Br.book_id = B.book_id GROUP BY Br.borrower_name, B.title
D. SELECT Br.borrower_name, B.title FROM Borrowers AS Br JOIN Books AS B ON
Br.book_id = B.book_id GROUP BY Br.borrower_name HAVING COUNT(B.book_id) > 1
Correct Answer : B

Q767. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

Find the titles of books that were borrowed and returned.


A. SELECT title FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers WHERE
return_date IS NULL)
B. SELECT title FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers WHERE
return_date IS NOT NULL)
C. SELECT title FROM Books WHERE book_id NOT IN (SELECT book_id FROM Borrowers
WHERE return_date IS NULL)
D. SELECT title FROM Books WHERE book_id NOT IN (SELECT book_id FROM Borrowers
WHERE return_date IS NOT NULL)
Correct Answer : B

Q768. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

List the books that have never been borrowed.


A. SELECT title FROM Books WHERE book_id IN (SELECT DISTINCT book_id FROM
Borrowers)
B. SELECT title FROM Books WHERE book_id NOT IN (SELECT book_id FROM Borrowers)
C. SELECT title FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers WHERE
return_date IS NULL)
D. SELECT title FROM Books WHERE book_id NOT IN (SELECT DISTINCT book_id FROM
Borrowers)
Correct Answer : B

Q769. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

Retrieve the authors who have books available in the library and books that have been
borrowed.
A. SELECT A.author_name FROM Authors AS A WHERE A.author_id IN (SELECT
B.author_id FROM Books AS B)
B. SELECT A.author_name FROM Authors AS A WHERE A.author_id IN (SELECT
B.author_id FROM Borrowers AS Br JOIN Books AS B ON Br.book_id = B.book_id)
C. SELECT A.author_name FROM Authors AS A WHERE A.author_id IN (SELECT
B.author_id FROM Books AS B) AND A.author_id IN (SELECT B.author_id FROM Borrowers
AS Br JOIN Books AS B ON Br.book_id = B.book_id)
D. SELECT A.author_name FROM Authors AS A WHERE A.author_id NOT IN (SELECT
B.author_id FROM Books AS B) AND A.author_id NOT IN (SELECT B.author_id FROM
Borrowers AS Br JOIN Books AS B ON Br.book_id = B.book_id)
Correct Answer : C

Q770. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

Get the titles of books that were borrowed by more than one borrower.
A. SELECT title FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers GROUP
BY book_id HAVING COUNT(borrower_id) = 1)
B. SELECT title FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers GROUP
BY book_id HAVING COUNT(borrower_id) > 1)
C. SELECT title FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers GROUP
BY book_id HAVING COUNT(*) = 1)
D. SELECT title FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers GROUP
BY book_id HAVING COUNT(*) > 1)
Correct Answer : B

Q771. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

Find the names of borrowers who have borrowed books written by specific authors.
A. SELECT DISTINCT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id IN
(SELECT book_id FROM Books WHERE author_id = [author_id])
B. SELECT DISTINCT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id IN
(SELECT book_id FROM Books WHERE author_id = [author_id]) AND Br.book_id IN
(SELECT book_id FROM Borrowers WHERE return_date IS NOT NULL)
C. SELECT DISTINCT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id IN
(SELECT book_id FROM Books WHERE author_id = [author_id]) OR Br.book_id IN (SELECT
book_id FROM Borrowers WHERE return_date IS NULL)
D. SELECT DISTINCT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id IN
(SELECT book_id FROM Books WHERE author_id = [author_id]) OR Br.borrower_name IN
(SELECT DISTINCT borrower_name FROM Borrowers WHERE return_date IS NULL)
Correct Answer : A

Q772. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_
Retrieve the authors who have books available in the library and books that have been
borrowed but are not written by the same author.
A. SELECT A.author_name FROM Authors AS A WHERE A.author_id IN (SELECT
B.author_id FROM Books AS B)
B. SELECT A.author_name FROM Authors AS A WHERE A.author_id IN (SELECT
B.author_id FROM Borrowers AS Br JOIN Books AS B ON Br.book_id = B.book_id)
C. SELECT A.author_name FROM Authors AS A WHERE A.author_id IN (SELECT
B.author_id FROM Books AS B) AND A.author_id IN (SELECT B.author_id FROM Borrowers
AS Br JOIN Books AS B ON Br.book_id = B.book_id)
D. SELECT A.author_name FROM Authors AS A WHERE A.author_id NOT IN (SELECT
B.author_id FROM Books AS B) AND A.author_id NOT IN (SELECT B.author_id FROM
Borrowers AS Br JOIN Books AS B ON Br.book_id = B.book_id)
Correct Answer : D

Q773. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

List the books that are either available in the library or were borrowed by a borrower
named 'Alice.'
A. SELECT title FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers WHERE
borrower_name = 'Alice') OR book_id IN (SELECT book_id FROM Books)
B. SELECT title FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers WHERE
borrower_name = 'Alice') AND book_id IN (SELECT book_id FROM Books)
C. SELECT title FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers WHERE
borrower_name <> 'Alice') OR book_id IN (SELECT book_id FROM Books)
D. SELECT title FROM Books WHERE book_id NOT IN (SELECT book_id FROM Borrowers
WHERE borrower_name = 'Alice') OR book_id NOT IN (SELECT book_id FROM Books)
Correct Answer : A

Q774. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_
Find the borrowers who borrowed books with a specific title or borrowed books from a
specific author.
A. SELECT DISTINCT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id IN
(SELECT book_id FROM Books WHERE title = 'Specific Title') OR Br.book_id IN (SELECT
book_id FROM Books WHERE author_id = [author_id])
B. SELECT DISTINCT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id IN
(SELECT book_id FROM Books WHERE title = 'Specific Title') AND Br.book_id IN (SELECT
book_id FROM Books WHERE author_id = [author_id])
C. SELECT DISTINCT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id IN
(SELECT book_id FROM Books WHERE title <> 'Specific Title') OR Br.book_id IN (SELECT
book_id FROM Books WHERE author_id <> [author_id])
D. SELECT DISTINCT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id NOT IN
(SELECT book_id FROM Books WHERE title = 'Specific Title') AND Br.borrower_name NOT
IN (SELECT DISTINCT borrower_name FROM Borrowers WHERE author_id = [author_id])
Correct Answer : A

Q775. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

Get the titles of books that were borrowed and returned, or have more available copies
than the average.
A. SELECT title FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers WHERE
return_date IS NULL) OR available_copies > (SELECT AVG(available_copies) FROM Books)
B. SELECT title FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers WHERE
return_date IS NOT NULL) AND available_copies > (SELECT AVG(available_copies) FROM
Books)
C. SELECT title FROM Books WHERE book_id NOT IN (SELECT book_id FROM Borrowers
WHERE return_date IS NULL) OR available_copies > (SELECT AVG(available_copies) FROM
Books)
D. SELECT title FROM Books WHERE book_id NOT IN (SELECT book_id FROM Borrowers
WHERE return_date IS NOT NULL) AND available_copies > (SELECT AVG(available_copies)
FROM Books)
Correct Answer : A
Q776. Consider the Library Database with Following tables
Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

List the borrowers who borrowed books but have not yet returned them and were not
written by a specific author.
A. SELECT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id IN (SELECT
book_id FROM Books WHERE author_id <> [author_id]) AND Br.book_id NOT IN (SELECT
book_id FROM Borrowers WHERE return_date IS NOT NULL)
B. SELECT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id NOT IN (SELECT
book_id FROM Books WHERE author_id = [author_id]) AND Br.borrower_name NOT IN
(SELECT DISTINCT borrower_name FROM Borrowers WHERE return_date IS NOT NULL)
C. SELECT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id IN (SELECT
book_id FROM Books WHERE author_id = [author_id]) AND Br.borrower_name NOT IN
(SELECT DISTINCT borrower_name FROM Borrowers WHERE return_date IS NOT NULL)
D. SELECT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id NOT IN (SELECT
book_id FROM Books WHERE author_id <> [author_id]) OR Br.book_id IN (SELECT
book_id FROM Borrowers WHERE return_date IS NOT NULL)
Correct Answer : A

Q777. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

Retrieve the authors who have never written a book with more than 10 available copies in
the library.
A. SELECT author_name FROM Authors WHERE author_id IN (SELECT author_id FROM
Books WHERE available_copies > 10)
B. SELECT author_name FROM Authors WHERE author_id NOT IN (SELECT author_id
FROM Books WHERE available_copies > 10)
C. SELECT author_name FROM Authors WHERE author_id NOT IN (SELECT author_id
FROM Books WHERE available_copies <= 10)
D. SELECT author_name FROM Authors WHERE author_id IN (SELECT author_id FROM
Books WHERE available_copies <= 10)
Correct Answer : B

Q778. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

Find the titles of books that have been borrowed by the same borrower more than once on
different dates.
A. SELECT title FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers GROUP
BY book_id, borrower_id HAVING COUNT(borrower_id) > 1)
B. SELECT title FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers GROUP
BY book_id, borrower_id HAVING COUNT(DISTINCT borrow_date) > 1)
C. SELECT title FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers GROUP
BY book_id HAVING COUNT(DISTINCT borrower_id) > 1)
D. SELECT title FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers GROUP
BY book_id, borrower_id HAVING COUNT(borrow_date) > 1)
Correct Answer : B

Q779. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

List the authors who have written books that were borrowed by more than one borrower,
and the total number of borrowers for each book.
A. SELECT A.author_name, B.title, COUNT(DISTINCT Br.borrower_id) AS total_borrowers
FROM Authors AS A JOIN Books AS B ON A.author_id = B.author_id JOIN Borrowers AS Br
ON B.book_id = Br.book_id GROUP BY A.author_name, B.title HAVING COUNT(DISTINCT
Br.borrow
B. SELECT A.author_name, B.title, COUNT(DISTINCT Br.borrower_id) AS total_borrowers
FROM Authors AS A JOIN Books AS B ON A.author_id = B.author_id JOIN Borrowers AS Br
ON B.book_id = Br.book_id GROUP BY A.author_name, B.title HAVING COUNT(DISTINCT
Br.borrow
C. SELECT A.author_name, B.title, COUNT(DISTINCT Br.borrower_id) AS total_borrowers
FROM Authors AS A JOIN Books AS B ON A.author_id = B.author_id JOIN Borrowers AS Br
ON B.book_id = Br.book_id GROUP BY A.author_name, B.title
D. SELECT A.author_name, B.title, COUNT(DISTINCT Br.borrower_id) AS total_borrowers
FROM Authors AS A JOIN Books AS B ON A.author_id = B.author_id JOIN Borrowers AS Br
ON B.book_id = Br.book_id GROUP BY A.author_name, B.title HAVING COUNT(DISTINCT
Br.borrow
Correct Answer : A

Q780. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

Find the titles of books that were borrowed by more than one borrower with the same
name.
A. SELECT title FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers GROUP
BY book_id, borrower_name HAVING COUNT(borrower_name) > 1)
B. SELECT title FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers GROUP
BY book_id, borrower_name HAVING COUNT(borrower_name) = 1)
C. SELECT title FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers GROUP
BY book_id, borrower_name HAVING COUNT(DISTINCT borrower_id) > 1)
D. SELECT title FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers GROUP
BY book_id, borrower_name HAVING COUNT(DISTINCT borrower_id) = 1)
Correct Answer : A

Q781. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

Retrieve the names of authors who have written books borrowed by a borrower named
'Alice' but not by a borrower named 'Bob.'
A. SELECT author_name FROM Authors WHERE author_id IN (SELECT author_id FROM
Books WHERE book_id IN (SELECT book_id FROM Borrowers WHERE borrower_name =
'Alice')) AND author_id NOT IN (SELECT author_id FROM Books WHERE book_id IN
(SELECT book_id FROM Borrow
B. SELECT author_name FROM Authors WHERE author_id IN (SELECT author_id FROM
Books WHERE book_id IN (SELECT book_id FROM Borrowers WHERE borrower_name =
'Alice')) AND author_id IN (SELECT author_id FROM Books WHERE book_id IN (SELECT
book_id FROM Borrowers
C. SELECT author_name FROM Authors WHERE author_id NOT IN (SELECT author_id
FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers WHERE
borrower_name = 'Alice')) AND author_id NOT IN (SELECT author_id FROM Books WHERE
book_id IN (SELECT book_id FROM Bo
D. SELECT author_name FROM Authors WHERE author_id IN (SELECT author_id FROM
Books WHERE book_id IN (SELECT book_id FROM Borrowers WHERE borrower_name =
'Alice')) OR author_id IN (SELECT author_id FROM Books WHERE book_id IN (SELECT
book_id FROM Borrowers W
Correct Answer : A

Q782. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

List the borrowers who borrowed books that have more available copies than the average
available copies of books written by their corresponding authors.
A. SELECT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id IN (SELECT
book_id FROM Books WHERE available_copies > (SELECT AVG(B1.available_copies) FROM
Books AS B1 WHERE B1.author_id = (SELECT author_id FROM Books WHERE book_id =
Br.book_id)))
B. SELECT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id IN (SELECT
book_id FROM Books WHERE available_copies > (SELECT AVG(available_copies) FROM
Books))
C. SELECT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id NOT IN (SELECT
book_id FROM Books WHERE available_copies > (SELECT AVG(B1.available_copies) FROM
Books AS B1 WHERE B1.author_id = (SELECT author_id FROM Books WHERE book_id =
Br.book_id)))
D. SELECT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id NOT IN (SELECT
book_id FROM Books WHERE available_copies > (SELECT AVG(available_copies) FROM
Books))
Correct Answer : A

Q783. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

Retrieve the names of borrowers who have borrowed the same book more than once with
a different return date.
A. SELECT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id IN (SELECT
book_id FROM Borrowers WHERE borrower_id = Br.borrower_id GROUP BY book_id
HAVING COUNT(DISTINCT return_date) > 1)
B. SELECT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id IN (SELECT
book_id FROM Borrowers WHERE borrower_id = Br.borrower_id GROUP BY book_id
HAVING COUNT(return_date) > 1)
C. SELECT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id NOT IN (SELECT
book_id FROM Borrowers WHERE borrower_id = Br.borrower_id GROUP BY book_id
HAVING COUNT(DISTINCT return_date) > 1)
D. SELECT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id NOT IN (SELECT
book_id FROM Borrowers WHERE borrower_id = Br.borrower_id GROUP BY book_id
HAVING COUNT(return_date) > 1)
Correct Answer : A

Q784. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

List the authors who have written books that have never been borrowed by a borrower
with the name 'David.'
A. SELECT author_name FROM Authors WHERE author_id IN (SELECT author_id FROM
Books WHERE book_id NOT IN (SELECT book_id FROM Borrowers WHERE borrower_name
= 'David'))
B. SELECT author_name FROM Authors WHERE author_id NOT IN (SELECT author_id
FROM Books WHERE book_id NOT IN (SELECT book_id FROM Borrowers WHERE
borrower_name = 'David'))
C. SELECT author_name FROM Authors WHERE author_id IN (SELECT author_id FROM
Books WHERE book_id IN (SELECT book_id FROM Borrowers WHERE borrower_name =
'David'))
D. SELECT author_name FROM Authors WHERE author_id NOT IN (SELECT author_id
FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers WHERE
borrower_name = 'David'))
Correct Answer : A

Q785. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

Find the names of borrowers who have borrowed books on a date that is earlier than the
date any book was published by a specific author.
A. SELECT Br.borrower_name FROM Borrowers AS Br WHERE Br.borrow_date < (SELECT
MIN(publish_date) FROM Books WHERE author_id = [author_id])
B. SELECT Br.borrower_name FROM Borrowers AS Br WHERE Br.borrow_date < (SELECT
MAX(publish_date) FROM Books WHERE author_id = [author_id])
C. SELECT Br.borrower_name FROM Borrowers AS Br WHERE Br.borrow_date < (SELECT
AVG(publish_date) FROM Books WHERE author_id = [author_id])
D. SELECT Br.borrower_name FROM Borrowers AS Br WHERE Br.borrow_date < (SELECT
publish_date FROM Books WHERE author_id = [author_id] LIMIT 1)
Correct Answer : A

Q786. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

Get the names of borrowers who have borrowed more books than the average number of
books borrowed by all borrowers.
A. SELECT Br.borrower_name FROM Borrowers AS Br GROUP BY Br.borrower_name
HAVING COUNT(Br.book_id) > (SELECT AVG(book_count) FROM (SELECT COUNT(book_id)
AS book_count FROM Borrowers GROUP BY borrower_name) AS AvgCount)
B. SELECT Br.borrower_name FROM Borrowers AS Br GROUP BY Br.borrower_name
HAVING COUNT(Br.book_id) < (SELECT AVG(book_count) FROM (SELECT COUNT(book_id)
AS book_count FROM Borrowers GROUP BY borrower_name) AS AvgCount)
C. SELECT Br.borrower_name FROM Borrowers AS Br GROUP BY Br.borrower_name
HAVING COUNT(Br.book_id) = (SELECT AVG(book_count) FROM (SELECT COUNT(book_id)
AS book_count FROM Borrowers GROUP BY borrower_name) AS AvgCount)
D. SELECT Br.borrower_name FROM Borrowers AS Br GROUP BY Br.borrower_name
HAVING COUNT(Br.book_id) > (SELECT AVG(book_count) FROM (SELECT COUNT(book_id)
AS book_count FROM Borrowers GROUP BY borrower_name) AS AvgCount)
Correct Answer : A

Q787. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

Retrieve the titles of books that have been borrowed and returned more than once, along
with the total number of times they were borrowed and returned.
A. SELECT title, COUNT(Br.book_id) AS total_borrow_return FROM Books AS B JOIN
Borrowers AS Br ON B.book_id = Br.book_id WHERE Br.return_date IS NOT NULL GROUP
BY B.title HAVING COUNT(Br.book_id) > 1
B. SELECT title, COUNT(Br.book_id) AS total_borrow_return FROM Books AS B JOIN
Borrowers AS Br ON B.book_id = Br.book_id WHERE Br.return_date IS NOT NULL GROUP
BY B.title HAVING COUNT(Br.book_id) = 1
C. SELECT title, COUNT(Br.book_id) AS total_borrow_return FROM Books AS B JOIN
Borrowers AS Br ON B.book_id = Br.book_id WHERE Br.return_date IS NOT NULL GROUP
BY B.title
D. SELECT title, COUNT(Br.book_id) AS total_borrow_return FROM Books AS B JOIN
Borrowers AS Br ON B.book_id = Br.book_id WHERE Br.return_date IS NULL GROUP BY
B.title HAVING COUNT(Br.book_id) > 1
Correct Answer : A

Q788. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

List the authors who have not written any books that have been borrowed by borrowers
with the name 'Mary' on the same day.
A. SELECT A.author_name FROM Authors AS A WHERE A.author_id IN (SELECT author_id
FROM Books WHERE book_id NOT IN (SELECT book_id FROM Borrowers WHERE
borrower_name = 'Mary' AND borrow_date = [specific_date]))
B. SELECT A.author_name FROM Authors AS A WHERE A.author_id NOT IN (SELECT
author_id FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers WHERE
borrower_name = 'Mary' AND borrow_date = [specific_date]))
C. SELECT A.author_name FROM Authors AS A WHERE A.author_id IN (SELECT author_id
FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers WHERE
borrower_name = 'Mary' AND borrow_date = [specific_date]))
D. SELECT A.author_name FROM Authors AS A WHERE A.author_id NOT IN (SELECT
author_id FROM Books WHERE book_id NOT IN (SELECT book_id FROM Borrowers
WHERE borrower_name = 'Mary' AND borrow_date = [specific_date]))
Correct Answer : A

Q789. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

Find the authors who have written books borrowed by borrowers with names that contain
the letter 'Z,' and display the titles of those books.
A. SELECT A.author_name, B.title FROM Authors AS A JOIN Books AS B ON A.author_id =
B.author_id WHERE B.book_id IN (SELECT book_id FROM Borrowers WHERE
borrower_name LIKE '%Z%')
B. SELECT A.author_name, B.title FROM Authors AS A JOIN Books AS B ON A.author_id =
B.author_id WHERE B.book_id IN (SELECT book_id FROM Borrowers WHERE
borrower_name = 'Z')
C. SELECT A.author_name, B.title FROM Authors AS A JOIN Books AS B ON A.author_id =
B.author_id WHERE B.book_id IN (SELECT book_id FROM Borrowers WHERE
borrower_name LIKE 'Z')
D. SELECT A.author_name, B.title FROM Authors AS A JOIN Books AS B ON A.author_id =
B.author_id WHERE B.book_id IN (SELECT book_id FROM Borrowers WHERE
borrower_name = 'Z')
Correct Answer : A

Q790. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

Retrieve the titles of books that have been borrowed by borrowers who have also
borrowed books by a specific author.
A. SELECT title FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers WHERE
borrower_id IN (SELECT borrower_id FROM Borrowers WHERE book_id IN (SELECT
book_id FROM Books WHERE author_id = [author_id])))
B. SELECT title FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers WHERE
borrower_id IN (SELECT borrower_id FROM Borrowers WHERE book_id IN (SELECT
book_id FROM Books WHERE author_id <> [author_id])))
C. SELECT title FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers WHERE
borrower_id NOT IN (SELECT borrower_id FROM Borrowers WHERE book_id IN (SELECT
book_id FROM Books WHERE author_id = [author_id])))
D. SELECT title FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers WHERE
borrower_id NOT IN (SELECT borrower_id FROM Borrowers WHERE book_id IN (SELECT
book_id FROM Books WHERE author_id <> [author_id])))
Correct Answer : A
Q791. Consider the Library Database with Following tables
Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

List the borrowers who have borrowed books from authors who have not written any
books with more than 5 available copies.
A. SELECT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id IN (SELECT
book_id FROM Books WHERE author_id NOT IN (SELECT author_id FROM Books WHERE
available_copies > 5))
B. SELECT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id IN (SELECT
book_id FROM Books WHERE author_id NOT IN (SELECT author_id FROM Books WHERE
available_copies <= 5))
C. SELECT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id NOT IN (SELECT
book_id FROM Books WHERE author_id NOT IN (SELECT author_id FROM Books WHERE
available_copies > 5))
D. SELECT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id NOT IN (SELECT
book_id FROM Books WHERE author_id NOT IN (SELECT author_id FROM Books WHERE
available_copies <= 5))
Correct Answer : A

Q792. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

Retrieve the names of borrowers who have borrowed books with titles that contain the
word 'Database' and were published in the same year as a book written by a specific author.
A. SELECT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id IN (SELECT
book_id FROM Books WHERE title LIKE '%Database%' AND EXTRACT(YEAR FROM
publish_date) = (SELECT EXTRACT(YEAR FROM publish_date) FROM Books WHERE
author_id = [author_id]))
B. SELECT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id IN (SELECT
book_id FROM Books WHERE title LIKE '%Database%' AND EXTRACT(YEAR FROM
publish_date) = (SELECT EXTRACT(YEAR FROM publish_date) FROM Books WHERE
author_id <> [author_id]))
C. SELECT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id NOT IN (SELECT
book_id FROM Books WHERE title LIKE '%Database%' AND EXTRACT(YEAR FROM
publish_date) = (SELECT EXTRACT(YEAR FROM publish_date) FROM Books WHERE
author_id = [author_id]))
D. SELECT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id NOT IN (SELECT
book_id FROM Books WHERE title LIKE '%Database%' AND EXTRACT(YEAR FROM
publish_date) = (SELECT EXTRACT(YEAR FROM publish_date) FROM Books WHERE
author_id <> [author_id]))
Correct Answer : A

Q793. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

Find the authors who have written books that have never been borrowed by any borrower.
A. SELECT author_name FROM Authors WHERE author_id IN (SELECT author_id FROM
Books WHERE book_id NOT IN (SELECT book_id FROM Borrowers))
B. SELECT author_name FROM Authors WHERE author_id NOT IN (SELECT author_id
FROM Books WHERE book_id NOT IN (SELECT book_id FROM Borrowers))
C. SELECT author_name FROM Authors WHERE author_id IN (SELECT author_id FROM
Books WHERE book_id IN (SELECT book_id FROM Borrowers))
D. SELECT author_name FROM Authors WHERE author_id NOT IN (SELECT author_id
FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers))
Correct Answer : A

Q794. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

Retrieve the titles of books that have been borrowed by all borrowers.
A. SELECT title FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers GROUP
BY book_id HAVING COUNT(DISTINCT borrower_id) = (SELECT COUNT(DISTINCT
borrower_id) FROM Borrowers))
B. SELECT title FROM Books WHERE book_id NOT IN (SELECT book_id FROM Borrowers)
C. SELECT title FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers GROUP
BY book_id HAVING COUNT(DISTINCT borrower_id) > 1)
D. SELECT title FROM Books WHERE book_id NOT IN (SELECT book_id FROM Borrowers
GROUP BY book_id HAVING COUNT(DISTINCT borrower_id) = (SELECT COUNT(DISTINCT
borrower_id) FROM Borrowers))
Correct Answer : A

Q795. Consider the Library Database with Following tables


Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

List the authors who have written books borrowed by borrowers named 'John' and 'Jane,'
but not borrowed by 'Alice' or 'Bob.'
A. SELECT A.author_name FROM Authors AS A WHERE A.author_id IN (SELECT author_id
FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers WHERE
borrower_name = 'John')) AND A.author_id IN (SELECT author_id FROM Books WHERE
book_id IN (SELECT book_id FROM
B. SELECT A.author_name FROM Authors AS A WHERE A.author_id IN (SELECT author_id
FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers WHERE
borrower_name = 'John')) AND A.author_id IN (SELECT author_id FROM Books WHERE
book_id IN (SELECT book_id FROM
C. SELECT A.author_name FROM Authors AS A WHERE A.author_id IN (SELECT author_id
FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers WHERE
borrower_name = 'John')) OR A.author_id IN (SELECT author_id FROM Books WHERE
book_id IN (SELECT book_id FROM B
D. SELECT A.author_name FROM Authors AS A WHERE A.author_id IN (SELECT author_id
FROM Books WHERE book_id IN (SELECT book_id FROM Borrowers WHERE
borrower_name = 'John')) OR A.author_id IN (SELECT author_id FROM Books WHERE
book_id IN (SELECT book_id FROM B
Correct Answer : A
Q796. Consider the Library Database with Following tables
Books (book_id: Numeric PK, title: String, author_id: Numeric FK to Authors, available_copies:
Numeric)
Authors (author_id: Numeric PK, author_name: String)
Borrowers (borrower_id: Numeric PK, borrower_

Retrieve the names of borrowers who have borrowed books by an author who has never
written a book with more than 3 available copies in the library.
A. SELECT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id IN (SELECT
book_id FROM Books WHERE author_id IN (SELECT author_id FROM Books WHERE
author_id NOT IN (SELECT author_id FROM Books WHERE available_copies > 3)))
B. SELECT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id IN (SELECT
book_id FROM Books WHERE author_id IN (SELECT author_id FROM Books WHERE
author_id IN (SELECT author_id FROM Books WHERE available_copies <= 3)))
C. SELECT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id IN (SELECT
book_id FROM Books WHERE author_id IN (SELECT author_id FROM Books WHERE
author_id NOT IN (SELECT author_id FROM Books WHERE available_copies > 3)))
D. SELECT Br.borrower_name FROM Borrowers AS Br WHERE Br.book_id IN (SELECT
book_id FROM Books WHERE author_id IN (SELECT author_id FROM Books WHERE
author_id NOT IN (SELECT author_id FROM Books WHERE available_copies <= 3)))
Correct Answer : A

Q797. Choose the Correct Option

You are developing an e-commerce application. A customer adds items to their shopping
cart, and you want to ensure that their cart data is consistent throughout the shopping process.
Which SQL transaction isolation level should you use to prevent other u
A. READ UNCOMMITTED
B. READ COMMITTED
C. SERIALIZABLE
D. REPEATABLE READ
Correct Answer : C

Q798. Choose the Correct Option


In a banking system, a customer is transferring money from their checking account to a
savings account. During the transaction, the customer's balance should be updated atomically.
Which SQL statement should be used to ensure the integrity of this operat
A. INSERT
B. UPDATE
C. COMMIT
D. BEGIN TRANSACTION
Correct Answer : D

Q799. Choose the Correct Option

You are working on an inventory management system. A user is trying to update the
quantity of a product in the database while another user is simultaneously trying to delete the
same product. What transaction isolation level can prevent this scenario?
A. READ UNCOMMITTED
B. READ COMMITTED
C. SERIALIZABLE
D. REPEATABLE READ
Correct Answer : C

Q800. Choose the Correct Option

A database system uses the Two-Phase Commit (2PC) protocol to manage distributed
transactions. What is the purpose of the first phase in 2PC?
A. To obtain locks on the participating data
B. To prepare all participants to commit the transaction
C. To roll back the transaction if any participant cannot commit
D. To release locks and finalize the transaction
Correct Answer : B

Q801. Choose the Correct Option

In a banking application, a user is transferring money from their account to another user's
account. During the transaction, you want to ensure that either both the debit and credit
operations succeed or both fail. Which SQL transaction command should be
A. COMMIT
B. ROLLBACK
C. SAVEPOINT
D. BEGIN TRANSACTION
Correct Answer : B

Q802. Choose the Correct Option

In a reservation system, a user is booking tickets for an event, and you want to ensure that
no other user can book the same seats while this transaction is in progress. What SQL command
should you use to lock the selected seats?
A. LOCK TABLE
B. BEGIN TRANSACTION
C. SET TRANSACTION ISOLATION LEVEL
D. SELECT ... FOR UPDATE
Correct Answer : D

Q803. Choose the Correct Option

In a forum application, users are posting comments on a thread. You want to ensure that
comments posted by one user are displayed together and don't interleave with comments from
other users. What SQL transaction isolation level should you use in this ca
A. READ UNCOMMITTED
B. READ COMMITTED
C. SERIALIZABLE
D. REPEATABLE READ
Correct Answer : A

Q804. Choose the Correct Option

A user is submitting a purchase order in an e-commerce system. You want to ensure that
the order is processed entirely, including payment, and that nothing is left in an inconsistent state.
What SQL transaction command should you use?
A. BEGIN TRANSACTION
B. LOCK TABLE
C. SAVEPOINT
D. CHECKPOINT
Correct Answer : A

Q805. Choose the Correct Option

You are developing a real-time messaging application. When a user sends a message, you
want to ensure that it appears immediately to the recipient but remains invisible to others until
the transaction is complete. What SQL transaction isolation level sho
A. READ UNCOMMITTED
B. READ COMMITTED
C. SERIALIZABLE
D. REPEATABLE READ
Correct Answer : B

Q806. Choose the Correct Option

In a library management system, a user is borrowing multiple books. You want to ensure
that all books are successfully borrowed or none at all. What SQL transaction command should be
used to achieve this?
A. COMMIT
B. ROLLBACK
C. SAVEPOINT
D. BEGIN TRANSACTION
Correct Answer : D

Q807. Choose the Correct Option

A user is trying to update their profile information in a CRM system. You want to ensure
that the user's information remains consistent and locked during the update. What SQL
transaction isolation level should be used for this operation?
A. READ UNCOMMITTED
B. READ COMMITTED
C. SERIALIZABLE
D. REPEATABLE READ
Correct Answer : C
Q808. Choose the Correct Option

You are implementing a point-of-sale system for a retail store. During a sales transaction,
you need to ensure that both the deduction from the inventory and the charging of the customer's
account occur successfully. What SQL transaction command should y
A. COMMIT
B. ROLLBACK
C. SAVEPOINT
D. BEGIN TRANSACTION
Correct Answer : B

Q809. Choose the Correct Option

You are developing a reservation system for booking airline tickets. During the reservation
process, you want to ensure that the seats being reserved are locked and unavailable for other
users. What SQL command should you use to achieve this?
A. LOCK TABLE
B. BEGIN TRANSACTION
C. SET TRANSACTION ISOLATION LEVEL
D. SELECT ... FOR UPDATE
Correct Answer : D

Q810. Choose the Correct Option

In a stock trading system, a user is placing an order to buy a certain number of shares at a
specific price. You want to ensure that no other user can execute an order for the same shares
simultaneously. What kind of lock or constraint should be used in
A. Shared lock
B. Exclusive lock
C. Unique constraint
D. Check constraint
Correct Answer : B

Q811. Choose the Correct Option


You are building a real-time messaging application. When a user sends a message, you
want to ensure that it appears immediately to the recipient but remains invisible to others until
the transaction is complete. What SQL transaction isolation level shoul
A. READ UNCOMMITTED
B. READ COMMITTED
C. SERIALIZABLE
D. REPEATABLE READ
Correct Answer : B

Q812. Choose the Correct Option

In a database system, what is the primary goal of recovery management?


A. Data encryption
B. Data security
C. Data availability
D. Data replication
Correct Answer : C

Q813. Choose the Correct Option

After a system crash, a database needs to be restored to its previous state using
transaction logs. What is the term for this process?
A. Backup
B. Rollback
C. Recovery
D. Replication
Correct Answer : C

Q814. Choose the Correct Option

In database recovery, what does the term Point-in-Time Recovery refer to?
A. Recovering to the current time
B. Recovering to the last backup
C. Recovering to a specific time in the past
D. Recovering without logs
Correct Answer : C

Q815. Choose the Correct Option

During a recovery process, a database administrator needs to identify the transactions that
were in progress when a failure occurred. What is this step called?
A. Rollback
B. Redo
C. Undo
D. Checkpoint
Correct Answer : B

Q816. Choose the Correct Option

When restoring a database, what does the term Full Recovery Model mean in the context
of Microsoft SQL Server?
A. Only full backups are used for recovery
B. All transaction logs are retained for recovery
C. Only specific tables are recovered
D. No recovery options are available
Correct Answer : B

Q817. Choose the Correct Option

In a database recovery scenario, what is the purpose of a checkpoint?


A. To undo changes made by transactions
B. To ensure data integrity during recovery
C. To record transactions for future recovery
D. To mark a point in the log from which recovery can start
Correct Answer : D

Q818. Choose the Correct Option

A database system uses a physical backup of the database files for recovery. What is the
term for this type of backup?
A. Logical backup
B. Differential backup
C. Incremental backup
D. Full backup
Correct Answer : D

Q819. Choose the Correct Option

After a power outage, a database needs to be restored to its previous state. What type of
recovery is typically required in this scenario?
A. Point-in-Time Recovery
B. Full Recovery
C. Crash Recovery
D. Partial Recovery
Correct Answer : C

Q820. Choose the Correct Option

In a disaster recovery plan, what does RTO stand for?


A. Recovery Time Objective
B. Recovery Test Operation
C. Recovery Technical Overview
D. Recovery Tracking Order
Correct Answer : A

Q821. Choose the Correct Option

During database recovery, what is the purpose of the redo log or roll-forward phase?
A. To undo transactions that were incomplete
B. To apply committed transactions to restore the database
C. To roll back the database to a previous state
D. To validate user privileges
Correct Answer : B
Q822. Choose the Correct Option

In a disaster recovery scenario, what does RPO stand for?


A. Recovery Plan Outline
B. Recovery Point Objective
C. Recovery Process Overview
D. Recovery Performance Optimization
Correct Answer : B

Q823. Choose the Correct Option

In a database recovery process, what is the primary role of a shadow copy or snapshot?
A. To create a physical backup
B. To provide a read-only copy of the database
C. To store transaction logs
D. To recover to a specific point in time
Correct Answer : B

Q824. Choose the Correct Option

What recovery method would you use if you need to restore a database to a specific date
and time in the past?
A. Full Recovery
B. Crash Recovery
C. Point-in-Time Recovery
D. Rollback Recovery
Correct Answer : C

Q825. Choose the Correct Option

In the context of database recovery, what is the purpose of a redo log or transaction log?
A. To track user logins and logouts
B. To store the current state of the database
C. To record all committed changes made to the database
D. To recover lost data from backups
Correct Answer : C

Q826. Choose the Correct Option

During database recovery, what is the undo log or rollback phase used for?
A. To recover the database to a specific point in time
B. To apply committed transactions to restore the database
C. To undo incomplete transactions and restore the previous state
D. To make the database read-only
Correct Answer : C

Q827. Choose the Correct Option

What is the primary goal of a recovery plan in the context of database recovery?
A. To prevent data loss
B. To create backups
C. To improve database performance
D. To create new tables
Correct Answer : A

Q828. Choose the Correct Option

In a database recovery scenario, what does MTTR stand for?


A. Mean Time to Recovery
B. Maximum Time to Recovery
C. Minimum Time to Recovery
D. Master Time to Recovery
Correct Answer : A

Q829. Choose the Correct Option

What is the role of a data backup in database recovery?


A. To restore the database to a previous state
B. To provide a read-only copy of the database
C. To store transaction logs
D. To recover data lost due to user errors
Correct Answer : A

Q830. Choose the Correct Option

After a database failure, which type of recovery process is needed when you have a full
backup and all transaction logs since the backup?
A. Point-in-Time Recovery
B. Full Recovery
C. Crash Recovery
D. Rollback Recovery
Correct Answer : B

Q831. Choose the Correct Option

In a database recovery scenario, what does MTBF stand for?


A. Mean Time Between Failures
B. Maximum Time Before Failure
C. Minimum Time for Backup
D. Master Time for Full Recovery
Correct Answer : A

Q832. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


CREATE OR REPLACE FUNCTION patients_with_condition(p_condition VARCHAR2) RETURN
SYS_REFCURSOR IS
v_cursor SYS_REFCURSOR;
BEGIN
OPEN v_cursor FOR
SELECT p.first_name, p.last_name
FROM Patients p
JOIN Medical_Records mr
A. Update patient's age
B. Assign a doctor to an appointment
C. Generate bills for patients
D. Log contact number changes
Correct Answer : B

Q833. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


CREATE OR REPLACE PROCEDURE mark_bill_as_paid(p_bill_id NUMBER) IS
BEGIN
UPDATE Billing SET payment_status = 'paid' WHERE bill_id = p_bill_id;
COMMIT;
END;
/ What is the purpose of the patients_with_condition function?
A. Assign a doctor to an appointment
B. Retrieve the list of patients with a specific medical condition
C. Mark a bill as paid
D. Calculate the total number of appointments
Correct Answer : B

Q834. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


CREATE OR REPLACE FUNCTION count_appointments_by_specialty(p_specialty VARCHAR2)
RETURN NUMBER IS
v_count NUMBER;
BEGIN
SELECT COUNT(*) INTO v_count
FROM Appointments a
JOIN Doctors d ON a.doctor_id = d.doctor_id
WHER
A. Calculate the average age of patients
B. Assign a doctor to an appointment
C. Log doctor contact changes
D. Mark a bill as paid
Correct Answer : D

Q835. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


Create a trigger that automatically updates a patient's age in the Patients table when their date of
birth is modified.
CREATE OR REPLACE TRIGGER update_patient_age
BEFORE INSERT OR UPDATE ON Patients
FOR EACH ROW
BEGIN
:NEW.age :=
A. List of patients with unpaid bills
B. Total revenue generated by the hospital
C. Count of appointments for a specific doctor's specialty
D. Most common medical condition among patients
Correct Answer : C

Q836. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


CREATE OR REPLACE TRIGGER prevent_past_appointments
BEFORE INSERT ON Appointments
FOR EACH ROW
BEGIN
IF :NEW.appointment_date < SYSDATE THEN
RAISE_APPLICATION_ERROR(-20001, 'Appointment date cannot be in the past.');
END
A. Prevents insertion of past appointments
B. Updates patient's age when date of birth changes
C. Generates a new bill for a patient
D. Calculates the total number of appointments
Correct Answer : B
Q837. Consider the Hospital Database with Following tables
Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


CREATE OR REPLACE TRIGGER log_doctor_contact_change
AFTER UPDATE OF contact_number ON Doctors
FOR EACH ROW
BEGIN
INSERT INTO Doctor_Contact_Log (doctor_id, old_contact, new_contact, change_date)
VALUES (:OLD.doctor_id, :OLD.conta
A. Calculates the total revenue
B. Assigns doctors based on conditions
C. Prevents insertion of past appointments
D. Logs billing updates
Correct Answer : C

Q838. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


Create a trigger that enforces a constraint to ensure that the admission date in the Medical
Records table is before the discharge date.
CREATE OR REPLACE TRIGGER enforce_admission_date_constraint
BEFORE INSERT ON Medical_Records
FOR EA
A. Generates unique bill IDs
B. Updates medical records dates
C. Logs doctor contact changes
D. Calculates the average total amount paid
Correct Answer : C

Q839. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


CREATE OR REPLACE TRIGGER generate_bill_for_medical_record
AFTER INSERT ON Medical_Records
FOR EACH ROW
BEGIN
INSERT INTO Billing (patient_id, bill_date, total_amount, payment_status)
VALUES (:NEW.patient_id, SYSDATE, 0, 'pending
A. Unique bill IDs
B. Admission date before discharge date
C. Prevent doctor deletion with pending appointments
D. Assigning doctors to their specialty
Correct Answer : B

Q840. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


DECLARE
v_doctor_name VARCHAR2(50);
CURSOR specialty_doctors IS
SELECT first_name || ' ' || last_name AS doctor_name
FROM Doctors
WHERE specialty = 'Cardiology';
BEGIN
OPEN specialty_doctors;
DBMS_
A. Generates a new bill for a patient
B. Enforces admission date constraints
C. Prevents doctor deletion with pending appointments
D. Calculates the total revenue
Correct Answer : A

Q841. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


DECLARE
v_patient_name VARCHAR2(50);
CURSOR unpaid_patients IS
SELECT first_name || ' ' || last_name AS patient_name
FROM Patients
WHERE patient_id IN (SELECT patient_id FROM Billing WHERE payment_status =
A. List of patients with multiple records
B. List of doctors in a specific specialty
C. Names of doctors with the highest bill amounts
D. Patients with unpaid bills
Correct Answer : B

Q842. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


DECLARE
v_patient_id NUMBER;
v_patient_name VARCHAR2(50);
v_total_amount NUMBER;
CURSOR patient_bills IS
SELECT p.patient_id, p.first_name || ' ' || p.last_name AS patient_name,
SUM(b.total_amount) AS total

A. Unique bill IDs


B. Names of doctors with the lowest appointments
C. Patients with unpaid bills
D. Average age of patients with a condition
Correct Answer : C

Q843. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


DECLARE
v_patient_name VARCHAR2(50);
CURSOR patients_with_multiple_records IS
SELECT p.first_name || ' ' || p.last_name AS patient_name
FROM Patients p
WHERE p.patient_id IN (
SELECT patient_id
A. Total revenue generated by the hospital
B. Total bill amount for patients
C. Total number of patients with no appointments
D. Names of doctors with the lowest appointments
Correct Answer : B

Q844. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


DECLARE
v_patient_name VARCHAR2(50);
v_doctor_name VARCHAR2(50);
CURSOR patient_appointments IS
SELECT p.first_name || ' ' || p.last_name AS patient_name, d.first_name || ' ' || d.last_name
AS doctor_name
FROM
A. Names of doctors with the highest bill amounts
B. Patients with multiple records
C. Average age of patients with a condition
D. Doctors in a specific specialty
Correct Answer : B

Q845. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String
Consider The Code
CREATE OR REPLACE PROCEDURE calculate_avg_total_amount AS
avg_total NUMBER;
BEGIN
SELECT AVG(total_amount) INTO avg_total
FROM Billing;
UPDATE Patients
SET avg_total_amount = avg_total;
END;
/ What does the PL/SQL bloc
A. Assigns doctors based on conditions
B. Patients and their appointments
C. Calculate the average total amount paid
D. Prevent doctor deletion with pending appointments
Correct Answer : B

Q846. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


CREATE OR REPLACE FUNCTION count_patients_with_no_appointments RETURN NUMBER IS
no_appointment_count NUMBER;
BEGIN
SELECT COUNT(*) INTO no_appointment_count
FROM Patients
WHERE patient_id NOT IN (SELECT DISTINCT patient_id FROM A
A. Calculates the total revenue
B. Calculates the average total amount paid
C. Deletes patients with no appointments
D. Generates unique bill IDs
Correct Answer : B

Q847. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


CREATE OR REPLACE PROCEDURE update_medical_records_dates AS
BEGIN
FOR rec IN (SELECT * FROM Medical_Records)
LOOP
UPDATE Medical_Records
SET admission_date = rec.admission_date + 1,
discharge_date = rec.discharge_date
A. Prevents doctor deletion with pending appointments
B. Patients with no appointments
C. Names of doctors with the highest bill amounts
D. Average age of patients with a condition
Correct Answer : B

Q848. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


CREATE OR REPLACE FUNCTION calculate_hospital_revenue RETURN NUMBER IS
total_revenue NUMBER;
BEGIN
SELECT SUM(total_amount) INTO total_revenue
FROM Billing;
RETURN total_revenue;
END;
/ What is the primary task of the up
A. Generates a new medical record for admitted patients
B. Updates admission and discharge dates
C. Calculates the total revenue
D. Prevents insertion of past appointments
Correct Answer : B

Q849. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


CREATE OR REPLACE PROCEDURE generate_unique_bill_ids AS
BEGIN
FOR rec IN (SELECT * FROM Billing)
LOOP
UPDATE Billing
SET bill_id = 'BILL' || TO_CHAR(rec.bill_id, 'FM0000')
WHERE patient_id = rec.patient_id;
END LOOP;
EN
A. Unique bill IDs
B. Average age of patients with a condition
C. Total revenue generated by the hospital
D. Names of doctors with the lowest appointments
Correct Answer : C

Q850. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


CREATE OR REPLACE FUNCTION most_common_medical_condition RETURN VARCHAR2 IS
common_condition VARCHAR2(100);
BEGIN
SELECT medical_condition
INTO common_condition
FROM (SELECT medical_condition, COUNT(*) AS condition_count

A. Generates unique bill IDs


B. Assigns doctors based on conditions
C. Deletes patients with no appointments
D. Log billing updates
Correct Answer : A

Q851. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


CREATE OR REPLACE PROCEDURE calculate_total_appointments(date_in DATE) AS
total_appointments NUMBER;
BEGIN
SELECT COUNT(*) INTO total_appointments
FROM Appointments
WHERE TRUNC(appointment_date) = TRUNC(date_in);
INSERT INTO Ap
A. Prevents doctor deletion with pending appointments
B. Generates a new medical record for admitted patients
C. Most common medical condition among patients
D. Prevents insertion of past appointments
Correct Answer : C

Q852. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


CREATE OR REPLACE FUNCTION avg_age_of_patients_with_condition(med_condition VARCHAR2)
RETURN NUMBER IS
avg_age NUMBER;
BEGIN
SELECT AVG(TO_NUMBER(TO_CHAR(SYSDATE, 'YYYY')) - TO_NUMBER(TO_CHAR(date_of_birth,
'YYYY'))) INTO avg_age
F
A. Calculates the average age of patients
B. Generates bills for patients
C. Prevents insertion of past appointments
D. Calculates the total number of appointments for a specific date
Correct Answer : D

Q853. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


CREATE OR REPLACE PROCEDURE delete_patients_with_no_appointments AS
BEGIN
FOR rec IN (SELECT * FROM Patients)
LOOP
IF rec.patient_id NOT IN (SELECT DISTINCT patient_id FROM Appointments) THEN
DELETE FROM Patients WHERE pati
A. Calculates the average age of patients
B. Calculates the total revenue
C. Average age of patients with a specific condition
D. Patients with multiple records
Correct Answer : C

Q854. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


CREATE OR REPLACE FUNCTION doctors_with_highest_total_bills RETURN SYS_REFCURSOR IS
cur SYS_REFCURSOR;
BEGIN
OPEN cur FOR
SELECT doctor_id, first_name, last_name, specialty
FROM Doctors
WHERE doctor_id IN (SELECT doctor_i
A. Deletes patients with no appointments
B. Generates unique bill IDs
C. Prevents insertion of past appointments
D. Calculates the total number of patients
Correct Answer : A

Q855. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


CREATE OR REPLACE TRIGGER generate_medical_record
BEFORE INSERT ON Medical_Records
FOR EACH ROW
BEGIN
IF :NEW.admission_date IS NOT NULL THEN
INSERT INTO Medical_Records (patient_id, doctor_id, admission_date, medical_condition)
A. Most common medical condition among patients
B. Names of doctors with the highest bill amounts
C. Total revenue generated by the hospital
D. Prevents doctor deletion with pending appointments
Correct Answer : B

Q856. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


CREATE OR REPLACE TRIGGER enforce_doctor_specialty
BEFORE INSERT ON Appointments
FOR EACH ROW
BEGIN
IF :NEW.doctor_id IN (SELECT doctor_id FROM Doctors WHERE specialty <> (SELECT specialty
FROM Doctors WHERE doctor_id = :NEW.doctor_id)
A. Assigns doctors based on conditions
B. Prevents insertion of past appointments
C. Generates a new medical record for admitted patients
D. Prevent doctor deletion with pending appointments
Correct Answer : C

Q857. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


CREATE OR REPLACE TRIGGER log_billing_updates
AFTER INSERT OR UPDATE ON Billing
FOR EACH ROW
BEGIN
INSERT INTO Billing_Audit (bill_id, patient_id, bill_date, total_amount, payment_status,
audit_date)
VALUES (:NEW.bill_id, :NEW.patien
A. Admission date before discharge date
B. Unique bill IDs
C. Assigning doctors to their specialty
D. Prevents insertion of past appointments
Correct Answer : C

Q858. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


CREATE OR REPLACE TRIGGER assign_doctor_on_condition
BEFORE INSERT ON Appointments
FOR EACH ROW
BEGIN
IF :NEW.doctor_id IS NULL THEN
SELECT doctor_id INTO :NEW.doctor_id
FROM Doctors
WHERE specialty = (SELECT medical_condit
A. Generates unique bill IDs
B. Calculates the average age of patients
C. Logs billing updates
D. Prevents doctor deletion with pending appointments
Correct Answer : C

Q859. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


CREATE OR REPLACE TRIGGER prevent_doctor_deletion
BEFORE DELETE ON Doctors
FOR EACH ROW
BEGIN
IF :OLD.doctor_id IN (SELECT doctor_id FROM Appointments WHERE payment_status = 'pending')
THEN
RAISE_APPLICATION_ERROR(-20002, 'Doctor c
A. Generates a new bill for a patient
B. Prevents the deletion of a doctor's record
C. Calculates the average total amount paid
D. Automatically assigns a doctor to an appointment based on a patient's condition
Correct Answer : D

Q860. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


DECLARE
cur SYS_REFCURSOR;
BEGIN
OPEN cur FOR
SELECT doctor_id, first_name, last_name, specialty
FROM Doctors
WHERE doctor_id IN (SELECT doctor_id FROM Appointments WHERE patient_id IN (SELECT
patient_id FROM Billing)

A. Prevents insertion of past appointments


B. Prevents the deletion of a doctor's record with pending appointments
C. Generates a new bill for a patient
D. Calculates the total number of appointments
Correct Answer : B

Q861. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


DECLARE
CURSOR diagnosis_cursor IS
SELECT patient_id, diagnosis, COUNT(*) AS appointment_count
FROM Appointments
GROUP BY patient_id, diagnosis
HAVING COUNT(*) > 1;
BEGIN
FOR rec IN diagnosis_cursor
LOOP
DBMS_OU
A. Names of doctors with the lowest appointments
B. Patients with unpaid bills
C. Total revenue generated by the hospital
D. Prevents the deletion of a doctor's record with pending appointments
Correct Answer : A

Q862. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


Write a PL/SQL procedure to insert a new patient into the Patients table.
CREATE OR REPLACE PROCEDURE insert_patient(
p_patient_id NUMBER,
p_first_name VARCHAR2,
p_last_name VARCHAR2,
p_date_of_birth DATE,
p_gender V
A. p_patient_id, p_first_name, p_last_name, p_gender, p_contact_number,
p_address,p_date_of_birth
B. p_patient_id, p_first_name, p_last_name, p_gender,
p_address,p_date_of_birth,p_contact_number
C. p_patient_id, p_first_name, p_last_name, p_date_of_birth, p_gender,
p_contact_number, p_address
D. p_patient_id, p_last_name,p_first_name, p_gender,
p_address,p_date_of_birth,p_contact_number
Correct Answer : C

Q863. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


Develop a procedure to update the contact number of a specific doctor in the Doctors table.
CREATE OR REPLACE PROCEDURE update_doctor_contact(
p_doctor_id NUMBER,
p_new_contact_number VARCHAR2
) IS
BEGIN
____________________
A. UPDATE Doctors SET contact_number = p_new_contact_number WHERE doctor_id IN
(p_doctor_id);
B. UPDATE Doctors SET contact_number = p_new_contact_number WHERE doctor_id =
p_doctor_id;
C. UPDATE Doctors SET contact_number = p_new_contact_number HAVING doctor_id =
p_doctor_id;
D. UPDATE Doctors SET contact_number = p_new_contact_number WHERE doctor_id
NOT NULL;
Correct Answer : B

Q864. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


Develop a function that calculates the total amount paid by a patient for their medical bills.
___________________________________________________________________________ IS
v_total_amount NUMBER;
BEGIN
SELECT SUM(total_amount)
A. CREATE FUNCTION total_bill_amount(p_patient_id NUMBER) RETURN NUMBER
B. CREATE OR REPLACE FUNCTION total_bill_amount(p_patient_id VARCHAR2) RETURN
NUMBER
C. CREATE OR REPLACE FUNCTION total_bill_amount(p_patient_id NUMBER) RETURN
VARCHAR2
D. CREATE OR REPLACE FUNCTION total_bill_amount(p_patient_id NUMBER) RETURN
NUMBER
Correct Answer : D

Q865. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


Create a cursor to list patients who have had the same diagnosis for multiple appointments, along
with the count of such appointments
DECLARE
CURSOR diagnosis_cursor IS
SELECT patient_id, diagnosis, COUNT(*) AS appointment_count

A. GROUP BY diagnosis ASC


B. GROUP BY patient_id DESC
C. GROUP BY patient_id, diagnosis
D. GROUP BY patient_id ASC, diagnosis DESC
Correct Answer : C

Q866. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


Write a PL/SQL block that uses a cursor to calculate the total number of patients for each doctor's
specialty
DECLARE
CURSOR specialty_cursor IS
________________________________________________________
FROM Doctors d
LEFT
A. SELECT *, COUNT(DISTINCT patient_id) AS patient_count
B. SELECT *
C. SELECT specialty, COUNT (patient_id) AS patient_count
D. SELECT specialty, COUNT(DISTINCT patient_id) AS patient_count
Correct Answer : D

Q867. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


Develop a cursor that displays the patients who have the most medical records, along with the
number of records for each patient
DECLARE
CURSOR most_records_cursor IS
SELECT p.patient_id, p.first_name, p.last_name, COUNT(*) AS rec
A. Appointments a ON d.doctor_id = a.doctor_id
B. Medical_Records m ON p.patient_id = m.doctor_id
C. Appointments m ON p.patient_id = m.patient_id
D. Medical_Records m ON p.patient_id = m.patient_id
Correct Answer : D

Q868. Consider the Hospital Database with Following tables


Patients (patient_id: Numeric PK, first_name: String, last_name: String, date_of_birth: Date, gender:
String, contact_number: String, address: String)
Doctors (doctor_id: Numeric PK, first_name: String

Consider The Code


Create a cursor to retrieve the names of doctors with the lowest number of appointments in a
specific month
DECLARE
CURSOR lowest_appointments_cursor IS
SELECT doctor_id, first_name, last_name, COUNT(*) AS appointment_count
FR
A. SELECT MIN(COUNT(*)) FROM Appointments
WHERE appointment_date = '01-01-2020'
B. SELECT MIN(COUNT(Paitient_ID)) FROM Appointments
WHERE TO_CHAR(appointment_date, 'MM') = '01'
C. SELECT COUNT(*) FROM Appointments
WHERE TO_CHAR(appointment_date, 'MM') = '01'
D. SELECT MIN(COUNT(*)) FROM Appointments
WHERE TO_CHAR(appointment_date, 'MM') = '01'
Correct Answer : D

Q869. Choose the Correct Option

A company wants to secure its sensitive customer data. Which of the following
mechanisms is most appropriate for data encryption at rest in a relational database?
A. TLS/SSL
B. Data masking
C. Transparent Data Encryption (TDE)
D. Row-level security
Correct Answer : C

Q870. Choose the Correct Option

An organization needs to ensure that only authorized users can access the database. Which
of the following authentication methods provides the highest level of security?
A. Using weak passwords
B. Multi-factor authentication (MFA)
C. No authentication
D. Single sign-on (SSO)
Correct Answer : B

Q871. Choose the Correct Option

In a scenario where a database administrator is configuring user access, what principle of


least privilege refers to?
A. Granting users the maximum possible permissions
B. Assigning users the minimum permissions necessary to perform their job
C. Using the same password for all users
D. Storing passwords in plain text
Correct Answer : B

Q872. Choose the Correct Option

A database stores credit card information, and the organization must comply with PCI DSS
(Payment Card Industry Data Security Standard). What is the best practice for handling credit card
data in the database?
A. Store full credit card numbers with no encryption
B. Avoid storing credit card data entirely
C. Store hashed or tokenized credit card data
D. Share credit card data openly within the organization
Correct Answer : C

Q873. Choose the Correct Option


In a large organization, the database administrator needs to track all changes to sensitive
tables. What database security feature provides this capability by recording who accessed the data
and when?
A. Access Control Lists (ACL)
B. Auditing and Database Activity Monitoring
C. Role-based access control
D. Public keys
Correct Answer : B

Q874. Choose the Correct Option

An organization is concerned about SQL injection attacks on their database-driven web


applications. Which practice can help prevent SQL injection?
A. Disable all security features
B. Use prepared statements or parameterized queries
C. Store database credentials in plain text
D. Share the same database user account for all applications
Correct Answer : B

Q875. Choose the Correct Option

A database administrator is implementing data classification for the organization's


sensitive information. Which classification level involves data that is highly confidential and
requires the strictest access controls?
A. Public data
B. Private data
C. Sensitive data
D. Unclassified data
Correct Answer : C

Q876. Choose the Correct Option

In a scenario where a company has a disaster recovery site for its database, what type of
security mechanism ensures that data is secure during replication and transfer between sites?
A. Firewalls
B. Virtual Private Networks (VPNs)
C. Secure Socket Layer (SSL)
D. Data encryption in transit
Correct Answer : D

Q877. Choose the Correct Option

What will be the correct syntax for the `RETURN_BOOK` stored procedure to update the
`return_date` and increase the `available_copies` count in the Books table?**
A. BEGIN
UPDATE Borrowers
SET return_date = SYSDATE;
UPDATE Books
SET available_copies = available_copies + 1;
END;
```
B. FUNCTION RETURN_BOOK (borrower_id IN NUMBER, book_id IN NUMBER) IS
BEGIN
UPDATE Borrowers
SET return_date = SYSDATE
WHERE borrower_id = borrower_id
AND book_id = book_id;
UPDATE Books
SET available_copies = available_copies + 1

C. PROCEDURE RETURN_BOOK (borrower_id NUMBER, book_id NUMBER) IS


BEGIN
UPDATE Borrowers
SET return_date = SYSDATE
WHERE borrower_id = borrower_id
AND book_id = book_id;

UPDATE Books
SET available_copies = available_copies + 1

D. TRIGGER RETURN_BOOK (IN borrower_id NUMBER, IN book_id NUMBER) IS


BEGIN
UPDATE Borrowers
SET return_date = SYSDATE
WHERE borrower_id = borrower_id
AND book_id = book_id;

UPDATE Books
SET available_copies = available_copies + 1
Correct Answer : C

Q878. Choose the Correct Option

What will be the effect of the following code snippet in the `RETURN_BOOK` stored
procedure?**
```sql
DECLARE
v_borrow_count NUMBER;
BEGIN
SELECT COUNT(*) INTO v_borrow_count
FROM Borrowers
WHERE borrower_id = borrower_id
AND book_id
A. It will always mark the book as returned, regardless of its borrow status.
B. It will only mark the book as returned if it is currently borrowed by the specified
borrower.
C. It will mark the book as returned for all borrowers.
D. It will cause a syntax error due to incorrect variable usage.
Correct Answer : B

Q879. Choose the Correct Option

Which statement should be added to the `RETURN_BOOK` procedure to handle the


scenario when the specified book is not found in the Books table?**
A. EXCEPTION
WHEN NO_DATA_FOUND THEN
dbms_output.put_line('Book not found in the library.');
B. IF SQL%NOTFOUND THEN
dbms_output.put_line('Book not found in the library.');
END IF;
```
C. IF v_book_id IS NULL THEN
dbms_output.put_line('Book not found in the library.');
END IF;
```

D. IF v_book_id = 0 THEN
dbms_output.put_line('Book not found in the library.');
END IF;
```
Correct Answer : A

Q880. Choose the Correct Option

Which PL/SQL construct ensures that the `RETURN_BOOK` procedure updates the
`return_date` and increases the `available_copies` count atomically without interference from
other transactions?**
A. Transaction Control Statements (COMMIT and ROLLBACK).
B. Triggers.
C. Autonomous Transactions.
D. Exception Handling.
Correct Answer : A

Q881. Choose the Correct Option

What is the purpose of the NOTIFY_OVERDUE_BORROWERS stored procedure?


A. To add new borrowers to the Borrowers table.
B. To notify borrowers if they have overdue books based on the return date in the
Borrowers table.
C. To update book information in the Books table.
D. To delete borrowers' records from the Borrowers table.
Correct Answer : B
Q882. Choose the Correct Option

What parameter should the NOTIFY_OVERDUE_BORROWERS procedure accept to identify


the overdue borrowers?
A. book_id
B. borrower_name
C. return_date
D. None of the above
Correct Answer : D

Q883. Choose the Correct Option

Which SQL clause should be used to filter borrowers who have overdue books in the
NOTIFY_OVERDUE_BORROWERS procedure?
A. WHERE
B. HAVING
C. FROM
D. SELECT
Correct Answer : A

Q884. Choose the Correct Option

What action should the NOTIFY_OVERDUE_BORROWERS procedure perform if it finds


borrowers with overdue books?
A. Update the return dates for those books.
B. Send a notification to those borrowers.
C. Delete the records of overdue borrowers from the Borrowers table.
D. Increase the available copies count for the overdue books.
Correct Answer : B

Q885. Choose the Correct Option

Which PL/SQL construct should be used in the NOTIFY_OVERDUE_BORROWERS procedure


to send notifications?
A. PRINT
B. MESSAGE
C. DBMS_OUTPUT.PUT_LINE
D. SEND_NOTIFICATION
Correct Answer : C

Q886. Choose the Correct Option

What is the correct SQL query to find borrowers with overdue books in the
NOTIFY_OVERDUE_BORROWERS procedure?
A. SELECT borrower_name
FROM Borrowers
WHERE return_date < SYSDATE;

B. SELECT borrower_name
FROM Borrowers
WHERE return_date > SYSDATE;

C. SELECT borrower_name
FROM Borrowers
WHERE return_date <= SYSDATE;

D. SELECT borrower_name
FROM Borrowers
WHERE return_date >= SYSDATE;

Correct Answer : A

Q887. Choose the Correct Option

What should be the data type of the return_date parameter in the


NOTIFY_OVERDUE_BORROWERS procedure?
A. DATE
B. NUMBER
C. VARCHAR2
D. BOOLEAN
Correct Answer : A

Q888. Choose the Correct Option

How can the NOTIFY_OVERDUE_BORROWERS procedure simulate sending a notification


for overdue books using DBMS_OUTPUT.PUT_LINE?
A. DBMS_OUTPUT.PUT_LINE('Please return your overdue book.');

B. PRINT 'Please return your overdue book.';


C. MESSAGE 'Please return your overdue book.';
D. SEND_NOTIFICATION('Please return your overdue book.');
Correct Answer : A

Q889. Choose the Correct Option

Which PL/SQL loop construct is suitable for iterating through the list of borrowers with
overdue books in the NOTIFY_OVERDUE_BORROWERS procedure?
A. FOR loop
B. WHILE loop
C. REPEAT loop
D. CURSOR loop
Correct Answer : A

Q890. Choose the Correct Option

What is the purpose of the SYSDATE function in the NOTIFY_OVERDUE_BORROWERS


procedure?
A. To represent the current date and time when the notification is sent.
B. To represent the due date for returning the borrowed books.
C. To represent the date when the book was borrowed.
D. To represent the date when the book was published.
Correct Answer : A

Q891. Choose the Correct Option


What does the PL/SQL package `string_utilities` contain?
A. It contains two PL/SQL functions, `reverse_string` and `concatenate_strings`, for
working with strings.
B. It contains two PL/SQL triggers, `reverse_string` and `concatenate_strings`, for working
with strings.
C. It contains two PL/SQL procedures, `reverse_string` and `concatenate_strings`, for
working with strings.
D. It contains one PL/SQL function, `string_utilities`, and one PL/SQL procedure,
`string_utilities`, for working with strings.
Correct Answer : A

Q892. Choose the Correct Option

What is a trigger in PL/SQL?


A. A type of stored procedure
B. A database object that automatically executes in response to certain events on a
particular table or view
C. A way to create temporary tables
D. A way to perform transactions in Oracle databases
Correct Answer : B

Q893. Choose the Correct Option

Which type of trigger is fired automatically before a row is updated in a table?


A. AFTER UPDATE Trigger
B. INSTEAD OF UPDATE Trigger
C. BEFORE UPDATE Trigger
D. ON UPDATE Trigger
Correct Answer : C

Q894. Choose the Correct Option

What is the purpose of a statement-level trigger?


A. To execute the trigger code once for each affected row
B. To execute the trigger code once for each SQL statement, regardless of the number of
affected rows
C. To execute the trigger code before and after each affected row
D. To execute the trigger code after the transaction is committed
Correct Answer : B

Q895. Choose the Correct Option

Which keyword is used to refer to the old column value inside a trigger in PL/SQL?
A. OLD
B. PREVIOUS
C. PRIOR
D. ORIGINAL
Correct Answer : A

Q896. Choose the Correct Option

Which system event does the statement-level trigger fire in response to?
A. AFTER DELETE
B. AFTER LOGON
C. AFTER SERVERERROR
D. AFTER ROLLBACK
Correct Answer : B

Q897. Choose the Correct Option

In PL/SQL triggers, which package provides a way to store diagnostic information about
executed statements and errors?
A. DBMS_OUTPUT
B. DBMS_ALERT
C. DBMS_TRACE
D. DBMS_UTILITY
Correct Answer : C
Q898. Choose the Correct Option

Which type of trigger is fired automatically before or after each row affected by an INSERT,
UPDATE, DELETE, or MERGE statement?
A. DDL Trigger
B. Compound Trigger
C. Row-Level Trigger
D. Statement-Level Trigger
Correct Answer : C

Q899. Choose the Correct Option

Which clause is used to specify the timing of a trigger (BEFORE or AFTER) in Oracle PL/SQL?
A. FOR EACH ROW
B. WHEN
C. ON EVENT
D. BEFORE / AFTER
Correct Answer : D

Q900. Choose the Correct Option

What does a compound trigger allow you to do in PL/SQL?


A. Combine multiple triggers into a single trigger
B. Execute multiple statements in a single trigger
C. Create triggers on multiple tables
D. Execute triggers only for specific rows
Correct Answer : B

Q901. Choose the Correct Option

What does the :NEW pseudorecord represent in PL/SQL triggers?


A. It contains the old column values of the row being modified.
B. It contains the new column values of the row being modified.
C. It contains the new column values after an UPDATE statement.
D. It contains the new column values after a DELETE statement.
Correct Answer : B

Q902. Choose the Correct Option

Which system event does the database-level trigger fire in response to?
A. AFTER SERVERERROR
B. AFTER STARTUP
C. AFTER LOGOFF
D. AFTER SCHEMA
Correct Answer : B

Q903. Choose the Correct Option

Which statement is true about mutating table errors in triggers?


A. They occur when a trigger tries to update a row that is being modified by the same
trigger.
B. They occur when a trigger tries to update a row that is being modified by another
concurrent transaction.
C. They are resolved by using autonomous transactions in the trigger code.
D. They are not possible in Oracle databases.
Correct Answer : A

Q904. Choose the Correct Option

What does the FOR EACH ROW clause in a trigger definition indicate?
A. The trigger fires for each row affected by the triggering statement.
B. The trigger fires only once, regardless of the number of rows affected by the triggering
statement.
C. The trigger fires for each table in the database.
D. The trigger fires for each row in the database.
Correct Answer : A

Q905. Choose the Correct Option


What is the purpose of a compound trigger in PL/SQL?
A. To handle errors in PL/SQL code.
B. To execute multiple triggers simultaneously.
C. To manage sequences in the database.
D. To address the mutating table problem by allowing multiple triggers to work together.
Correct Answer : D

Q906. Choose the Correct Option

What does the BEFORE INSERT OR UPDATE ON table_name FOR EACH ROW syntax define
in a trigger?
A. A row-level trigger that fires before an INSERT or UPDATE operation on the specified
table.
B. A statement-level trigger that fires before an INSERT or UPDATE operation on the
specified table.
C. A trigger that fires after an INSERT or UPDATE operation on the specified table.
D. A trigger that fires before any data manipulation operation on the specified table.
Correct Answer : A

Q907. Choose the Correct Option

What is the primary purpose of the :OLD pseudorecord in PL/SQL triggers?


A. It contains the new values of the columns being modified.
B. It contains the old values of the columns being modified.
C. It contains the values of the columns before any changes are made.
D. It contains the values of the columns after an UPDATE statement.
Correct Answer : C

Q908. Choose the Correct Option

What is the correct syntax for defining a database-level trigger in PL/SQL?


A. CREATE TRIGGER trigger_name AFTER LOGON ON DATABASE BEGIN /* trigger code
here */ END;
B. CREATE TRIGGER trigger_name BEFORE LOGOFF ON DATABASE BEGIN /* trigger code
here */ END;
C. CREATE TRIGGER trigger_name FOR EACH ROW BEGIN /* trigger code here */ END;
D. CREATE TRIGGER trigger_name AFTER INSERT OR DELETE ON table_name BEGIN /*
trigger code here */ END;
Correct Answer : A

Q909. Choose the Correct Option

Which PL/SQL construct should be used to prevent the mutating table error in a trigger?
A. Autonomous Transaction
B. Compound Trigger
C. PRAGMA AUTONOMOUS_TRANSACTION
D. Row-Level Trigger
Correct Answer : B

Q910. Choose the Correct Option

In a row-level trigger, what does the :NEW pseudorecord contain?


A. It contains the old values of the columns being modified.
B. It contains the new values of the columns being modified.
C. It contains the values of the columns before any changes are made.
D. It contains the values of the columns after an UPDATE statement.
Correct Answer : B

Q911. Choose the Correct Option

Which statement is true about the PRAGMA AUTONOMOUS_TRANSACTION directive in a


PL/SQL trigger?
A. It commits the changes made within the trigger independently of the transaction
containing the triggering statement.
B. It rolls back the entire transaction if any changes within the trigger fail.
C. It automatically saves the transaction to a separate log table.
D. It restricts the trigger from making any changes to the database.
Correct Answer : A

Q912. Choose the Correct Option

What is a PL/SQL package?


A. A collection of variables and constants
B. A collection of related procedures, functions, variables, and other constructs
C. A single stored procedure
D. A way to create temporary tables
Correct Answer : B

Q913. Choose the Correct Option

Which component of a package is accessible from outside the package?


A. Constants
B. Variables
C. Procedures
D. Package Specification
Correct Answer : D

Q914. Choose the Correct Option

What is a cursor variable in PL/SQL packages?


A. A variable used to store integer values
B. A variable used to store multiple rows returned by a query
C. A variable used to store boolean values
D. A variable used to store character strings
Correct Answer : B

Q915. Choose the Correct Option

What is the purpose of a package body in PL/SQL?


A. To declare the package interface
B. To define the package implementation details
C. To store only constants and variables
D. To create a package specification
Correct Answer : B

Q916. Choose the Correct Option

Which keyword is used to refer to the public components of a package from outside the
package?
A. PUBLIC
B. EXTERNAL
C. PACKAGE
D. PACKAGE_NAME
Correct Answer : A

Q917. Choose the Correct Option

What is a package constant in PL/SQL?


A. A variable whose value cannot be changed once it is initialized
B. A variable that can hold multiple rows of data
C. A variable used for cursor operations
D. A variable that can only be accessed within the package
Correct Answer : A

Q918. Choose the Correct Option

Which of the following statements is true about package state?


A. Package state is retained across different user sessions.
B. Package state is not retained across different user sessions.
C. Package state is retained only within a single transaction.
D. Package state is accessible only to the package owner.
Correct Answer : A

Q919. Choose the Correct Option


What is the purpose of a package initialization block in PL/SQL?
A. To initialize the package constants and variables
B. To declare the package interface
C. To define the package implementation details
D. To create a package specification
Correct Answer : A

Q920. Choose the Correct Option

Which of the following is a benefit of using packages in PL/SQL?


A. Packages cannot have dependencies on other packages.
B. Packages cannot contain variables.
C. Packages allow encapsulation and information hiding.
D. Packages can only contain procedures, not functions.
Correct Answer : C

Q921. Choose the Correct Option

What is the purpose of the AUTHID CURRENT_USER clause in a package specification?


A. It specifies that the package is owned by the current user.
B. It specifies that the package executes with the privileges of the current user.
C. It specifies that the package is accessible to the current user only.
D. It specifies that the package is accessible to all users.
Correct Answer : B

Q922. Choose the Correct Option

Which of the following is NOT a valid type of package component in PL/SQL?


A. Constants
B. Variables
C. Indexes
D. Procedures
Correct Answer : C
Q923. Choose the Correct Option

What is a forward declaration in the context of PL/SQL packages?


A. A declaration that specifies the package name
B. A declaration that specifies the package implementation details
C. A declaration that specifies the package interface without the implementation details
D. A declaration that specifies the package state
Correct Answer : C

Q924. Choose the Correct Option

Which keyword is used to specify the visibility of a package component within the package
body?
A. PRIVATE
B. PUBLIC
C. INTERNAL
D. PACKAGE
Correct Answer : A

Q925. Choose the Correct Option

What does the %ROWTYPE attribute represent in a package declaration?


A. A specific row datatype from a database table
B. The entire structure of a database table
C. A cursor variable
D. A constant value
Correct Answer : A

Q926. Choose the Correct Option

What is the purpose of a package-level cursor in PL/SQL?


A. To store multiple rows returned by a query
B. To define the package implementation details
C. To create a package specification
D. To store a single row returned by a query
Correct Answer : A

Q927. Choose the Correct Option

What is the significance of the RESULT_CACHE clause in a package function?


A. It specifies that the function result is cached for better performance.
B. It specifies that the function result is not cached.
C. It specifies that the function result is encrypted.
D. It specifies that the function result is stored in a separate table.
Correct Answer : A

Q928. Choose the Correct Option

What is the purpose of the DETERMINISTIC clause in a function within a package?


A. It specifies that the function result is unpredictable.
B. It specifies that the function result is not influenced by any outside factors.
C. It specifies that the function result depends on the current user.
D. It specifies that the function result depends on the system time.
Correct Answer : B

Q929. Choose the Correct Option

What happens if two or more packages contain a procedure or function with the same
name?
A. The PL/SQL compiler generates an error.
B. The packages cannot be compiled.
C. The package with the most recent modification is used.
D. The package with the higher access privilege is used.
Correct Answer : A

Q930. Choose the Correct Option

What is the purpose of a package constructor in PL/SQL?


A. To initialize the package constants and variables
B. To create an instance of the package
C. To define the package implementation details
D. To create a package specification
Correct Answer : B

Q931. Choose the Correct Option

What is a package exception in PL/SQL?


A. An error that occurs only in package specifications
B. An error that occurs only in package bodies
C. A user-defined exception declared in a package
D. An error that cannot be handled using exception handling mechanisms
Correct Answer : C

Q932. Choose the Correct Option

What is a sequence in a database?


A. A group of related tables
B. A set of predefined database operations
C. A database object used to generate unique numeric values
D. A type of database join operation
Correct Answer : C

Q933. Choose the Correct Option

Which SQL statement is used to create a new sequence?


A. CREATE SEQUENCE
B. DEFINE SEQUENCE
C. GENERATE SEQUENCE
D. SEQUENCE CREATE
Correct Answer : A

Q934. Choose the Correct Option


What is the purpose of the INCREMENT BY clause in a sequence?
A. It specifies the starting value of the sequence.
B. It determines the maximum value the sequence can generate.
C. It defines the interval between sequence numbers.
D. It sets the sequence to increment by a specific value.
Correct Answer : D

Q935. Choose the Correct Option

Which statement is true about the CYCLE option in a sequence?


A. It restarts the sequence from the beginning after reaching the maximum value.
B. It prevents the sequence from generating more values after reaching the maximum.
C. It generates an error when the sequence reaches the maximum value.
D. It continues generating values from the minimum after reaching the maximum.
Correct Answer : A

Q936. Choose the Correct Option

What is the purpose of the CACHE option in a sequence?


A. It specifies the number of sequence values to keep in memory for faster access.
B. It sets the sequence to generate values in ascending order.
C. It defines the maximum value the sequence can generate.
D. It enables automatic caching of query results.
Correct Answer : A

Q937. Choose the Correct Option

How can you restart a sequence to its initial value?


A. Using the RESET statement
B. Using the RESTART statement
C. Dropping and recreating the sequence
D. Using the ALTER SEQUENCE RESTART statement
Correct Answer : C
Q938. Choose the Correct Option

What happens if the NOORDER option is specified when creating a sequence?


A. The sequence values are generated in ascending order.
B. The sequence values are generated in descending order.
C. The sequence values are generated in random order.
D. The sequence values are not guaranteed to be generated in any specific order.
Correct Answer : D

Q939. Choose the Correct Option

Which function is used to access the next value of a sequence in SQL?


A. NEXTVAL
B. CURRENTVAL
C. INCREMENT
D. GETSEQUENCE
Correct Answer : A

Q940. Choose the Correct Option

What does the START WITH clause specify in a sequence?


A. The ending value of the sequence
B. The increment value for the sequence
C. The initial value of the sequence
D. The maximum value the sequence can generate
Correct Answer : C

Q941. Choose the Correct Option

Which of the following statements is true about sequences in a database?


A. Sequences are specific to certain database vendors and cannot be used universally.
B. Sequences are always associated with a specific table.
C. Sequences guarantee unique values across different database sessions.
D. Sequences can only generate character values, not numeric values.
Correct Answer : C

Q942. Choose the Correct Option

What is a transaction in the context of a DBMS?


A. A group of related tables
B. A set of predefined database operations
C. A sequence of one or more SQL statements that are executed as a unit
D. A type of database join operation
Correct Answer : C

Q943. Choose the Correct Option

What is the purpose of the ACID properties in database transactions?


A. To ensure that transactions are executed in alphabetical order
B. To maintain the consistency and reliability of transactions in a DBMS
C. To specify the order of execution for concurrent transactions
D. To limit the access of transactions to specific data
Correct Answer : B

Q944. Choose the Correct Option

What does the "I" stand for in the ACID properties of transactions?
A. Integrity
B. Isolation
C. Insertion
D. Induction
Correct Answer : B

Q945. Choose the Correct Option

In the context of transactions, what is a deadlock?


A. A situation where two or more transactions are waiting for each other to release locks
B. A situation where a transaction is waiting indefinitely for a resource held by another
transaction
C. A situation where transactions are executed out of order
D. A situation where transactions are executed simultaneously without conflicts
Correct Answer : A

Q946. Choose the Correct Option

What is the purpose of the ROLLBACK statement in a transaction?


A. To commit the transaction
B. To undo any changes made during the current transaction
C. To save the transaction to a log file
D. To release any locks held by the transaction
Correct Answer : B

Q947. Choose the Correct Option

Which isolation level ensures that transactions do not interfere with each other at all?
A. READ UNCOMMITTED
B. READ COMMITTED
C. REPEATABLE READ
D. SERIALIZABLE
Correct Answer : D

Q948. Choose the Correct Option

What is the purpose of the COMMIT statement in a transaction?


A. To undo any changes made during the current transaction
B. To save the transaction to a log file
C. To release any locks held by the transaction
D. To make all changes made during the current transaction permanent
Correct Answer : D
Q949. Choose the Correct Option

What does the "C" stand for in the ACID properties of transactions?
A. Consistency
B. Concurrency
C. Commitment
D. Conformance
Correct Answer : A

Q950. Choose the Correct Option

Which of the following is a benefit of using transactions in a DBMS?


A. Transactions make all database operations faster.
B. Transactions eliminate the need for data backups.
C. Transactions ensure data integrity and consistency.
D. Transactions restrict access to the database.
Correct Answer : C

Q951. Choose the Correct Option

What is a savepoint in the context of transactions?


A. A point in the transaction where changes are automatically saved
B. A point in the transaction to which you can later roll back
C. A point in the transaction where concurrent access is allowed
D. A point in the transaction where isolation is reduced
Correct Answer : B
Assuming we have a "Bank" table with the following sample data:

| account_number | account_holder | balance |

| -------------- | --------------- | ------- |

| 1001 | John Doe | 5000.00 |

| 1002 | Jane Smith | 7500.50 |

| 1003 | Alice Johnson | 3000.25 |

```sql

CREATE TABLE Bank (

account_number NUMBER PRIMARY KEY,

account_holder VARCHAR2(100),

balance NUMBER(10, 2)

);

Here's a PL/SQL code snippet based on this data:

PL/SQL Code Snippet:

```plsql

DECLARE

v_balance NUMBER;

BEGIN

SELECT balance

INTO v_balance

FROM Bank

WHERE account_holder = 'John Doe';

DBMS_OUTPUT.PUT_LINE('John Doe\'s Balance: $' || v_balance);


END;

```

Based on above details gives the following question’s answer

1. What is the primary purpose of the PL/SQL code snippet?

a) Updates John Doe's account balance

b) Deletes John Doe's account record

c) Retrieves and displays John Doe's account balance

d) Inserts a new account record for John Doe

Answer: c) Retrieves and displays John Doe's account balance

2. What is the data type of the "balance" column in the "Bank" table?

a) String

b) Date

c) Number

d) Boolean

Answer: c) Number

3. Which SQL operation is performed in the PL/SQL code?

a) INSERT

b) DELETE

c) SELECT

d) UPDATE

Answer: c) SELECT

4. What is the purpose of the `INTO` clause in the code?

a) To indicate the end of the PL/SQL block

b) To declare a new variable

c) To specify the source of data for the SELECT statement

d) To define a cursor

Answer: c) To specify the source of data for the SELECT statement


5. What does the `DBMS_OUTPUT.PUT_LINE` statement do in the code?

a) Updates the database records

b) Deletes database records

c) Retrieves data from the database

d) Displays a message in the console

Answer: d) Displays a message in the console

here are 10 multiple-choice questions (MCQs) based on a PL/SQL code snippet

PL/SQL Code Snippet:

```plsql

DECLARE

v_employee_count NUMBER;

BEGIN

SELECT COUNT() INTO v_employee_count

FROM Employees;

DBMS_OUTPUT.PUT_LINE('Total Employees: ' || v_employee_count);

END;

```

MCQs:

1. What is the primary purpose of the PL/SQL code snippet?

a) Updates employee records

b) Deletes employee records

c) Retrieves and displays the total number of employees


d) Inserts a new employee record

Answer: c) Retrieves and displays the total number of employees

2. In the code snippet, what is the value stored in the `v_employee_count` variable?

a) Employee names

b) Employee IDs

c) Total number of employees

d) Employee salaries

Answer: c) Total number of employees

3. Which SQL operation is performed in the PL/SQL code?

a) INSERT

b) DELETE

c) SELECT

d) UPDATE

Answer: c) SELECT

4. What is the purpose of the `INTO` clause in the code?

a) To indicate the end of the PL/SQL block

b) To declare a new variable

c) To specify the source of data for the SELECT statement

d) To define a cursor

Answer: c) To specify the source of data for the SELECT statement

5. What does the `DBMS_OUTPUT.PUT_LINE` statement do in the code?

a) Updates the database records

b) Deletes database records

c) Retrieves data from the database

d) Displays a message in the console

Answer: d) Displays a message in the console


6. Which PL/SQL construct allows you to handle exceptions in a structured manner?

a) TRY-CATCH

b) EXCEPTION

c) ERROR-HANDLER

d) ON-ERROR

Answer: b) EXCEPTION

7. In PL/SQL, what is the primary purpose of a cursor?

a) To define variables

b) To loop through a result set

c) To declare procedures

d) To manage transactions

Answer: b) To loop through a result set

8. What is the expected output of the code snippet if there are 100 employees in the "Employees"
table?

a) Total Employees: 100

b) Total Employees: 0

c) Total Employees: 1

d) Total Employees: 99

Answer: a) Total Employees: 100

9. What type of variable is `v_employee_count` in the code snippet?

a) String

b) Date

c) Number

d) Boolean

Answer: c) Number

10. In PL/SQL, how can you pass a parameter to a stored procedure?

a) Using a RETURN statement


b) Using a SELECT statement

c) Using an IN parameter

d) Using a WHERE clause

Answer: c) Using an IN parameter

Here's a PL/SQL package with a "College" table and some basic code snippets :

```sql

-- Create the College table

CREATE TABLE College (

student_id NUMBER PRIMARY KEY,

student_name VARCHAR2(50),

major VARCHAR2(50)

);

+------------+--------------+-------------------+

| student_id | student_name | major |

+------------+--------------+-------------------+

| 1 | John Smith | Computer Science |

| 2 | Jane Doe | Biology |

| 3 | Alice Johnson| History |

| 4 | Bob Brown | Mathematics |

| 5 | Eva Williams| Chemistry |

+------------+--------------+-------------------+
```plsql

-- Create a PL/SQL package


CREATE OR REPLACE PACKAGE College_Package AS

-- Function to retrieve student count by major


FUNCTION getStudentCountByMajor(major IN VARCHAR2) RETURN NUMBER;

FUNCTION mcq1 RETURN VARCHAR2;

FUNCTION mcq2 RETURN NUMBER;

END College_Package;
/

CREATE OR REPLACE PACKAGE BODY College_Package AS

-- Function to retrieve student count by major


FUNCTION getStudentCountByMajor(major IN VARCHAR2) RETURN NUMBER IS
cnt NUMBER;
BEGIN
SELECT COUNT() INTO cnt FROM College WHERE major = major;
RETURN cnt;
END;

FUNCTION mcq1 RETURN VARCHAR2 IS


BEGIN
RETURN 'student_id';
END;

FUNCTION mcq2 RETURN NUMBER IS

biology_count NUMBER;

BEGIN

biology_count := getStudentCountByMajor('Biology');

RETURN biology_count;

END;

END College_Package;

```
MCQ 1: Which column is used to uniquely identify students?

A) student_id

B) student_name

C) major

D) None of the above

Answer: A) student_id

MCQ 2: How many students are majoring in Computer Science?

A) 1

B) 2

C) 3

D) 0

Answer: A) 1

MCQ 3: What is the data type of the "student_name" column in the College table?

A) NUMBER

B) VARCHAR2

C) DATE

D) BOOLEAN

Answer: B) VARCHAR2

MCQ 4: Which PL/SQL construct is used to loop through records in a result set?

A) FOR loop

B) IF statement

C) WHILE loop

D) CASE statement

Answer: A) FOR loop

MCQ 5: How many students are majoring in Chemistry?

A) 1

B) 2
C) 3

D) 0

Answer: A) 1

MCQ 6: Which PL/SQL keyword is used to declare a variable?

A) DEFINE

B) DECLARE

C) VARIABLE

D) SET

Answer: B) DECLARE

MCQ 7: What is the output of the following PL/SQL code?

```plsql

DECLARE

total_students NUMBER;

BEGIN

total_students := College_Package.getStudentCountByMajor('Computer Science');

DBMS_OUTPUT.PUT_LINE('Total students in Computer Science: ' || total_students);

END;

```

A) Total students in Computer Science: 1

B) Total students in Computer Science: 2

C) Total students in Computer Science: 3

D) Total students in Computer Science: 0

Answer: A) Total students in Computer Science: 1

MCQ 8: Which PL/SQL statement is used to raise an exception?

A) RAISE

B) THROW

C) EXCEPTION
D) ERROR

Answer: A) RAISE

MCQ 9: What is the purpose of the PRIMARY KEY constraint in the College table?

A) It enforces unique values in the "student_name" column.

B) It enforces unique values in the "major" column.

C) It ensures that the "student_id" column is not null.

D) It uniquely identifies each row in the table.

Answer: D) It uniquely identifies each row in the table.

MCQ 10: Which PL/SQL construct is used to handle exceptions in a controlled manner?

A) TRY...CATCH block

B) EXCEPTION block

C) ERROR block

D) HANDLE block

Answer: B) EXCEPTION block

Here's a PL/SQL code snippet for a hypothetical "hospital" table, along with 10 multiple-choice
questions (MCQs)

Let's create a PL/SQL trigger for the "hospital" table. This trigger updates the "patient_count" column
in a separate "hospital_stats" table whenever a new patient is inserted into the "hospital" table.

```sql

-- Create the hospital_stats table to store statistics.

CREATE TABLE hospital_stats (

total_patients NUMBER

);

-- Create a sequence to generate unique IDs for each patient.

CREATE SEQUENCE patient_id_seq START WITH 1;


-- Create the hospital table.

CREATE TABLE hospital (

patient_id NUMBER PRIMARY KEY,

patient_name VARCHAR2(50),

admission_date DATE,

discharge_date DATE

);

-- Create the trigger to update patient count in hospital_stats.

CREATE OR REPLACE TRIGGER update_patient_count

AFTER INSERT ON hospital

FOR EACH ROW

BEGIN

UPDATE hospital_stats

SET total_patients = total_patients + 1;

END;

```

Multiple-Choice Questions (MCQs):

1. What is the purpose of the "update_patient_count" trigger in the "hospital" table?

a) To automatically update all patient records.

b) To update the total count of patients in the "hospital_stats" table when a new patient is inserted.

c) To prevent new records from being inserted.

d) To calculate the average length of stay for all patients.

Correct Answer: b

2. In which event(s) will the "update_patient_count" trigger execute?


a) Before inserting a new patient record.

b) After deleting a patient record.

c) Before updating an existing patient record.

d) After inserting a new patient record.

Correct Answer: d

3. What does `AFTER INSERT ON hospital` mean in the trigger definition?

a) The trigger fires before a new patient record is inserted.

b) The trigger fires after a patient record is deleted.

c) The trigger fires after a new patient record is inserted.

d) The trigger fires before an existing patient record is updated.

Correct Answer: c

4. What is the purpose of the "hospital_stats" table in the code snippet?

a) To store patient names.

b) To store admission and discharge dates.

c) To store statistics related to the hospital, such as the total number of patients.

d) To store the patient IDs.

Correct Answer: c

5. How is the "patient_id" assigned in the "hospital" table?

a) Manually entered by the user.

b) Generated automatically using a sequence.

c) Copied from the "patient_id" in the "hospital_stats" table.

d) Set to a constant value.

Correct Answer: b
6. What happens if you attempt to insert a new patient record without specifying values for
"patient_name," "admission_date," and "discharge_date"?

a) The trigger inserts default values.

b) The trigger raises an error.

c) The trigger inserts NULL values.

d) The trigger generates random values.

Correct Answer: b

7. Which keyword is used to specify the trigger action timing in PL/SQL?

a) WHEN

b) BEFORE

c) AFTER

d) TRIGGER

Correct Answer: c

8. What is the primary purpose of the `UPDATE hospital_stats SET total_patients = total_patients +
1;` statement in the trigger?

a) To delete a patient record.

b) To insert a new patient record.

c) To update the "patient_count" column in the "hospital_stats" table.

d) To calculate the average length of stay for all patients.

Correct Answer: c

9. Can you have multiple triggers with the same timing (e.g., AFTER INSERT) on the same table?

a) No, only one trigger is allowed per table.

b) Yes, but they must have different names.

c) Yes, and they execute in a random order.

d) No, it will result in an error.


Correct Answer: b

10. What does the `CREATE SEQUENCE patient_id_seq START WITH 1;` statement do in the code
snippet?

a) It creates a new table.

b) It defines a new trigger.

c) It creates a sequence for generating unique patient IDs.

d) It initializes the patient ID to 1.

Correct Answer: c

A PL/SQL procedure that takes two numbers as input parameters, adds them together, and then
displays the result using dbms_output:

```sql

CREATE OR REPLACE PROCEDURE add_numbers (

p_num1 IN NUMBER,

p_num2 IN NUMBER

) AS

v_result NUMBER;

BEGIN

-- Perform the addition

v_result := p_num1 + p_num2;

-- Display the result


DBMS_OUTPUT.PUT_LINE('The sum of ' || p_num1 || ' and ' || p_num2 || ' is ' || v_result);

END add_numbers;

```

Here's an example of how to call this procedure:

```sql

DECLARE

num1 NUMBER := 10;

num2 NUMBER := 20;

BEGIN

add_numbers(num1, num2);

END;

```

This will call the `add_numbers` procedure with `num1` and `num2` as arguments and display the
sum.

Based on given pl sql answer the following mcq:

1. What is the purpose of the PL/SQL procedure mentioned in the code snippet?

A. To subtract two numbers.

B. To add two numbers and display the result.

C. To multiply two numbers.

D. To divide two numbers.

Answer: B

2. How many input parameters does the `add_numbers` procedure have?

A. None

B. One
C. Two

D. Three

Answer: C

3. What data type are the input parameters `p_num1` and `p_num2` in the `add_numbers`
procedure?

A. VARCHAR2

B. DATE

C. NUMBER

D. BOOLEAN

Answer: C

4. What is the purpose of the `DBMS_OUTPUT.PUT_LINE` statement in the procedure?

A. It calculates the sum of two numbers.

B. It displays the result of the addition.

C. It defines a new variable.

D. It retrieves data from the database.

Answer: B

5. How is the result of the addition operation displayed in the output?

A. Using the PRINT statement

B. Using the RETURN statement

C. Using the DBMS_OUTPUT.PUT_LINE statement

D. Using the DISPLAY statement

Answer: C

6. What should you do to call the `add_numbers` procedure with specific numbers as arguments?

A. Use the CALL statement.

B. Use the SELECT statement.

C. Use the DECLARE block.


D. Use the EXECUTE statement.

Answer: C

7. In the example provided for calling the procedure, what are the values of `num1` and `num2`?

A. num1 = 20, num2 = 10

B. num1 = 10, num2 = 30

C. num1 = 10, num2 = 20

D. num1 = 30, num2 = 10

Answer: C

8. What is the result of calling the `add_numbers` procedure with `num1` and `num2` as arguments
in the example?

A. 10

B. 20

C. The sum of 10 and 20 is 30

D. There will be no output.

Answer: C

9. Which SQL statement is used to create a PL/SQL procedure?

A. CREATE PROCEDURE

B. DECLARE PROCEDURE

C. EXECUTE PROCEDURE

D. CALL PROCEDURE

Answer: A

10. What is the purpose of the `DECLARE` block in the example?

A. To define a new variable.

B. To execute SQL statements.

C. To declare and initialize variables before calling the procedure.

D. To declare a function.
Answer: C

1. What is the primary purpose of database recovery?

A) Data storage

B) Data retrieval

C) Data backup

D) Data restoration

Answer: D) Data restoration

2. Why is database recovery necessary?

A) To improve query performance

B) To reduce storage costs

C) To handle system failures and data corruption

D) To optimize data indexing

Answer: C) To handle system failures and data corruption

3. Which of the following is NOT a type of error that can lead to the need for database recovery?

A) Human errors

B) Software errors

C) Hardware failures

D) Efficient query execution

Answer: D) Efficient query execution

4. What type of error occurs when a user accidentally deletes important data from a database?

A) Human error

B) Software error

C) Hardware failure

D) Network error

Answer: A) Human error


5. Which type of recovery technique involves creating a copy of the entire database at a specific
point in time?

A) Incremental backup

B) Full backup

C) Partial backup

D) Log-based recovery

Answer: B) Full backup

6. Which recovery technique involves capturing changes made to the database since the last backup
and applying those changes to restore the database?

A) Incremental backup

B) Full backup

C) Partial backup

D) Rollback recovery

Answer: A) Incremental backup

7. What is a common method used to track changes to a database and support recovery?

A) Version control

B) Transaction logs

C) Database normalization

D) Data encryption

Answer: B) Transaction logs

8. Which recovery technique involves undoing incomplete transactions to bring the database back to
a consistent state?

A) Incremental backup

B) Rollback recovery

C) Full backup

D) Point-in-time recovery

Answer: B) Rollback recovery


9. What is the purpose of a checkpoint in database recovery?

A) To create a backup of the entire database

B) To track changes made by users

C) To mark a point in time when all committed transactions are safely stored on disk

D) To recover lost data

Answer: C) To mark a point in time when all committed transactions are safely stored on disk

10. Which recovery technique allows for recovering the database to a specific point in time, rather
than just the last backup?

A) Incremental backup

B) Rollback recovery

C) Point-in-time recovery

D) Full backup

Answer: C) Point-in-time recovery

Q1. Which data model allows data to be represented as interconnected nodes, forming a web-like
structure?

a) Relational model

b) Hierarchical model

c) Network model

d) Graph model

Q2. What does a dashed line between two entities in an ER diagram represent?

a) Primary key relationship

b) Foreign key relationship

c) Weak entity relationship

d) Strong entity relationship

Q3. Which normal form deals with eliminating transitive dependencies?

a) First Normal Form (1NF)

b) Second Normal Form (2NF)


c) Third Normal Form (3NF)

d) Boyce-Codd Normal Form (BCNF)

Q4. In database normalization, functional dependencies are represented using:

a) Entity-Relationship (ER) diagrams

b) SQL queries

c) Dependency diagrams

d) Dependency matrices

Q5. Which SQL clause is used to group rows based on a specific column in a SELECT statement?

a) SELECT

b) FROM

c) WHERE

d) GROUP BY

Q6. Which SQL aggregate function is used to calculate the average value of a column?

a) COUNT

b) SUM

c) AVG

d) MAX

Q7. Which SQL aggregate function is used to calculate the total number of rows in a result set?

a) COUNT

b) SUM

c) AVG

d) MAX

Q8. Which SQL join type returns only the rows that have matching values in both tables?

a) INNER JOIN

b) LEFT JOIN

c) RIGHT JOIN
d) FULL OUTER JOIN

Q9. Which SQL join type returns all the rows from the left table and the matching rows from the right
table?

a) INNER JOIN

b) LEFT JOIN

c) RIGHT JOIN

d) FULL OUTER JOIN

Q10. Which SQL clause is used to filter rows based on a set of multiple conditions?

a) AND

b) OR

c) NOT

d) XOR

Section - B
(Q 11 to 25: Each question carries 2 marks)

Q11. Which SQL query is used to retrieve all records from a table named "Employees"?

a) SELECT * FROM Employees;

b) SELECT Employees FROM *;

c) SELECT FROM Employees;

d) SELECT Employees;

Q12. Which SQL query is used to retrieve records from two tables named "Orders" and "Customers"
based on a common column "CustomerID"?

a) SELECT * FROM Orders INNER JOIN Customers ON Orders.CustomerID =


Customers.CustomerID;

b) SELECT * FROM Orders JOIN Customers ON Orders.CustomerID = Customers.CustomerID;

c) SELECT FROM Orders, Customers WHERE Orders.CustomerID = Customers.CustomerID;

d) SELECT * FROM Orders CROSS JOIN Customers;


Q13. Which SQL query is used to calculate the average value of a column named "Salary" from a
table named "Employees"?

a) SELECT AVG(Salary) FROM Employees;

b) SELECT Salary FROM Employees AVG;

c) SELECT FROM Employees WHERE AVG(Salary);

d) SELECT Employees WHERE AVG(Salary) FROM;

Q14. Which of the following statements are TRUE about an SQL query?

P: An SQL query can contain a HAVING clause even if it does not a GROUP BY clause

Q: An SQL query can contain a HAVING clause only if it has a GROUP BY clause

R: All attributes used in the GROUP BY clause must appear in the SELECT clause

S: Not all attributes used in the GROUP BY clause need to appear in the SELECT clause

(A) P and R

(B) P and S

(C) Q and R

(D) Q and S

Q15. Given the basic ER and relational models, which of the following is INCORRECT?

(A) An attributes of an entity can have more that one value

(B) An attribute of an entity can be composite

(C) In a row of a relational table, an attribute can have more than one value

(D) In a row of a relational table, an attribute can have exactly one value or a NULL value

Q16.

Consider the `flights` and `passengers` tables:

`flights` table:
`passengers` table:

Which SQL query retrieves the names of passengers who are on a flight departing from New York and
arriving in Los Angeles?

A. `SELECT passenger_name FROM passengers WHERE flight_id IN (SELECT flight_id FROM flights
WHERE departure_city = 'New York' AND arrival_city = 'Los Angeles');`

B. `SELECT passenger_name FROM passengers WHERE flight_id = (SELECT flight_id FROM flights
WHERE departure_city = 'New York' AND arrival_city = 'Los Angeles');`

C. `SELECT passenger_name FROM passengers WHERE flight_id = (SELECT flight_id FROM flights
WHERE departure_city = 'New York') AND flight_id = (SELECT flight_id FROM flights WHERE
arrival_city = 'Los Angeles');`

D. `SELECT passenger_name FROM passengers WHERE flight_id IN (SELECT flight_id FROM flights
WHERE departure_city = 'Los Angeles' AND arrival_city = 'New York');

Q17.

Consider the `flights` table:


Which SQL query lists the flight names and the number of passengers on each flight for flights
departing from New York?

A. `SELECT flight_name, COUNT(*) AS passenger_count FROM flights JOIN passengers ON


flights.flight_id = passengers.flight_id WHERE departure_city = 'New York' GROUP BY flight_name;`

B. `SELECT flight_name, COUNT(passenger_id) AS passenger_count FROM flights LEFT JOIN


passengers ON flights.flight_id = passengers.flight_id WHERE departure_city = 'New York' GROUP
BY flight_name;`

C. `SELECT flight_name, COUNT(passenger_id) AS passenger_count FROM flights INNER JOIN


passengers ON flights.flight_id = passengers.flight_id WHERE departure_city = 'New York' GROUP BY
flight_name;`

D. `SELECT flight_name, COUNT(*) AS passenger_count FROM flights NATURAL JOIN passengers


WHERE departure_city = 'New York' GROUP BY flight_name;`

Q18.

Consider the `accounts` and `transactions` tables:

`accounts` table:

`transactions` table:

Which SQL query returns the account numbers and balances of accounts that have never been
involved in a withdrawal transaction?

A.

SELECT a.account_number, a.balance

FROM accounts a
WHERE a.account_id NOT IN (SELECT DISTINCT account_id FROM transactions WHERE
transaction_type = 'Withdrawal');

B.

SELECT a.account_number, a.balance

FROM accounts a

WHERE NOT EXISTS (SELECT 1 FROM transactions WHERE account_id = a.account_id AND
transaction_type = 'Withdrawal');

C.

SELECT a.account_number, a.balance

FROM accounts a

LEFT JOIN transactions t ON a.account_id = t.account_id

WHERE t.transaction_type IS NULL OR t.transaction_type <> 'Withdrawal';

D.

SELECT a.account_number, a.balance

FROM accounts a

LEFT JOIN transactions t ON a.account_id = t.account_id

GROUP BY a.account_number, a.balance

HAVING SUM(CASE WHEN t.transaction_type = 'Withdrawal' THEN 1 ELSE 0 END) = 0;

Given this schema of a student Database give answers to the following query:

Tracks the student in database

CREATE TABLE Students (

student_id INT PRIMARY KEY,

first_name VARCHAR(50),

last_name VARCHAR(50),

date_of_birth DATE,

email VARCHAR(100),

phone_number VARCHAR(20),
address VARCHAR(100)

);

Tracks the courses in a school

CREATE TABLE Courses (

course_id INT PRIMARY KEY,

course_name VARCHAR(100),

course_description VARCHAR(255),

credits INT

);

Tracks a student course rel

CREATE TABLE Enrollments (

enrollment_id INT PRIMARY KEY,

student_id INT,

course_id INT,

enrollment_date DATE,

grade VARCHAR(2),

FOREIGN KEY (student_id) REFERENCES Students(student_id),

FOREIGN KEY (course_id) REFERENCES Courses(course_id)

);

Gives multiple-choice questions (MCQs) answer based on queries that can be performed on the given
database schema->

Q19.

Which query would you use to retrieve the names of all students who are enrolled in the course
with course_id 101?

A) SELECT first_name, last_name FROM Students WHERE course_id = 101;


B) SELECT first_name, last_name FROM Enrollments WHERE course_id = 101;

C) SELECT first_name, last_name FROM Students JOIN Enrollments ON Students.student_id =


Enrollments.student_id WHERE Enrollments.course_id = 101;

D) SELECT first_name, last_name FROM Courses WHERE course_id = 101;

Q20. What does the following query do?

SELECT course_name, COUNT(*) AS enrolled_students

FROM Courses

JOIN Enrollments ON Courses.course_id = Enrollments.course_id

GROUP BY course_name;

A) Retrieves a list of all courses along with the count of enrolled students in each course.

B) Retrieves a list of all courses along with the count of distinct course IDs.

C) Retrieves a list of all students along with the courses they are enrolled in.

D) Retrieves a list of all students along with their grades in each course.

Q21. Which query would you use to find the average number of credits for all courses?

A) SELECT AVG(credits) FROM Courses;

B) SELECT SUM(credits) / COUNT(*) FROM Courses;

C) SELECT AVG(credits) FROM Enrollments;

D) SELECT AVG(credits) FROM Students;

Q22. What does the following query do?

SELECT first_name, last_name, course_name

FROM Students

JOIN Enrollments ON Students.student_id = Enrollments.student_id

JOIN Courses ON Enrollments.course_id = Courses.course_id

WHERE grade = 'A';


A) Retrieves the names of students who received an 'A' grade in their courses.

B) Retrieves the names of students along with their enrolled courses, regardless of the grade.

C) Retrieves the names of students who are enrolled in courses with the name 'A'.

D) Retrieves the names of students who have not received any grades.

Given this schema of a Database to manage multiple restaurants give answers to the following
queries:

Restaurants table to track restaurants in the database:

CREATE TABLE Restaurants (

restaurant_id INT PRIMARY KEY,

name VARCHAR(100),

address VARCHAR(100),

phone_number VARCHAR(20),

opening_time TIME,

closing_time TIME

);

MenuItems table to tracks Menu Items and connect them to a restaurant

CREATE TABLE MenuItems (

item_id INT PRIMARY KEY,

restaurant_id INT,

name VARCHAR(100),

description VARCHAR(255),

price DECIMAL(8, 2),

FOREIGN KEY (restaurant_id) REFERENCES Restaurants(restaurant_id)

);

Orders table to track and create Orders for a particular restaurant:


CREATE TABLE Orders (

order_id INT PRIMARY KEY,

restaurant_id INT,

table_number INT,

order_date DATE,

total_amount DECIMAL(10, 2),

FOREIGN KEY (restaurant_id) REFERENCES Restaurants(restaurant_id)

);

Order Items Table to track the items ordered within each order:

CREATE TABLE OrderItems (

order_item_id INT PRIMARY KEY,

order_id INT,

item_id INT,

quantity INT,

FOREIGN KEY (order_id) REFERENCES Orders(order_id),

FOREIGN KEY (item_id) REFERENCES MenuItems(item_id)

);

Gives multiple-choice questions (MCQs) answers based on queries that can be performed on the
given restaurant database schema->

Q23. What type of relationship is defined between the "Restaurants" and "MenuItems" tables?

A) One-to-one

B) One-to-many

C) Many-to-one

D) Many-to-many
Q24. Which query would you use to update the price of a menu item with item_id 501 to $15.99?

A) UPDATE MenuItems SET price = 15.99 WHERE item_id = 501;

B) UPDATE Orders SET price = 15.99 WHERE item_id = 501;

C) UPDATE MenuItems SET price = 15.99 WHERE item_id = 501;

D) UPDATE Orders SET price = 15.99 WHERE order_item_id = 501;

Q25. What does the following query do?

SELECT MAX(price) AS highest_price

FROM MenuItems

WHERE restaurant_id = 601;

A) Retrieves the maximum price of all menu items in restaurant with ID 601.

B) Retrieves the minimum price of all menu items in restaurant with ID 601.

C) Retrieves the average price of all menu items in restaurant with ID 601.

D) Retrieves the total price of all menu items in restaurant with ID 601.

Q1. Which SQL clause is used to sort the result set in ascending or descending order?

a) SELECT

b) ORDER BY

c) GROUP BY

d) SORT BY

Q2. Which SQL clause is used to combine rows from two or more tables based on a related column
between them?

a) SELECT

b) FROM

c) WHERE

d) JOIN
Q3. Which SQL aggregate function is used to calculate the average value of a column?

a) COUNT

b) SUM

c) AVG

d) MAX

Q4. Which SQL join type returns all the rows from the left table and the matching rows from the right
table?

a) INNER JOIN

b) LEFT JOIN

c) RIGHT JOIN

d) FULL OUTER JOIN

Q5. Which SQL function is used to retrieve the current date and time?

a) GETDATE()

b) SYSDATE()

c) NOW()

d) CURRENT_TIMESTAMP()

Q6. Which SQL keyword is used to create a unique index on a table?

a) UNIQUE

b) INDEX

c) PRIMARY KEY

d) CONSTRAINT

Q7. Which SQL clause is used to filter rows based on a set of multiple conditions?

a) AND

b) OR

c) NOT
d) XOR

Q8. Which of the following is an example of authentication in database security?

a) Implementing access control policies

b) Encrypting sensitive data

c) Verifying the identity of users

d) Auditing database activities

Q9. What is the purpose of database auditing?

a) Preventing unauthorized access to the database

b) Monitoring and recording database activities

c) Ensuring data availability during system failures

d) Managing database backups and recovery

Q10. What is the purpose of using views in a database system?

a) To improve database performance by reducing the number of tables.

b) To enforce referential integrity constraints.

c) To create a logical representation of data from multiple tables.

d) To restrict access to certain columns of a table.

Section - B
(Q 11 to 25: Each question carries 2 marks)

Q11. Which SQL query is used to retrieve records from two tables named "Orders" and "Customers"
based on a common column "CustomerID"?

a) SELECT * FROM Orders INNER JOIN Customers ON Orders.CustomerID =


Customers.CustomerID;
b) SELECT * FROM Orders JOIN Customers ON Orders.CustomerID = Customers.CustomerID;

c) SELECT FROM Orders, Customers WHERE Orders.CustomerID = Customers.CustomerID;

d) SELECT * FROM Orders CROSS JOIN Customers;

Q12. Which SQL query is used to calculate the average value of a column named "Salary" from a
table named "Employees"?

a) SELECT AVG(Salary) FROM Employees;

b) SELECT Salary FROM Employees AVG;

c) SELECT FROM Employees WHERE AVG(Salary);

d) SELECT Employees WHERE AVG(Salary) FROM;

Q13. Which SQL query is used to delete all records from a table named "Products" where the
"Category" column is 'Electronics'?

a) DELETE * FROM Products WHERE Category = 'Electronics';

b) DELETE FROM Products WHERE Category = 'Electronics';

c) DELETE Products WHERE Category = 'Electronics';

d) REMOVE FROM Products WHERE Category = 'Electronics';

Q14. Which SQL query is used to count the number of records in a table named "Orders"?

a) SELECT COUNT(*) FROM Orders;

b) COUNT(*) FROM Orders;

c) SELECT * FROM Orders COUNT;

d) SELECT COUNT(Orders) FROM *;

Q15. Given the basic ER and relational models, which of the following is INCORRECT?

(A) An attributes of an entity can have more that one value

(B) An attribute of an entity can be composite

(C) In a row of a relational table, an attribute can have more than one value

(D) In a row of a relational table, an attribute can have exactly one value or a NULL value

Q16.
Consider the `flights` table:

Which SQL query calculates the average duration (in hours) of flights departing from New York?

A. `SELECT AVG(arrival_time - departure_time) AS avg_duration FROM flights WHERE


departure_city = 'New York';`

B. `SELECT AVG(TIMEDIFF(arrival_time, departure_time)) AS avg_duration FROM flights WHERE


departure_city = 'New York';`

C. `SELECT AVG(UNIX_TIMESTAMP(arrival_time) - UNIX_TIMESTAMP(departure_time)) / 3600 AS


avg_duration FROM flights WHERE departure_city = 'New York';`

D. `SELECT AVG(DATEDIFF(hour, departure_time, arrival_time)) AS avg_duration FROM flights WHERE


departure_city = 'New York';`

Q17.

Consider the `flights` table:

Which SQL query lists the flight names and the number of passengers on each flight for flights
departing from New York?

A. `SELECT flight_name, COUNT(*) AS passenger_count FROM flights JOIN passengers ON


flights.flight_id = passengers.flight_id WHERE departure_city = 'New York' GROUP BY flight_name;`
B. `SELECT flight_name, COUNT(passenger_id) AS passenger_count FROM flights LEFT JOIN
passengers ON flights.flight_id = passengers.flight_id WHERE departure_city = 'New York' GROUP
BY flight_name;`

C. `SELECT flight_name, COUNT(passenger_id) AS passenger_count FROM flights INNER JOIN


passengers ON flights.flight_id = passengers.flight_id WHERE departure_city = 'New York' GROUP BY
flight_name;`

D. `SELECT flight_name, COUNT(*) AS passenger_count FROM flights NATURAL JOIN passengers


WHERE departure_city = 'New York' GROUP BY flight_name;`

Q18.

Consider the `accounts` and `transactions` tables:

`accounts` table:

`transactions` table:

Which SQL query returns the account numbers and balances of accounts that have never been
involved in a withdrawal transaction?

A.

SELECT a.account_number, a.balance

FROM accounts a

WHERE a.account_id NOT IN (SELECT DISTINCT account_id FROM transactions WHERE


transaction_type = 'Withdrawal');

B.
SELECT a.account_number, a.balance

FROM accounts a

WHERE NOT EXISTS (SELECT 1 FROM transactions WHERE account_id = a.account_id AND
transaction_type = 'Withdrawal');

C.

SELECT a.account_number, a.balance

FROM accounts a

LEFT JOIN transactions t ON a.account_id = t.account_id

WHERE t.transaction_type IS NULL OR t.transaction_type <> 'Withdrawal';

D.

SELECT a.account_number, a.balance

FROM accounts a

LEFT JOIN transactions t ON a.account_id = t.account_id

GROUP BY a.account_number, a.balance

HAVING SUM(CASE WHEN t.transaction_type = 'Withdrawal' THEN 1 ELSE 0 END) = 0;

Q19.

Consider the `customers` and `accounts` tables:

`customers` table:

`accounts` table:
Which SQL query retrieves the customer names and the total balance (sum of account balances) for
customers aged 30 or older?

A.

SELECT c.customer_name, SUM(a.balance) AS total_balance

FROM customers c

JOIN accounts a ON c.customer_id = a.customer_id

WHERE c.age >= 30

GROUP BY c.customer_name;

B.

SELECT customer_name, SUM(balance) AS total_balance

FROM customers

JOIN accounts ON customers.customer_id = accounts.customer_id

WHERE age >= 30

GROUP BY customer_name;

C.

SELECT customer_name, SUM(balance) AS total_balance

FROM customers

LEFT JOIN accounts ON customers.customer_id = accounts.customer_id

WHERE age >= 30

GROUP BY customer_name;

D.

SELECT c.customer_name, SUM(a.balance) AS total_balance

FROM customers c
LEFT JOIN accounts a ON c.customer_id = a.customer_id

WHERE c.age >= 30

GROUP BY c.customer_name;

Given this schema of a Database to manage multiple restaurants give answers to the following
queries:

Restaurants table to track restaurants in the database:

CREATE TABLE Restaurants (

restaurant_id INT PRIMARY KEY,

name VARCHAR(100),

address VARCHAR(100),

phone_number VARCHAR(20),

opening_time TIME,

closing_time TIME

);

MenuItems table to tracks Menu Items and connect them to a restaurant

CREATE TABLE MenuItems (

item_id INT PRIMARY KEY,

restaurant_id INT,

name VARCHAR(100),

description VARCHAR(255),

price DECIMAL(8, 2),

FOREIGN KEY (restaurant_id) REFERENCES Restaurants(restaurant_id)


);

Orders table to track and create Orders for a particular restaurant:

CREATE TABLE Orders (

order_id INT PRIMARY KEY,

restaurant_id INT,

table_number INT,

order_date DATE,

total_amount DECIMAL(10, 2),

FOREIGN KEY (restaurant_id) REFERENCES Restaurants(restaurant_id)

);

Order Items Table to track the items ordered within each order:

CREATE TABLE OrderItems (

order_item_id INT PRIMARY KEY,

order_id INT,

item_id INT,

quantity INT,

FOREIGN KEY (order_id) REFERENCES Orders(order_id),

FOREIGN KEY (item_id) REFERENCES MenuItems(item_id)

);

Gives multiple-choice questions (MCQs) answers based on queries that can be performed on the
given restaurant database schema, ->

Q20.

Which table contains information about the opening and closing times of restaurants?
A) Restaurants

B) MenuItems

C) Orders

D) OrderItems

Q21. Which query would you use to calculate the total revenue generated by a restaurant with
restaurant_id 201?

A) SELECT SUM(total_amount) FROM Orders WHERE restaurant_id = 201;

B) SELECT SUM(price) FROM MenuItems WHERE restaurant_id = 201;

C) SELECT AVG(total_amount) FROM Orders WHERE restaurant_id = 201;

D) SELECT MAX(total_amount) FROM Orders WHERE restaurant_id = 201;

Q22.

What does the following query do?

SELECT COUNT(DISTINCT table_number) AS num_tables

FROM Orders

WHERE restaurant_id = 301;

A) Retrieves the number of orders placed in restaurant with ID 301.

B) Retrieves the number of distinct table numbers in restaurant with ID 301.

C) Retrieves the average table number in restaurant with ID 301.

D) Retrieves the maximum table number in restaurant with ID 301.

Q23.

Which query would you use to retrieve the names of menu items that were ordered in the order
with order_id 401?

A) SELECT name FROM MenuItems WHERE order_id = 401;

B) SELECT name FROM MenuItems WHERE item_id = 401;

C) SELECT name FROM MenuItems JOIN OrderItems ON MenuItems.item_id = OrderItems.item_id


WHERE OrderItems.order_id = 401;
D) SELECT name FROM OrderItems JOIN MenuItems ON OrderItems.item_id = MenuItems.item_id
WHERE OrderItems.order_id = 401;

Q24.What does the following query do?

SELECT COUNT(*) AS num_items

FROM OrderItems

GROUP BY order_id

HAVING num_items > 3;

A) Retrieves the count of all menu items in each order with more than three items.

B) Retrieves the count of all orders with more than three menu items.

C) Retrieves the count of all menu items with more than three orders.

D) Retrieves the count of all orders and menu items combined, grouped by order_id.

Q25.

Which query would you use to update the price of a menu item with item_id 501 to $15.99?

A) UPDATE MenuItems SET price = 15.99 WHERE item_id = 501;

B) UPDATE Orders SET price = 15.99 WHERE item_id = 501;

C) UPDATE MenuItems SET price = 15.99 WHERE item_id = 501;

D) UPDATE Orders SET price = 15.99 WHERE order_item_id = 501;

You might also like