11.) Which type of statement is suitable for executing precompiled SQL queries with parameters?
A) Statement
B) PreparedStatement
C) CallableStatement
D) ResultStatement
12.) Which method is used to execute an SQL query using a JDBC Statement?
A) executeQuery()
B) executeUpdate()
C) execute()
D) All of these
13.) In JDBC, what is a ResultSet?
A) A connection to the database
B) A precompiled SQL statement
C) A collection of retrieved data rows from a query
D) A JDBC driver class
14.) How do you iterate through the rows of a ResultSet in JDBC?
A) Using a for loop
B) Using a while loop
C) Using a do-while loop
D) By calling the next() method
15.) Which method is used to execute an SQL statement that inserts, updates, or deletes data in the database?
A) executeQuery()
B) executeUpdate()
C) executeSqlQuery()
D) executeStatement()
16.) What is the return value of the executeUpdate() method in JDBC?
A) The number of rows affected by the SQL statement
B) The SQL query string
C) The result set of the query
D) A boolean indicating success or failure
17.) To prevent SQL injection attacks, which type of statement should you use when executing SQL statements with user-provided input?
A) Statement
B) PreparedStatement
C) CallableStatement
D) ResultStatement
18.) Which exception is commonly thrown when a JDBC connection cannot be established?
A) SQLException
B) ConnectionException
C) DatabaseException
D) JDBCException
19.) What is the purpose of handling exceptions in JDBC?
A) To terminate the application if an exception occurs
B) To ignore exceptions and continue execution
C) To log and report errors gracefully
D) To improve query performance
20.) Which method is used to obtain details about a SQLException in JDBC?
A) getErrorMessage()
B) getErrorCode()
C) getExceptionDetails()
D) getErrorDescription()