Programming Languages Chapter 24 Java programs communicate with databases

subject Type Homework Help
subject Pages 6
subject Words 1360
subject Authors Harvey Deitel, Paul Deitel

Unlock document.

This document is partially blurred.
Unlock all pages and 1 million more documents.
Get Access
page-pf1
Chapter 24 Accessing Databases with JDBC
24.1 Q1: Java programs communicate with databases using what API?
a. DBMS.
b. JDBC.
c. RDBMS.
d. Database.
24.1 Q2: Which of the following is a key benefit of using JDBC?
a. It is a simple-to-use database management system.
b. Allows developers to change the underlying database without modifying the Java code.
c. It is a multi-platform database management system.
d. It provides a GUI for database management systems.
24.2 Q1: A ________ is a column (or set of columns) which have a unique value that cannot be duplicated
in other rows?
a. primary key.
b. query.
c. SQL statement.
24.2 Q2: To obtain data from a table, you ________ the database?
a. select
b. query
c. get
d. None of the above
24.2 Q3: What does a primary key do?
a. Identifies each row of a table.
b. Selects a number of rows from a database.
c. Stores a bunch of related data.
d. None of the above.
24.3 Q1: What is the name of a key in one table that is required to matche a primary key in another table?
a. Foreign key.
b. Matching key.
c. Joined key.
d. Linking key.
24.3 Q2: Which of the following states the Rule of Entity Integrity?
a. Every row must have a value for the primary key and each value must be unique.
b. Every foreign key must appear as another table’s primary key.
page-pf2
c. Every row must have a value for the primary key and values may be repeated.
d. None of the above.
24.3 Q3: What is the relationship between a primary key and its corresponding foreign keys?
a. One-to-one.
b. Many-to-one.
c. Many-to-many.
d. One-to-many.
24.4 Q1: Which SQL keyword is used to merge rows from multiple tables?
a. JOIN.
b. INNER JOIN.
c. GROUP.
d. MERGE.
24.4 Q2: Which SQL keyword is required in every query?
a. FROM.
b. WHERE.
c. ORDER BY.
d. LIKE.
24.4.1 Q1: Which symbol indicates that all columns should be retrieved?
a. ?
b. *
c. +
d. /
24.4.1 Q2: To retrieve specific columns from a table, use _________ to separate the column names.
a. ?
b. *
c. ,
d. -
24.4.2 Q1: Selection criteria can be added to a SQL query using which keyword?
a. FROM.
b. WHERE.
c. SELECT.
d. LIKE.
24.4.2 Q2: Pattern matching in a SQL query is performed with which clause?
a. FROM.
b. WHERE.
page-pf3
c. SELECT.
d. LIKE.
24.4.3 Q1: The result of a query can be sorted by using the optional _________ clause.
a. ORDER BY
b. ORDER
c. SORT BY
d. SORT
24.4.3 Q2: The default sort order in a sorted query is _________.
a. ascending
b. descending
c. natural
d. None of the above
24.4.4 Q1: When joining tables, the _________ clause specifies the columns from each table that are
compared to determine which rows are merged.
a. ON
b. WHERE
c. LIKE
d. GROUP
24.4.4 Q2: If a query includes columns from multiple tables that have the same name, the statement
must precede those column names with _________.
a. their database names.
b. their database names and a dot.
c. their table names and a dot.
d. their table names.
24.4.5 Q1: This keyword is used to add a row to a table.
a. INSERT.
b. ADD.
c. UPDATE.
d. CREATE.
24.4.5 Q2: SQL uses the _________ as a delimiter for strings.
a. double quotes (" and ")
b. single quotes (' and ')
c. underscore (-)
d. percent (%)
page-pf4
24.4.6 Q1: In an UPDATE statement, the SET keyword is followed by _________.
a. a comma-separated list of column value-name pairs in the format value = columnName
b. a comma-separated list of column name-value pairs in the format columnName = value
c. a semicolon-separated list of column value-name pairs in the format value = columnName
d. a semicolon-separated list of column name-value pairs in the format columnName = value
24.4.7 Q1: Which statement is false?
a. A DELETE statement removes rows from a table.
b. A DELETE statement must specify the table from which to delete.
c. A DELETE statement starts with the keyword DELETE.
d. A WHERE clause must be present in a DELETE statement.
24.6.1 Q1: Classes and interfaces for the JDBC API can be found in which package?
a. java.jdbc.
b. javax.jdbc.
c. java.sql.
d. java.sql.jdbc.
24.6.1 Q2: What exception is thrown if the class loader cannot locate the driver class?
a. NoSuchClassException.
b. ClassCastException.
c. ClassNotFoundException.
d. IllegalClassException.
24.6.2 Q1: Which constants are used to indicate that a ResultSet is scrollable, insensitive to changes and
read only?
page-pf5
a. TYPE_SCROLLABLE_INSENSITIVE, CONCUR_READ_ONLY.
b. TYPE_SCROLLABLEINSENSITIVE, CONCUR_READONLY.
c. TYPE_SCROLL_INSENSITIVE, CONCUR_READ_ONLY.
d. TYPE_SCROLL_INSENSITIVE, CONCUR_READONLY.
24.6.2 Q2: Initially, a ResultSet cursor is positioned _________.
a. before the first row
b. at the first row
c. at the last row
d. after the last row
24.7.1 Q1: An implementation of the _________ interface configures the database connection and prepares
query statements automatically.
a. ResultSet
b. RowSet
c. Both of the above
d. Neither of the above
24.7.1 Q2: Which statement is false?
a. Interface JdbcRowSet is in the javax.rowset package.
b. A CachedRowSet object is scrollable and updatable by default.
c. A JdbcRowSet object is scrollable and updatable by default.
d. JdbcRowSet is a connected RowSet.
24.8 Q1: In a PreparedStatement, parameters are counted from position ________.
a. 0
b. 1
c. 2
d. 3
24.8 Q3: PreparedStatement method ________ returns a ResultSet.
a. executeUpdate
b. executeQuery
c. execute
d. None of the above.
page-pf6
24.9 Q1: What are individual SQL statements saved in a database called?
a. Stored statements.
b. Stored queries.
c. Stored commands.
d. Stored procedures.
24.9 Q2: SQL statements that are stored in a database can be invoked using an object that implements
interface ________.
a. Callable
b. StoredStatement
c. CallableStatement
d. Connection
24.10 Q1: Transaction processing enables a program to ________ or ________ a transaction based on
whether the transaction was successful.
a. save, delete
b. commit, rollback
c. save, rollback
d. commit, delete
24.10 Q2: Transaction processing enables a program to treat a database operation, or set of operations, as
single operation. This is known as a(n) ________ or a(n) ________.
a. atomic operation, unique operation.
b. unique operation, transaction.
c. atomic operation, transaction.
d. None of the above.

Trusted by Thousands of
Students

Here are what students say about us.

Copyright ©2022 All rights reserved. | CoursePaper is not sponsored or endorsed by any college or university.