Java JDBC MCQs
This section focuses on the "Java JDBC" in Java programming. These Multiple Choice Questions (MCQs) should be practiced to improve the Java programming skills required for various interviews (campus interview, walk-in interview, company interview), placements, entrance exams and other competitive examinations.
1. JDBC stands for?
A. Java Database Connect
B. Java Data Connectivity
C. Java Database Connectivity
D. Java Data Connect
View Answer
Ans : C
Explanation: JDBC Stands for Java Database Connectivity.
2. Which of the following is not a Components of JDBC ?
A. JDBC API
B. JDBC Test suite
C. JDBC-ODBC Bridge Drivers
D. JDBC Call
View Answer
Ans : D
Explanation: JDBC Call is not a Components of JDBC.
3. Which of the following is used to test the operation?
A. JDBC API
B. JDBC Driver manager
C. JDBC Test suite
D. JDBC-ODBC Bridge Drivers
View Answer
Ans : C
Explanation: JDBC Test suite: It is used to test the operation(such as insertion, deletion, updation) being performed by JDBC Drivers.
4. How many types of JDBC drivers there?
A. 3
B. 4
C. 5
D. 6
View Answer
Ans : B
Explanation: There are 4 types of JDBC drivers: Type-1 driver or JDBC-ODBC bridge driver, Type-2 driver or Native-API driver, Type-3 driver or Network Protocol driver, Type-4 driver or Thin driver
5. The JDBC architecture consists of _____________ to access a database.
A. three-tier processing models
B. two-tier processing models
C. two-tier and three-tier processing models
D. None of the above
View Answer
Ans : C
Explanation: The JDBC architecture consists of two-tier and three-tier processing models to access a database.
6. Java Database Connectivity is a Java API to connect and execute the query with the database.
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
View Answer
Ans : A
Explanation: True, Java Database Connectivity is a Java API to connect and execute the query with the database.
7. Which package in Java contains the JDBC classes?
A. java.db
B. java.sql
C. java.jdbc
D. java.connection
View Answer
Ans : B
Explanation: java.sql package in Java contains the JDBC classes
8. Which class is used to load the JDBC driver?
A. java.sql.Connection
B. java.sql.ResultSet
C. java.sql.Statement
D. java.sql.DriverManager
View Answer
Ans : D
Explanation: java.sql.DriverManager class is used to load the JDBC driver.
9. Which interface is used to execute SQL statements in Java?
A. java.sql.Statement
B. java.sql.Connection
C. java.sql.ResultSet
D. java.sql.PreparedStatement
View Answer
Ans : A
Explanation: java.sql.Statement interface is used to execute SQL statements in Java
10. JDBC Driver manager loads a database-specific driver in an application to establish a connection with a database.
A. Yes
B. No
C. Can be yes or no
D. Can not say
View Answer
Ans : A
Explanation: Yes, JDBC Driver manager loads a database-specific driver in an application to establish a connection with a database.
Discussion