You are on page 1of 6

HCM21_CPL_JAVA_06    Tests & Quizzes

Tests & Quizzes

05_BTJB_Quiz4_Database Programming with JDBC


Return to Assessment List

Part 1 of 1 - 73.33/ 100.0 Points

Question 1 of 20
A ________ object is used to submit a query to a database. ? 5.0/ 5.0 Points

A. dataset

B. Statement.

C. Connection.

D. java.sql

Question 2 of 20
What statements are correct about batched insert and updates? (2 correct answers) 0.0/ 5.0 Points

A. To execute a batched update/insert, you call the executeBatch() method on a Statement object

B. To create a batch of insert and update statements, you create an object of type Batch, and call the
method addStatement(String statement) for each statement you want to execute in the batch

C. To do a batched update/insert, you call addBatch(String statement) on a Statement object for each
statement you want to execute in the batch

D. Batch insert and updates are only possible when making use of parameterized queries.

Question 3 of 20
Which of the following methods are needed for loading a database driver in JDBC 5.0/ 5.0 Points

A. registerDriver() method

B. getConnection()

C. Class.forName()

D. Both A and B
Question 4 of 20
The JDBC-ODBC bridge is 5.0/ 5.0 Points

A. Three tiered

B. Multithreaded

C. Best for any platform

D. All of the above

Question 5 of 20
Which java.sql class provides the getConnection() method? 5.0/ 5.0 Points

A. ResultSet 71

B. DriverManager

C. Connection

D. Driver

Question 6 of 20
What is the meaning of the transaction isolation level TRANSACTION_REPEATABLE_READ 0.0/ 5.0 Points

A. Dirty reads are prevented; non-repeatable reads and phantom reads can occur

B. Dirty reads, non-repeatable reads and phantom reads are prevented

C. Dirty reads, non-repeatable reads and phantom reads can occur

D. Dirty reads and non-repeatable reads are prevented; phantom reads can occur

Question 7 of 20
Which driver is efficient and always preferable for using JDBC applications 5.0/ 5.0 Points

A. Type – 1

B. Type – 4

C. Type – 2

D. Type – 3
Question 8 of 20
What statements are correct about JDBC transactions (2 correct answers)? 0.0/ 5.0 Points

A. A transaction is a set of successfully executed statements in the database

B. A transaction is finished when close() is called on the Connection object

C. A transaction is finished when commit() or rollback() is called on the Transaction object

D. A transaction is finished when commit() or rollback() is called on the Connection object,

Question 9 of 20
The different types of JDBC driver are 3.33/ 5.0 Points

A. Jdbc-odbc bridge, plus odbc driver

B. Jdbc-net, pure Java driver

C. Native-API, partly Java driver

D. Native-API, pure Java driver

Question 10 of 20
Which of the following methods finds the maximum number of connections that a specific driver 5.0/ 5.0 Points
can obtain

A. ResultSetMetaData.getMaxConnections

B. DatabaseMetaData.getMaxConnections

C. Connection.getMaxConnections

D. Database.getMaxConnections

Question 11 of 20
A JDBC application does the following in what order of steps? 5.0/ 5.0 Points
i) Connects to a JDBC data source
ii) Parses the results of the query
iii)Executes a query
iv) closes the connection after the database operation

A. i-ii-iii-iv

B. iv-iii-ii-i

C. ii-iii-iv-i

D. i-iii-ii-iv
Question 12 of 20
The column index of ResultSet object is numbered from _________ 5.0/ 5.0 Points

A. No

B. Yes

Question 13 of 20
You need a ____ to access a database from a Java program. ? 5.0/ 5.0 Points

A. Servlet

B. Connection

C. ResultSet

D. JDBC

Question 14 of 20
The methods of what type of object can be used to move the cursor through a result set? ? 0.0/ 5.0 Points

A. Connection

B. URL

C. ResultSet

D. Statement

Question 15 of 20
After a SELECT statement, a _________ is a logical table that's created temporarily within the 0.0/ 5.0 Points
database. ?

A. recordset

B. result set

C. datareader

D. dataset

Question 16 of 20
Conn = Driver Manager.getConnection(“jdbc:odbc:Employee”,“”,“”); 5.0/ 5.0 Points
What does the above statement do?

A. Gets a database connection with the Employee data source.

B. Inidicates that jdbc is to be used in the application.

C. Gets connectioned to the employee database.

D. Retrieves data from the employee table.

Question 17 of 20
What is type-1 of JDBC drivers 5.0/ 5.0 Points

A. All Java/Native-protocol driver (Pure)

B. All Java/Net-protocol driver (Middleware)

C. JDBC-ODBC Bridge driver (Bridge)

D. Native-API/partly Java driver (Native)

Question 18 of 20
How can you start a database transaction in the database 5.0/ 5.0 Points

A.
By setting the autoCommit property of the Connection to false, and execute a statement in the database

B. By asking a Transaction object to your Connection, and calling the method begin() on it

C.
By asking a Transaction object to your Connection, and setting the autoCommit property of the
Transaction to false

D. By calling the method beginTransaction() on the Connection object

Question 19 of 20
What statements are correct about positioned updates (i.e. cursor updates) in ResultSets 5.0/ 5.0 Points

A. Insert statements are only supported when using scrollable cursors.

B. Only scrollable updateable ResultSets can use this approach to change the data in the current row of a
ResultSet
C. Using the cursor technique is currently the only possible way to change the data in the current row of a
ResultSet

D. The name of the cursor is specified by the setCursorName(String name) method the Statement object.

Question 20 of 20
What is, in terms of JDBC, a DataSource 5.0/ 5.0 Points

A. A DataSource is the Java representation of a physical data source

B. A DataSource is a registry point for JNDI-services

C. A DataSource is the basic service for managing a set of JDBC drivers

D. A DataSource is a factory of connections to a physical data source

Gateway
Accessibility Information
The Sakai Project

Powered by Sakai
Copyright 2017 FPT-Software

You might also like