JDBC MCQ Questions And Answers - Java Technologies
JDBC MCQs : This section focuses on "basics" of JDBC. These Multiple Choice Questions (MCQ) should be practiced to improve the JDBC skills required for various interviews (campus interviews, walk-in interviews, company interviews), placements, entrance exams and other competitive examinations.
1. JDBC stands for?
A. Java Database Connect
B. Java Database Connectivity
C. Json Database Connectivity
D. Json Database Connect
View Answer
Ans : B
Explanation: JDBC stands for Java Database Connectivity, which is a standard Java API for database-independent connectivity between the Java programming language and a wide range of databases.
2. The JDBC API supports __________ processing models for database access
A. two-tier
B. three-tier
C. both two-tier and three-tier
D. None of the above
View Answer
Ans : C
Explanation: The JDBC API supports both two-tier and three-tier processing models for database access
3. JDBC Architecture consists of ______ layers.
A. 2
B. 3
C. 4
D. 5
View Answer
Ans : A
Explanation: JDBC Architecture consists of two layers : JDBC API and JDBC Driver API
4. The java.sql and javax.sql are the primary packages for JDBC 4.0.
A. Yes
B. No
C. Can be yes or no
D. Can not say
View Answer
Ans : A
Explanation: Yes, The java.sql and javax.sql are the primary packages for JDBC 4.0.
5. How many types of JDBC drivers?
A. 1
B. 2
C. 3
D. 4
View Answer
Ans : D
Explanation: There are 4 types of JDBC drivers: JDBC-ODBC bridge driver, Native-API driver (partially java driver),Network Protocol driver (fully java driver) and Thin driver (fully java driver).
6. The Connection object is created by using __________ method of DriverManager class. DriverManager is the factory for connection.
A. createConnection()
B. setConnection()
C. getConnection()
D. Connect()
View Answer
Ans : C
Explanation: The Connection object is created by using getConnection() method of DriverManager class. DriverManager is the factory for connection.
7. Which represents a collection of binary data stored as a single entity in the database management system?
A. Clob
B. Blob
C. Glob
D. Dlob
View Answer
Ans : B
Explanation: Blob: Blob stands for the binary large object. It represents a collection of binary data stored as a single entity in the database management system.
8. The ___________ method returns the object of java.lang.Class object.
A. Class.Name()
B. Class.forAttribute()
C. Class.Attributes()
D. Class.forName()
View Answer
Ans : D
Explanation: The Class.forName() method returns the object of java.lang.Class object.
9. _______ method can be used for any SQL statements(Select and Update both).
A. executeQuery
B. executeUpdate
C. execute
D. All of the above
View Answer
Ans : C
Explanation: The execute method can be used for any SQL statements(Select and Update both). The execute method returns a boolean type value where true indicates that the ResultSet s returned which can later be extracted and false indicates that the integer or void value is returned.
10. The Statement object is created by using createStatement() method of Connection class.
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
View Answer
Ans : A
Explanation: True, The Statement object is created by using createStatement() method of Connection class.
Discussion