wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

JDBC in java

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

Which of the following is not a valid type of statement in JDBC?

a)

Statement

b)

PreparedStatement

c)

CallableStatement

d)

QueryStatement

2.

Which of the following encapsulates an SQL statement which is passed to the database to be parsed, compiled, planned and executed?

a)

DriverManager

b)

JDBC driver

c)

Connection

d)

Statement

3.

What is true about DriverManager class?

a)

It is class from java.lang package

b)

It is a class from java.sql package

c)

It is a interface from java.sql package

d)

It is a class from java.lang package

4.

What is the return type of executeUpdate() method?

a)

byte

b)

short

c)

int

d)

long

5.

In Type 2 Driver, JDBC API calls are converted into native _____________ API calls, which are unique to the database

a)

C/C++

b)

Java

c)

JavaScript

d)

Visual Programming

6.

The third step involved in JDBC application is ____________

a)

Execute Query

b)

Establish Connection

c)

importing packages

d)

Register the Driver

7.

___________ interface with all methods for contacting a database.

a)

ResultSet

b)

Statement

c)

Connection

d)

Driver

8.

_____________ interface handles the communications with the database server

a)

DriverManager

b)

Driver

c)

Statement

d)

None of these

9.

Which of the following tasks are associated with JDBC library?

a)

Making a connection to a database.

b)

Creating SQL or MySQL statements.

c)

Executing SQL or MySQL queries in the database.

d)

All of these

10.

Which method is used to perform DML statements in JDBC?

a)

execute()

b)

executeQuery()

c)

executeUpdate()

d)

executeResult()

11.

Which of the following is used to rollback a JDBC transaction?

a)

rollback()

b)

rollforward()

c)

deleteTransaction()

d)

RemoveTransaction()

12.

Which models do the JDBC API support for the database access?

a)

Two-tier models

b)

Three-tier models

c)

Both A & B

d)

None of the above

13.

ODBC stands for?

a)

Open database connection

b)

Open database concept

c)

Open database communications

d)

None of the above

14.

Which is used to call the stored procedures and functions?

a)

CallableStatement Interface

b)

PreparedStatement Interface

c)

All the above

d)

None of the above

15.

Which method is used to establish the connection with the specified url in a Driver Manager class?

a)

public static void registerDriver(Driver driver)

b)

public static void deregisterDriver(Driver driver)

c)

public static Connection getConnection(String url)

d)

public static Connection getConnection(String url,String userName,String password)

16.

In order to transfer data between a database and an application written in the Java programming language, the JDBC API provides which of these methods?

a)

Methods on the ResultSet class for retrieving SQL SELECT results as Java types.

b)

Methods on the PreparedStatement class for sending Java types as SQL statement parameters.

c)

Methods on the CallableStatement class for retrieving SQL OUT parameters as Java types.

d)

All mentioned above

17.

Which method is used to perform DML statements in JDBC?

a)

execute()

b)

executeQuery()

c)

executeUpdate()

d)

executeResult()

18.

How can you execute a stored procedure in the database?

a)

Call method execute() on a CallableStatement object

b)

Call method executeProcedure() on a Statement object

c)

Call method execute() on a StoredProcedure object

d)

Call method run() on a ProcedureCommand object

19.

Which type of Statement can execute parameterized queries?

a)

PreparedStatement

b)

ParameterizedStatement

c)

ParameterizedStatement and CallableStatement

d)

All kinds of Statements (i.e. which implement a sub interface of Statement)

20.

Which packages contain the JDBC classes?

a)

java.jdbc and javax.jdbc

b)

java.jdbc and java.jdbc.sql

c)

java.sql and javax.sql

d)

java.rdb and javax.rdb