21.) Why is it important to close JDBC resources such as connections, statements, and result sets?
A) To release database locks
B) To improve query performance
C) To avoid resource leaks and free up resources
D) To prevent SQL injection attacks
22.) In which order should you close JDBC resources to ensure proper resource management?
A) Statement, Connection, ResultSet
B) ResultSet, Statement, Connection
C) Connection, Statement, ResultSet
D) ResultSet, Connection, Statement
23.) What is a database transaction in the context of JDBC?
A) A query that retrieves data from multiple tables
B) A single SQL statement
C) A group of SQL statements executed as a single unit
D) A stored procedure in the database
24.) What is the purpose of a JDBC Connection’s commit() method?
A) To start a new transaction
B) To roll back a transaction
C) To save changes made within a transaction
D) To execute a SQL query
25.) How can you roll back a transaction in JDBC?
A) By using the rollback() method of the Connection object
B) By using the executeRollback() method of the Statement object
C) By executing an SQL query with the ROLLBACK statement
D) By closing the JDBC connection
26.) What is connection pooling in JDBC?
A) A mechanism for storing database connection strings
B) A technique for optimizing SQL queries
C) A method for managing and reusing database connections
D) A way to secure database credentials
27.) Which JDBC feature allows you to execute multiple SQL statements in a batch?
A) Batch processing
B) Prepared statements
C) Transaction management
D) Connection pooling
28.) What is a stored procedure in the context of databases and JDBC?
A) A query that retrieves data from multiple tables
B) A predefined set of SQL statements that can be executed in one call
C) A query with dynamic parameters
D) An optimized SQL query
29.) Which JDBC interface is used to call stored procedures in the database?
A) Statement
B) PreparedStatement
C) CallableStatement
D) ResultSet
30.) What is a connection pool, and why is it used in JDBC?
A) A pool of JDBC drivers for redundancy
B) A pool of SQL queries for performance optimization
C) A pool of preconfigured database connections for reusability and efficiency
D) A pool of database tables for data storage