1. Which of the following has both date and time?
a) java.io.date
b) java.sql.date
c) java.util.date
d) java.util.dateTime
Answer: D
Explanation: java.util.date contains both date and time. Whereas, java.sql.date contains only the date.

2. Which of the following is an advantage in using the JDBC connection pool?
a) slow performance
b) Using more memory
c) Using less memory
D) improved performance
Answer: D
Explanation: Since the JDBC connection takes time to establish. Creating a connection at application start-up and reusing when needed helps in application performance.

3. Which of the following is an advantage in using readjustment in Java?
a) slow performance
b) Encourages SQL injection
c) Prevents SQL injection
D) more memory usage
Answer: C
Explanation: Readjustment in Java improves performance and also prevents SQL injection.

4. Which of the following contains date information?
a) java.sql.TimeStamp
b) java.sql.Time
c) java.io.Time
d) java.io.TimeStamp
Answer: A
Explanation: java.sql.Time only contains time. Whereas, java.sql.TimeStamp contains both time and date.

5. What does setAutocommit (false) do?
a) Deals after every question
B) explicitly transacts
C) does not automatically transact after every query
d) never does transaction
Answer: C
Explanation: setAutoCommit (false) does not automatically transact after every query. This saves a lot of execution time and therefore improves performance.

6. Which of the following is used to call stored procedure?
a statement
B) prepared
c) CallableStatment
d) colostment
Answer: C
Explanation: CallableStatement is used in JDBC to call a stored procedure from a Java program.

7. Which of the following lines is used to return a number?
A) setmaxrose (int i)
B) setminrose (int i)
C) Getmax (Inti)
d) getMinRows (int i)
Answer: A
Explanation: The setMaxRows (int i) method is used to limit the number of rows that a database query returns from.

8. Which of the following methods of JDBC batch process?
a) setbatch ()
B) remove ()
C) remove ()
D) AddBatch ()
Answer: D
Explanation: addBatch () is a method of JDBC batch processing. It is faster in processing than executing one statement at a time.

9. Which of the following is used to rollback JDBC transactions?
A) Rollback ()
B) rollword ()
C) delete
Answer: A
Explanation: The rollback () method is used to rollback a transaction. This will rollback all changes made by the transaction.

10. Which of the following is not a JDBC connection isolation level?
a) TRANSACTION_NONE
b) TRANSACTION_READ_COMMITTED
c) TRANSACTION_REPEATABLE_READ
d) TRANSACTION_NONREPEATABLE_READ
Answer: D
Explanation: TRANSACTION_NONREPEATABLE_READ is not a JDBC connection isolation level.
Previous Post Next Post