- JDBC Tutorial
- JDBC - Home
- JDBC - Introduction
- JDBC - SQL Syntax
- JDBC - Environment
- JDBC - Sample Code
- JDBC - Driver Types
- JDBC - Connections
- JDBC - Statements
- JDBC - Result Sets
- JDBC - Data Types
- JDBC - Transactions
- JDBC - Exceptions
- JDBC - Batch Processing
- JDBC - Stored Procedure
- JDBC - Streaming Data
- JDBC Examples
- JDBC - Create Database
- JDBC - Select Database
- JDBC - Drop Database
- JDBC - Create Tables
- JDBC - Drop Tables
- JDBC - Insert Records
- JDBC - Select Records
- JDBC - Update Records
- JDBC - Delete Records
- JDBC - WHERE Clause
- JDBC - Like Clause
- JDBC - Sorting Data
- JDBC Useful Resources
- JDBC - Questions and Answers
- JDBC - Quick Guide
- JDBC - Useful Resources
- JDBC - Discussion
- Useful - Java Tutorials
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
JDBC - Mock Test
This section presents you various set of Mock Tests related to JDBC Framework. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
JDBC Mock Test I
Q 1 - What JDBC stands for?
A - Java Database Connectivity
B - Java Driver for Basic Connection
Answer : A
Explanation
JDBC stands for Java Database Connectivity.
Q 2 - What is JDBC?
A - JDBC is a java based protocol.
C - JDBC is a specification to tell how to connect to a database.
Answer : B
Explanation
JDBC is a standard Java API for database-independent connectivity between the Java programming language and a wide range of databases.
Q 3 - Which of the following is true about JDBC architecture?
A - JDBC API layer provides the application-to-JDBC Manager connection.
B - JDBC Driver API layer supports the JDBC Manager-to-Driver Connection.
Answer : C
Explanation
General JDBC Architecture consists of two layers: JDBC API (This provides the application-to-JDBC Manager connection) and JDBC Driver API (This supports the JDBC Manager-to-Driver Connection).
Q 4 - Which of the following is not a component/class of JDBC API?
Answer : D
Explanation
Transaction is not a class of JDBC API. JDBC API consists of following interfaces and classes: DriverManager, Driver, Connection, Statement, ResultSet, SQLException.
Q 5 - Which of the following is not a component/class of JDBC API?
Answer : D
Explanation
ConnectionPool is not a class of JDBC API. JDBC API consists of following interfaces and classes: DriverManager, Driver, Connection, Statement, ResultSet, SQLException.
Q 6 - Which of the following is correct about DriverManager class of JDBC?
A - JDBC DriverManager is a class that manages a list of database drivers.
Answer : C
Explanation
JDBC DriverManager is a class that manages a list of database drivers. It matches connection requests from the java application with the proper database driver using communication subprotocol.
Q 7 - Which of the following is correct about driver interface of JDBC?
A - JDBC driver is an interface enabling a Java application to interact with a database.
Answer : C
Explanation
JDBC driver is an interface enabling a Java application to interact with a database. To connect with individual databases, JDBC requires drivers for each database. The JDBC driver gives out the connection to the database and implements the protocol for transferring the query and result between client and database.
Q 8 - Which of the following is correct about Connection interface of JDBC?
A - Connection interface consists of methods for contacting a database.
Answer : C
Explanation
Connection interface consists of methods for contacting a database. The connection object represents communication context.
Q 9 - Which of the following is correct about Statement class of JDBC?
Answer : C
Explanation
Statement encapsulates an SQL statement which is passed to the database to be parsed, compiled, planned and executed.
Q 10 - Which of the following is correct about ResultSet class of JDBC?
B - It acts as an iterator to allow you to move through its data.
C - The java.sql.ResultSet interface represents the result set of a database query.
Answer : D
Explanation
ResultSet objects hold data retrieved from a database after you execute an SQL query using Statement objects. It acts as an iterator to allow you to move through its data. The java.sql.ResultSet interface represents the result set of a database query.
Q 11 - Which of the following manages a list of database drivers in JDBC?
Answer : A
Explanation
DriverManager class manages a list of database drivers in JDBC.
Q 12 - Which of the following gives out the connection to the database and implements the protocol for transferring the query and result between client and database?
Answer : B
Explanation
JDBC driver gives out the connection to the database and implements the protocol for transferring the query and result between client and database.
Q 13 - Which of the following consists of methods for contacting a database?
Answer : C
Explanation
Connection consists of methods for contacting a database.
Q 14 - Which of the following encapsulates an SQL statement which is passed to the database to be parsed, compiled, planned and executed?
Answer : D
Explanation
Statement encapsulates an SQL statement which is passed to the database to be parsed, compiled, planned and executed.
Q 15 - Which of the following holds data retrieved from a database after you execute an SQL query using Statement objects?
Answer : A
Explanation
ResultSet holds data retrieved from a database after you execute an SQL query using Statement objects.
Q 16 - Which of the following is not a valid type of ResultSet?
A - ResultSet.TYPE_FORWARD_ONLY
B - ResultSet.TYPE_SCROLL_INSENSITIVE
Answer : D
Explanation
ResultSet.TYPE_BACKWARD_ONLY is not a valid type of ResultSet.
Q 17 - In which of the following type of ResultSet, the cursor can only move forward in the result set?
A - ResultSet.TYPE_FORWARD_ONLY
B - ResultSet.TYPE_SCROLL_INSENSITIVE
Answer : A
Explanation
ResultSet.TYPE_FORWARD_ONLY: The cursor can only move forward in the result set.
Q 18 - In which of the following type of ResultSet, the cursor can scroll forwards and backwards, and the result set is not sensitive to changes made by others to the database that occur after the result set was created.?
A - ResultSet.TYPE_FORWARD_ONLY
B - ResultSet.TYPE_SCROLL_INSENSITIVE
Answer : B
Explanation
ResultSet.TYPE_SCROLL_INSENSITIVE: The cursor can scroll forwards and backwards, and the result set is not sensitive to changes made by others to the database that occur after the result set was created.
Q 19 - In which of the following type of ResultSet, the cursor can scroll forwards and backwards, and the result set is sensitive to changes made by others to the database that occur after the result set was created?
A - ResultSet.TYPE_FORWARD_ONLY
B - ResultSet.TYPE_SCROLL_INSENSITIVE
Answer : C
Explanation
ResultSet.TYPE_SCROLL_SENSITIVE: The cursor can scroll forwards and backwards, and the result set is sensitive to changes made by others to the database that occur after the result set was created.
Q 20 - Which of the following type of JDBC driver, calls native code of the locally available ODBC driver?
A - JDBC-ODBC Bridge plus ODBC driver
B - Native-API, partly Java driver
Answer : A
Explanation
JDBC-ODBC Bridge plus ODBC driver calls native code of the locally available ODBC driver.
Q 21 - Which of the following type of JDBC driver, calls database vendor native library on a client side. This code then talks to database over network?
A - JDBC-ODBC Bridge plus ODBC driver
B - Native-API, partly Java driver
Answer : B
Explanation
Native-API, partly Java driver calls database vendor native library on a client side. This code then talks to database over network.
Q 22 - Which of the following type of JDBC driver, talks with the server-side middleware that then talks to database?
A - JDBC-ODBC Bridge plus ODBC driver
B - Native-API, partly Java driver
Answer : C
Explanation
JDBC-Net, pure Java driver, partly Java driver talks with the server-side middleware that then talks to database.
Q 23 - Which of the following type of JDBC driver, uses database native protocol?
A - JDBC-ODBC Bridge plus ODBC driver
B - Native-API, partly Java driver
Answer : D
Explanation
Native-protocol, pure Java driver, uses database native protocol.
Q 24 - Which of the following type of JDBC driver, is also called Type 1 JDBC driver?
A - JDBC-ODBC Bridge plus ODBC driver
B - Native-API, partly Java driver
Answer : A
Explanation
JDBC-ODBC Bridge plus ODBC driver, is also called Type 1 JDBC driver.
Q 25 - Which of the following type of JDBC driver, is also called Type 2 JDBC driver?
A - JDBC-ODBC Bridge plus ODBC driver
B - Native-API, partly Java driver
Answer : B
Explanation
Native-API, partly Java driver, is also called Type2 JDBC driver.
Answer Sheet
Question Number | Answer Key |
---|---|
1 | A |
2 | B |
3 | C |
4 | D |
5 | D |
6 | C |
7 | C |
8 | C |
9 | C |
10 | D |
11 | A |
12 | B |
13 | C |
14 | D |
15 | A |
16 | D |
17 | A |
18 | B |
19 | C |
20 | A |
21 | B |
22 | C |
23 | D |
24 | A |
25 | B |