wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

JDBC_Questions1

Total questions: 18

Worksheet time: 11mins

Name
Class
Date
1.

What JDBC stands for ?

a)

Java Database Connectivity

b)

Java Driver for Basic Connection

c)

Joint Database Connectivity

d)

Joint Driver for Basic Connection

2.

How many Types of JDBC-Drivers available ?

a)

5

b)

4

c)

3

d)

6

3.

Which JDBC Driver Type is the JDBC-ODBC bridge ?

a)

Type-4

b)

Type-3

c)

Type-2

d)

Type-1

4.

Which driver is called as thin-driver in JDBC ?

a)

Type-2

b)

Type-4

c)

Type-3

d)

Type-1

5.

Which driver is callled Native-API driver ?

a)

Type-4

b)

Type-2

c)

Type-3

d)

Type-1

6.

What are the correct sequence of steps to connect any database using JDBC ?

a)

import packages,load or register the driver class,establish connection,create the statement,execute queries,close the connection

b)

establish connection,import packages,load or register the driver class,execute queries,create the statement,close the connection

c)

create the statement,import the packages,establish connection,import packages,load or register the driver class,execute queries,close the connection

d)

establish connection,create the statement,import the packages,import packages,load or register the driver class,execute queries,close the connection

7.

Which of the following method is needed for loading a database driver in JDBC ?

a)

registerDriver() method

b)

Class.forName() method

c)

Both 1 and 2

d)

None of the above

8.

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

9.

------------- method is used to execute any SQL Statement with a SELECT clause, that return the result of the query as a

a)

execute()

b)

executeQuery()

c)

executeUpdate()

d)

executeBatch()

10.

Which method is used to execute INSERT,DELETE,UPDATE and other SQL DDL commands such as CREATE or DROP Table?

a)

execute()

b)

executeQuery()

c)

executeUpdate()

d)

executeBatch()

11.

What is return type of executeUpdate() method ?

a)

int

b)

String

c)

Date

d)

ResultSet

12.

What are the different types of Statements available in JDBC?

a)

Statement

b)

PreparedStatement

c)

CallableStatement

d)

All of the above

13.

Which type of Statement can execute parameterized queries ?

a)

ParameterizedStatement

b)

PreparedStatement

c)

CallableStatement

d)

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

14.

Which method returns ResultSet as output?

a)

execute()

b)

executeQuery()

c)

executeUpdate()

d)

executeBatch()

15.

Which java.sql class or interface contains methods that enable you to find out the number of columns this is returned in a ResultSet and the name or label for a given column?

a)

Statement

b)

CallableStatement

c)

ResultSetMetaData

d)

MetaData

16.

What are the Interfaces available in JDBC?

a)

Connection interface

b)

PreparedStatement interface

c)

ResultSet interface

d)

ResultSet interface

17.

What are the methods in Statement Interface?

a)

public ResultSet executeQuery(String sql): is used to execute SELECT query. It returns the object of ResultSet.

b)

public int executeUpdate(String sql): is used to execute specified query, it may be create, drop, insert, update, delete etc.

c)

public boolean execute(String sql): is used to execute queries that may return multiple results.

d)

public int[] executeBatch(): is used to execute batch of commands.

18.

This method is for retrieving a String Value(SQL type VARCHAR) and assigning to String Object.

a)

getVarchar()

b)

getString()

c)

getObject()

d)

getInt()