AStoring multiple database connections in a pool for reuse
BCombining multiple queries into one
CCreating backup connections
DAutomatic connection switching
Correct Answer:
A. Storing multiple database connections in a pool for reuse
EXPLANATION
Connection pooling maintains a pool of reusable database connections to improve performance and reduce overhead of creating new connections repeatedly.
Which method must be called to move cursor to the next row in ResultSet?
Anext()
BmoveNext()
Cadvance()
Dfetch()
Correct Answer:
A. next()
EXPLANATION
The next() method moves the ResultSet cursor to the next row and returns true if a row exists, false if no more rows. It's essential for iterating through results.
Which interface is used to execute precompiled SQL statements in JDBC?
AStatement
BPreparedStatement
CCallableStatement
DBatchStatement
Correct Answer:
B. PreparedStatement
EXPLANATION
PreparedStatement is used for precompiled SQL statements with parameters. It provides better performance and prevents SQL injection compared to Statement.
Which JDBC driver type is platform-independent and does not require native code?
AType 1 Driver
BType 2 Driver
CType 3 Driver
DType 4 Driver
Correct Answer:
D. Type 4 Driver
EXPLANATION
Type 4 (Thin) drivers are pure Java drivers, platform-independent, and don't require native code. They communicate directly with database using Java sockets.
Correct Answer:
A. Load Driver → Create Connection → Create Statement → Execute Query → Close Resources
EXPLANATION
The correct JDBC sequence is: 1) Load the JDBC driver, 2) Create connection, 3) Create statement, 4) Execute query, 5) Process results, 6) Close resources.
Which interface in JDBC is used to execute SQL queries and obtain results?
AStatement
BConnection
CResultSet
DDriver
Correct Answer:
A. Statement
EXPLANATION
Statement interface is used to execute SQL queries. Connection is used to establish database connection, ResultSet holds query results, and Driver manages database connections.