0% found this document useful (0 votes)
41 views6 pages

05 - BTJB - Quiz4 - Database Programming With JDBC: Tests & Quizzes

This document contains a quiz on database programming concepts in Java using JDBC. The quiz has 20 multiple choice questions covering topics like the different JDBC driver types, executing queries with Statement and PreparedStatement, and updating and manipulating data using ResultSets.

Uploaded by

John Trần
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views6 pages

05 - BTJB - Quiz4 - Database Programming With JDBC: Tests & Quizzes

This document contains a quiz on database programming concepts in Java using JDBC. The quiz has 20 multiple choice questions covering topics like the different JDBC driver types, executing queries with Statement and PreparedStatement, and updating and manipulating data using ResultSets.

Uploaded by

John Trần
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

HCM21_CPL_JAVA_06    Tests & Quizzes

Tests & Quizzes

05_BTJB_Quiz4_Database Programming with JDBC


Return to Assessment List

Part 1 of 1 - 70.0/ 100.0 Points

Question 1 of 20
Which of following interface isn’t used by JDBC 0.0/ 5.0 Points

A. [Link]

B. [Link]

C. [Link]

D. [Link]

Question 2 of 20
Which of the following is false as far as type 4 driver is concern 5.0/ 5.0 Points

A. Type 4 drivers uses Socket class to connect to the database

B. Type 4 drivers are 100% Java compatible

C. Type 4 driver is “native protocol, pure java” driver

D. Type 4 drivers cannot be used with Netscape

Question 3 of 20
Package _______ contains classes and interfaces for manipulating relational databases in 5.0/ 5.0 Points
Java. ?

A. [Link]

B. [Link]

C. [Link]

D. [Link]
Question 4 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

Question 5 of 20
Which [Link] class provides the getConnection() method? 0.0/ 5.0 Points

A. ResultSet 71

B. DriverManager

C. Connection

D. Driver

Question 6 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. [Link]

Question 7 of 20
Are ResultSets updateable 5.0/ 5.0 Points

A.
Yes, but only if the ResultSet is an object of class UpdateableResultSet, and if the driver and database
support this option

B.
Yes, but only if you indicate a concurrency strategy when executing the statement, and if the driver and
database support this option
C.
Yes, but only if you call the method openCursor() on the ResultSet, and if the driver and database support
this option

D.
No, ResultSets are never updateable. You must explicitly execute DML statements ([Link], delete and
update) to change the data in the underlying database.

Question 8 of 20
Which driver is called as thin-driver in JDBC 5.0/ 5.0 Points

A. Type-4 driver

B. Type-1 driver

C. Type-2 driver

D. Type-3 driver

Question 9 of 20
The result set retrieved by the following SELECT statement contains records that have 5.0/ 5.0 Points

SELECT Balance, Num


FROM Accounts
WHERE Balance < 0
?

A. two fields from the Accounts table where Balance is less than 0

B. two fields from the Balance table where Account Num is less than 0

C. one field from the Balance table where Account Num is less than 0

D. all fields from the Accounts table where Balance is less than 0

Question 10 of 20
Which type of Statement can execute parameterized queries 0.0/ 5.0 Points

A. ParameterizedStatement

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

C. PreparedStatement
D. ParameterizedStatement and CallableStatement

Question 11 of 20
Which interface of the JDBC API executes pre-compiled SQL statements? 5.0/ 5.0 Points

A. Resultset

B. Statement

C. PreparedStatement

Question 12 of 20
When you code an inner join in a SELECT statement you do not need to specify ? 5.0/ 5.0 Points

A. a join column for the first table

B. a join column for the second table

C. an ORDER BY clause

D. the name of the second table

Question 13 of 20
How is the forName() method of the "Class" class used with JDBC? 5.0/ 5.0 Points

A. To establish a database connection

B. To load a result set

C. To load a JDBC driver

D. To execute a SQL statementresses

Question 14 of 20
A JDBC application does the follwing in what order of steps? 5.0/ 5.0 Points
1) Connects to a JDBC data source.
2) Parses the results of the query.
3) Executes a query.
4) closes the connection after the database operation. ?

A. 1-3-2-4

B. 2-3-4-1
C. 4-3-2-1

D. 1-2-3-4

Question 15 of 20
Which of these operations are provided by DML Data Manipulation Language? ? 5.0/ 5.0 Points

A. Inserting data and updating data

B. Creating & deleting a table

C. Creating table

D. Encoding the data

Question 16 of 20
Which statements about JDBC are true (2 correct answers) 0.0/ 5.0 Points

A. JDBC is an API to bridge the object-relational mismatch between OO programs and relational databases

B. JDBC is an API to connect to relational-, object- and XML data sources

C. JDBC is an API to access relational databases, spreadsheets and flat files

D. JDBC stands for Java DataBase Connectivity

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
A __________ result set has a cursor that moves both forward and backward and can be 5.0/ 5.0 Points
moved to a particular row

A. nonscrollable

B. Unscrollable

C. scrollable
Question 19 of 20
Which of arguments are used by [Link](…) (2 correct answers) 0.0/ 5.0 Points

A. url: Database url where stored or created your database

B. userName: User name

C. portNumber: the port number

D. databaseName: The database name

Question 20 of 20
What statements are correct about positioned updates (i.e. cursor updates) in ResultSets 0.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.

Gateway
Accessibility Information
The Sakai Project

Powered by Sakai
Copyright 2017 FPT-Software

You might also like