JDBC Test Quiz FPT
JDBC Test Quiz FPT
JDBC Test Quiz FPT
A. Statement
B. Connection
C. DirectManager
D. Driver
Question 2 of 20
5.0/ 5.0 Points
Which java.sql class provides the getConnection() method?
A. ResultSet 71
B. Connection
C. DriverManager
D. Driver
Question 3 of 20
5.0/ 5.0 Points
Which java.sql class or interface is used to create the object that is necessary for calling stored procedures?
A. CallableStatement
B. Statement
C. ResultSet
D. PreparedStatement
Question 4 of 20
5.0/ 5.0 Points
If one intends to work with a ResultSet, which of these PreparedStatement methods will not work?
A. executeUpdate()
B. executeQuery()
C. execute()
Question 5 of 20
5.0/ 5.0 Points
What is, in terms of JDBC, a DataSource
Question 6 of 20
0.0/ 5.0 Points
The methods of what type of object can be used to move the cursor through a result set? ?
A. Statement
B. URL
C. Connection
D. ResultSet
Question 7 of 20
0.0/ 5.0 Points
Which of the following describes a JDBC type 4 driver?
Question 8 of 20
5.0/ 5.0 Points
Are prepared statements actually compiled
Question 9 of 20
5.0/ 5.0 Points
What is correct about DDL statements (create, grant,...)
A. DDL statements are treated as normal SQL statements, and are executed by calling the
B. DDL statements cannot be executed by making use of JDBC, you should use the native
Question 10 of 20
5.0/ 5.0 Points
A method that takes a Student object and writes it to the Student table in a database implements
___________. ?
A. ResultSetMetaData
B. connection pooling
D. init, destroy
Question 11 of 20
5.0/ 5.0 Points
What is the meaning of ResultSet.TYPE_SCROLL_INSENSITIVE
A. This means that the ResultSet is sensitive to scrolling, but insensitive to changes made
by others
B. This means that the Resultset is sensitive to scrolling, but insensitive to updates, i.e. not
updateable
C. The meaning depends on the type of data source, and the type and version of the driver
Question 12 of 20
0.0/ 5.0 Points
Which of following is wrong about CallableStatement
Connection.createCallableStatement() method.
method.
C. This interface is used to execute SQL stored procedures.
Question 13 of 20
5.0/ 5.0 Points
Are ResultSets updateable
A. Yes, but only if you indicate a concurrency strategy when executing the statement, and
B. Yes, but only if you call the method openCursor() on the ResultSet, and if the driver and
C. No, ResultSets are never updateable. You must explicitly execute DML statements
(i.e.insert, delete and update) to change the data in the underlying database.
D. Yes, but only if the ResultSet is an object of class UpdateableResultSet, and if the driver
Question 14 of 20
5.0/ 5.0 Points
What statements are correct about positioned updates (i.e. cursor updates) in ResultSets
A.Only scrollable updateable ResultSets can use this approach to change the data in the
B.The name of the cursor is specified by the setCursorName(String name) method the
Statement object.
C.Using the cursor technique is currently the only possible way to change the data in the
Question 15 of 20
0.0/ 5.0 Points
When the message “No Suitable Driver” occurs
B. When the user name, password and the database does not match
Question 16 of 20
5.0/ 5.0 Points
How is the forName() method of the "Class" class used with JDBC?
Question 17 of 20
5.0/ 5.0 Points
How can you execute DML statements (i.e. insert, delete, update) in the database
A. I_G_C_J_A_B_E_K_H_D_F
B. G_I_C_J_A_B_K_E_D_H_F
C. G_I_C_J_A_B_K_E_H_D_F
D. I_G_C_J_A_B_K_E_H_D_F
Question 19 of 20
5.0/ 5.0 Points
Which of the following statements will delete all records from the Invoices table that have a value of 0 in the
InvoiceTotal field?
A. statement.deleteRows(query);
B. statement.delete(query);
C. statement.executeQuery(query);
D. statement.executeUpdate(query);
Question 20 of 20
5.0/ 5.0 Points
Which driver is called as thin-driver in JDBC
A. Type-3 driver
B. Type-2 driver
C. Type-4 driver
D. Type-1 driver
A. Resultset
B. Statement
C. PreparedStatement
A. Connection
B. Driver
C. DriverManager
D. ResultSet
How is the forName() method of the "Class" class used with JDBC?
A. java.sql
B. Connection.
C. dataset
D. Statement.
_______ helps manage the connection between the Java program and the database. ?
A. ResultSet
B. Statement.
C. Connection.
D. java.sql
What statements are correct about batched insert and updates? (2 correct answers)
Statement object for each statement you want to execute in the batch
B.Batch insert and updates are only possible when making use of
parameterized queries.
Statement object
D.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
UpdateStatement classes
DataModificationStatement object
A. Yes, but only if you indicate a concurrency strategy when executing the
B. Yes, but only if you call the method openCursor() on the ResultSet, and if the
C. No, ResultSets are never updateable. You must explicitly execute DML
statements (i.e.insert, delete and update) to change the data in the underlying
database.
When you code an inner join in a SELECT statement you do not need to specify ?
A. an ORDER BY clause
A. ParameterizedStatement
B. ParameterizedStatement and CallableStatement
C. PreparedStatement
After a SELECT statement, a _________ is a logical table that's created temporarily within the database. ?
A. recordset
B. dataset
C. result set
D. datareader
The result set retrieved by the following SELECT statement contains records that have
A. two fields from the Balance table where Account Num is less than 0
B. one field from the Balance table where Account Num is less than 0
C. two fields from the Accounts table where Balance is less than 0
D. all fields from the Accounts table where Balance is less than 0
If one intends to work with a ResultSet, which of these PreparedStatement methods will not work?
A. executeUpdate()
B. executeQuery()
C. execute()
Connection.createCallableStatement() method.
Connection.prepareCall() method.
A. You will get a SQLException, because only Statement objects can close
ResultSets
B. The ResultSet, together with the Statement which created it and the
Connection from which the Statement was retrieved, will be closed and release all
database and JDBC resources
C. The method close() does not exist for a ResultSet. Only Connections can be
closed.
A. Type-3 driver
B. Type-2 driver
C. Type-4 driver
D. Type-1 driver
A. Dirty reads are prevented; non-repeatable reads and phantom reads can
occur
C. Dirty reads and non-repeatable reads are prevented; phantom reads can
occur
What statements are correct about batched insert and updates? (2 correct
answers)
Statement object for each statement you want to execute in the batch
B.Batch insert and updates are only possible when making use of
parameterized queries.
Statement object
D.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
A. CallableStatement
B. Statement
C. ResultSet
D. PreparedStatement
A. 5
B. 4
C. 2
D. 3
Question 4 of 20 5.0/ 5.0 Points
A method that takes a Student object and writes it to the Student table in a
database implements ___________. ?
A. ResultSetMetaData
B. connection pooling
D. init, destroy
What statements are correct about positioned updates (i.e. cursor updates) in
ResultSets
A.Only scrollable updateable ResultSets can use this approach to change the
A. ResultSet
B. JDBC
C. Command
D. Connection
A. No
B. Yes
Connection object,
Transaction object
A. an INSERT statement
B. a configuration file
C. a SQL script
D. a LOAD command
How do you know in your Java program that a SQL warning is generated as a result
of executing a SQL statement in the database
A. You must catch the checked SQLException which is thrown by the method
the database
C. You must invoke the getWarnings() method on the Statement object (or a
jdbc.drivers = sun.jdbc.odbc.JdbcOdbcDriver
C. 1 is true, 2 is false.
D. 1 is false, 2 is true.
Question 13 of 20 5.0/ 5.0 Points
Which of the following methods finds the maximum number of connections that a
specific driver can obtain
A. DatabaseMetaData.getMaxConnections
B. Database.getMaxConnections
C. Connection.getMaxConnections
D. ResultSetMetaData.getMaxConnections
A. Type-3 driver
B. Type-2 driver
C. Type-4 driver
D. Type-1 driver
A. Result sets
D. SQL statements
How can you execute DML statements (i.e. insert, delete, update) in the database
UpdateStatement classes
DataModificationStatement object
C. The meaning depends on the type of data source, and the type and version
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. MetaData
C. CallableStatement
D. ResultSetMetaData
When you code an inner join in a SELECT statement you do not need to specify ?
A. an ORDER BY clause
Which driver is efficient and always preferable for using JDBC applications
A. Type – 1
B. Type – 2
C. Type – 4
D. Type – 3
A. Yes
B. No
After a SELECT statement, a _________ is a logical table that's created temporarily within the database. ?
A. result set
B. datareader
C. recordset
D. dataset
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. MetaData
C. CallableStatement
D. ResultSetMetaData
A. executeQuery()
B. executeResult()
C. executeUpdate()
D. execute()
A. The ResultSet, together with the Statement which created it and the
Connection from which the Statement was retrieved, will be closed and release all
database and JDBC resources
B. You will get a SQLException, because only Statement objects can close
ResultSets
D. The method close() does not exist for a ResultSet. Only Connections can be
closed.
A. Type-2 driver
B. Type-3 driver
C. Type-4 driver
D. Type-1 driver
A. The row you are positioned on is deleted from the ResultSet, but not from
the database.
B. The row you are positioned on is deleted from the ResultSet and from the
database
C. You will get a compile error: the method does not exist because you can not
type.
C. By invoking the method get(..., Type type) on the ResultSet, where Type is
D. By invoking the method get(..., String type) on the ResultSet, where type is
A. Yes, but only if you indicate a concurrency strategy when executing the
C. Yes, but only if you call the method openCursor() on the ResultSet, and if the
D. No, ResultSets are never updateable. You must explicitly execute DML
statements (i.e.insert, delete and update) to change the data in the underlying
database.
Question 12 of 20 5.0/ 5.0 Points
To improve the performance of database operations, an application can use _________ where a limited
number of connections are opened and are shared by users of the database. ?
A. ResultSetMetaData
C. init
D. connection pooling
Connection.prepareCall() method.
Connection.createCallableStatement() method.
B. Result sets
C. All of the other answers
D. SQL statements
The methods of what type of object can be used to move the cursor through a result set? ?
A. ResultSet
B. Statement
C. URL
D. Connection
A. Three tiered
B. Multithreaded
C. Best for any platform
A. java.sql.Time
B. java.util.Date
C. java.util.Time
The _______ class is traditional management layer of JDBC, working between the user and the drivers
A. Connection
B. DriverManager
C. Resultset
The ______ interface communicates with the database, either directly or thought
another database specific driver. ?
A. DirectManager
B. Driver
C. Statement
D. Connection
C. Dirty reads are prevented; non-repeatable reads and phantom reads can
occur
D. Dirty reads and non-repeatable reads are prevented; phantom reads can
occur
B. execute()
C. executeUpdate()
C. init
D. connection pooling
How is the forName() method of the "Class" class used with JDBC?
D. When the user name, password and the database does not match
The methods of what type of object can be used to move the cursor through a
result set? ?
A. ResultSet
B. Statement
C. URL
D. Connection
A. ResultSet 71
B. Connection
C. DriverManager
D. Driver
A method that takes a Student object and writes it to the Student table in a
database implements ___________. ?
A. init, destroy
B. OR mapping (object to relational)
C. connection pooling
D. ResultSetMetaData
All raw data types (including binary documents or images) should be read and
uploaded to the database as an array of
A. Boolean
B. int
C. byte
D. Char
B. Prepared Statement
C. Callable Statement
D. Interim Statement
What statements are correct about positioned updates (i.e. cursor updates) in
ResultSets
A.Only scrollable updateable ResultSets can use this approach to change the
B.Using the cursor technique is currently the only possible way to change the
What a correct ordering of steps should be to updating the Orders and the
Customers tables, all within the same transaction:
A. Commit
B. Close S1
C. execute S1
D. Create a statement S1 to update Orders
E. Create a statement S2 to update Customers
F. execute S2
G. Close connection
H. Close S2
I. Open connection to the database
J. Set auto commit to false
K. Set auto commit to true
A. I_D_E_C_J_F_A_B_H_K_G
B. I_D_E_J_C_F_A_B_H_K_G
C. I_E_D_J_C_F_A_B_H_K_G
D. I_D_E_J_C_F_A_B_H_G_K
D. ParameterizedStatement
Which of the following methods are needed for loading a database driver in JDBC
A. registerDriver() method
B. Both A and B
C. getConnection()
D. Class.forName()
A. SQL script
B. result set
C. connection
D. SQL statement
A. JDBC
B. Connection
C. Command
D. ResultSet