Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

JDBC Quiz

Total questions: 18

Worksheet time: 14mins

Name
Class
Date
1.

What does JDBC stand for?

a)

Java Database Connectivity

b)

Java Data Base Connection

c)

Java Database Connection

d)

Java Data Connectivity

2.

Loại driver JDBC nào bị khuyến cáo không nên sử dụng do driver mỏng?

a)

Driver gốc

b)

Driver giao thức mạng

c)

JDBC-ODBC Bridge

d)

Driver mỏng

3.

Phương pháp nào được sử dụng để thiết lập kết nối cơ sở dữ liệu trong JDBC?

a)

Statement.executeQuery()

b)

Connection.createStatement()

c)

ResultSet.next()

d)

DriverManager.getConnection()

4.

Which of the following is NOT a method of the Connection interface?

a)

prepareStatement()

b)

createStatement()

c)

executeQuery()

d)

setAutoCommit()

5.

What is the default auto-commit mode of a Connection object?

a)

Not defined

b)

Depends on the driver

c)

True

d)

False

6.

Phương pháp nào được sử dụng để thực thi một lô lệnh trong JDBC?

a)

executeUpdate()

b)

addBatch()

c)

executeQuery()

d)

executeBatch()

7.

Mục đích của PreparedStatement là gì?

a)

Quản lý giao dịch

b)

Chỉ thực thi SQL tĩnh

c)

Thực thi các truy vấn có tham số

d)

Tạo một cơ sở dữ liệu mới

8.

Which of the following is a valid JDBC driver type?

a)

Network Protocol Driver

b)

JDBC-ODBC Bridge

c)

Native API Driver

d)

All of the above

9.

What does the ResultSet interface represent?

a)

A statement to execute SQL

b)

The result set of a database query

c)

A connection to the database

d)

A driver for the database

10.

Phương pháp nào được sử dụng để đăng ký một driver với DriverManager?

a)

registerDriver()

b)

createStatement()

c)

deregisterDriver()

d)

getConnection()

11.

What is the purpose of the rollback() method?

a)

To close the connection

b)

To execute a query

c)

To cancel the transaction

d)

To commit the transaction

12.

Which of the following is a feature of CallableStatement?

a)

It can execute SQL queries only

b)

It can call stored procedures

c)

It is slower than PreparedStatement

d)

It cannot accept parameters

13.

Phương thức commit() trong JDBC làm gì?

a)

Nó hủy bỏ giao dịch hiện tại

b)

Nó truy xuất dữ liệu từ cơ sở dữ liệu

c)

Nó đóng kết nối cơ sở dữ liệu

d)

Nó lưu tất cả các thay đổi đã thực hiện trong giao dịch hiện tại

14.

Loại nào sau đây KHÔNG phải là một loại ResultSet?

a)

TYPE_SCROLL_SENSITIVE

b)

TYPE_SCROLL_INSENSITIVE

c)

TYPE_FORWARD_ONLY

d)

TYPE_READ_ONLY

15.

Which class or interface contains the transaction control methods setAutoCommit, commit, and rollback?

a)

Connection

b)

ResultSet

c)

Statement

d)

PreparedStatement

16.

Nếu một người có ý định làm việc với ResultSet, phương thức preparedStatement nào dưới đây sẽ không hoạt động?

a)

executeUpdate()

b)

execute()

c)

executeQuery()

17.

Mục đích chính của lớp DriverManager trong JDBC là gì?

a)

Để tạo các đối tượng ResultSet

b)

Để quản lý các kết nối cơ sở dữ liệu

c)

Để thực thi các câu lệnh SQL

d)

Để xử lý giao dịch

18.

What does the setAutoCommit(false) method do in JDBC?

a)

It enables auto-commit mode

b)

It disables auto-commit mode

c)

It rolls back the current transaction

d)

It commits the current transaction