Download SampleExam13(Ch36-37..

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Name:_______________________ Sample Exam
Covers Chs 36-37
Multiple Choice Questions Only for This Test
Part I: Questions: (1 pts each)
1 Which of the following statements are true?
A. To create a tree model, you may first create an instance of
TreeNode to represent the root of the tree, and then create
an instance of DefaultTreeModel fitted with the root.
B. DefaultTreeModel is a concrete implementation for TreeModel
that uses TreeNode.
C. TreeModel contains the structural information about the tree,
and tree data are stored and managed by TreeNode.
D. The TreeModel interface represents the entire tree. Unlike the
ListModel or TableModel, the tree model does not directly
store or manage tree data.
2
You can create a JTable using __________.
A.
B.
C.
D.
new JTable(new DefaultTableModel())
new JTable()
new JTable(4, 5)
new JTable(new Integer[3][4], new Integer[4])
3 You can create a JTree using __________.
A.
B.
C.
D.
new JTree()
new JTree(new DefaultTreeModel())
new JTree(new Object[]{"red", "green", "blue"})
new JTree(new Vector())
4 The data in DefaultTableModel are stored in ___________.
A.
B.
C.
D.
an array
a LinkedList
a Vector
an ArrayList
5 DefaultTableModel contains the methods for
A.
B.
C.
D.
E.
adding a column
removing a row
removing a column
inserting a new row
adding a new row
1
6 The autoResizeMode property specifies how columns are
resized (you can resize table columns but not rows).
Possible values are:
A.
B.
C.
D.
E.
JTable.AUTO_RESIZE_OFF
JTable.AUTO_RESIZE_NEXT_COLUMN
JTable.AUTO_RESIZE_ALL_COLUMNS
JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS
JTable.AUTO_RESIZE_LAST_COLUMN
7 _________ are the properties in JTable.
A.
B.
C.
D.
E.
rowCount
columnCount
rowHeight
rowMargin
gridColor
8 DefaultTableModel contains the methods for
A.
B.
C.
D.
E.
removing a column
inserting a new row
adding a column
removing a row
adding a new row
9 _________ are the properties in JTable.
A.
B.
C.
D.
E.
rowHeight
columnCount
rowMargin
gridColor
rowCount
10 The data in DefaultTableModel are stored in ___________.
A.
B.
C.
D.
an ArrayList
an array
a Vector
a LinkedList
11 The autoResizeMode property specifies how columns are
resized (you can resize table columns but not rows).
Possible values are:
A.
B.
C.
D.
E.
JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS
JTable.AUTO_RESIZE_NEXT_COLUMN
JTable.AUTO_RESIZE_ALL_COLUMNS
JTable.AUTO_RESIZE_LAST_COLUMN
JTable.AUTO_RESIZE_OFF
12 _________ are the properties in JTable.
2
A.
B.
C.
D.
E.
A.
B.
C.
D.
selectionForeground
selectionMode
selectionBackground
showGrid
model
13 You can create a JTree using __________.
new
new
new
new
JTree(new Object[]{"red", "green", "blue"})
JTree()
JTree(new DefaultTreeModel())
JTree(new Vector())
14 Invoking Class.forName method may throw ___________.
A.
B.
C.
D.
ClassNotFoundException
RuntimeException
IOException
SQLException
15 What information may be obtained from a DatabaseMetaData
object?
A. maximum number of connections to the database
B. JDBC driver name and version
C. maximum table name length and maximum number of columns in a
table
D. database URL and product name
16 Which of the following are interfaces?
A.
B.
C.
D.
Statement
DriverManager
ResultSet
Connection
17
In a relational data model, _________ defines the
representation of the data.
A.
B.
C.
D.
SQL
Structure
Language
Integrity
18 Which of the following statements are true?
A. You may load multiple JDBC drivers in a program.
B. You may create multiple connections to a database.
C. You may create multiple statements from one connection.
3
D. You can send queries and update statements through a Statement
object.
19 Which of the following statements loads the JDBC-ODBC
driver?
A.
B.
C.
D.
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver")
Class.forName(sun.jdbc.odbc.JdbcOdbcDriver)
Class.loadClass("sun.jdbc.odbc.JdbcOdbcDriver")
Class.loadClass(sun.jdbc.odbc.JdbcOdbcDriver)
20 To create a statement on a Connection object conn, use
A.
B.
C.
D.
Statement statement = conn.createStatement();
Statement statement = conn.statement();
Statement statement = Connection.createStatement();
Statement statement = connection.create();
21 SQL ________ statements may change the contents of a
database.
A.
B.
C.
D.
INSERT
SELECT
DELETE
UPDATE
22 A database URL for an access database source test is
________.
A.
B.
C.
D.
jdbcodbc:test
jdbc:odbc:test
test
sun.jdbc:odbc:test
23 Database meta data are retrieved through ____________.
A.
B.
C.
D.
a
a
a
a
Connection object
PreparedStatement object
Statement object
ResultSet Object
24 What is the return value from
stmt.executeUpdate("insert into T values (100,
'Smith')")
A. an int value indicating how many rows are effected from the
invocation
B. void
C. a value indicating whether the SQL statement has been executed
successfully
D. an object that contains the status of the execution
4
25 ________ are known as intra-relational constraints, meaning
that a constraint involves only one relation.
A. Domain constraints
B. Primary key constraints
C. Foreign key constraints
26 A database URL for a MySQL database named test on host
panda.armstrong.edu is ________.
A.
B.
C.
D.
jdbc:mysql:/panda.armstrong.edu/test
jdbc.mysql://panda.armstrong.edu/test
jdbc:mysql://panda.armstrong.edu/test
jdbc.mysql.//panda.armstrong.edu/test
27 In a relational data model, _________ imposes constraints
on the data.
A.
B.
C.
D.
Language
Structure
SQL
Integrity
28 To execute a SELECT statement "select * from Address" on a
Statement object stmt, use
A.
B.
C.
D.
stmt.executeUpdate("select * from Address");
stmt.executeQuery("select * from Address");
stmt.query("select * from Address");
stmt.execute("select * from Address");
29 _________ specify the permissible values for an attribute.
A.
B.
C.
D.
E.
Domain constraints
intra-relational constraints
Primary key constraints
inter-relational constraints
Foreign key constraints
30 Suppose that your program accesses MySQL or Oracle
database. Which of the following statements are true?
A. If the database is not available, the program will have a
runtime error, when attempting to create a Connection
object.
B. If the database is not available, the program will have a
syntax error.
C. If the driver for MySQL and Oracle are not in the classpath,
the program will have a runtime error, indicating that the
driver class cannot be loaded.
D. If the driver for MySQL and Oracle are not in the classpath,
the program will have a syntax error.
5
31 What information may be obtained from a ResultSetMetaData
object?
A. number of rows in the result set
B. JDBC driver name and version
C. number of columns in the result set
D. database URL and product name
32 ________ is an attribute or a set of attributes that
uniquely identifies the relation.
A.
B.
C.
D.
A
A
A
A
primary key
key
superkey
candidate key
33 Which of the following statements are true?
A. PreparedStatement is for SQL query statements only. You cannot
create a PreparedStatement for SQL update statements.
B. PreparedStatement is efficient for repeated executions.
C. The parameters in a prepared statement is denoted using the ?
sign.
D. PreparedStatement is a subinterface of Statement
34 Where is com.mysql.jdbc.Driver located?
A. in the standard Java library bundled with JDK
B. in a JAR file classes12.jar
C. in a JAR file mysqljdbc.jar
35 Analyze the following code:
ResultSet resultSet = statement.executeQuery
("select firstName, mi, lastName from Student where
lastName "
+ " = 'Smith'");
System.out.println(resultSet.getString(1));
A. resultSet.getString(1) returns the mi field in the result set.
B. The program will have a runtime error, because the cursor in
resultSet does not point to a row. You must use
resultSet.next() to move the cursor to the first row in the
result set. Subsequently, resultSet.next() moves the cursor
to the next row in the result set.
C. If the SQL SELECT statement returns no result, resultSet is
null.
D. resultSet.getString(1) returns the firstName field in the
result set.
36 In a relational data model, ________ provides the means for
accessing and manipulating data.
A. Structure
6
B. Language
C. Integrity
D. SQL
37 To connect to a local MySQL database named test, use
A. Connection connection =
DriverManager.getConnection(jdbc:mysql://localhost/test);
B. Connection connection =
DriverManager.getConnection("jdbc:mysql://localhost/test");
C. Connection connection =
DriverManager.connect("jdbc:mysql://localhost/test");
D. Connection connection =
DriverManager.getConnection("mysql:jdbc://localhost/test");
38 Result set meta data are retrieved through ____________.
A.
B.
C.
D.
a
a
a
a
Connection object
PreparedStatement object
Statement object
ResultSet Object
Keys:
1. ABCD
2. ABCD
3. ABCD
4. C
5. ADE
6. ABCDE
7. ABCDE
8. BCE
9. ABCDE
10. C
11. ABCDE
12. ABCDE
13. ABCD
14. A
15. ABCD
16. ACD
17. B
18. ABCD
19. A
20. A
21. ACD
22. B
23. A
24. A
25. AB
7
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
C
D
B
A
AC
C
C
BCD
C
BD
BD
B
D
8
Related documents