JDBC 2015

1. JDBC is an API for the _________ programming language.
Answers:
• Java
• ABAP
• PHP
• C#
2. In order to access Database stored procedures, the best JDBC interface is:
Answers:
• CallableStatement
• Statememt
• PreparedStatement
• ProcedureStatement
3. _______ is not a method of a ResultSet cursor.
Answers:
• previous
• beforeFirst
• next
• end
4. _______ JDBC driver type(s) can be used in either applet or servlet code.
Answers:
• Type 3
• Type 3 and 4
• Type 1
• Type 1, 2, and 3
5. ________ is NOT a step you must perform to process an SQL statement.
Answers:
• Process the ResultSet object.
• Ping the data source.
• Execute the query.
• Establish a database connection.
6. A ________ is used to mark intermediate points inside a transaction in order to get a more fine-grained control.
Answers:
• connection point
• stored procedure
• savepoint
• pointer
7. True or False? A transaction is closed when close() is called on the Connection object.
Answers:
• True
• False
8. True or False? JDBC is an API to access relational databases, spreadsheets, and flat files.
Answers:
• True
• False
9. A ______ object lets you access the data returned by an SQL statement.
Answers:
• ReturnSet
• ResultSet
• Result
• SQLCursor
10. True or False? SQLWarning objects are a subclass of SQLException.
Answers:
• True
• False
11. Which of the following is NOT needed to set up a JDBC Environment:
Answers:
• .Net
• Database
• Java
• Database drivers
12. In order to commit changes to the database, use:
Answers:
• apply
• confirm
• commit
• save
13. True or False? JDBC will work with many different database management systems.
Answers:
• True
• False
14. JDBC stands for _______.
Answers:
• Java Database Control
• Java Direct Binary Connection
• Java Database Connectivity
• Java Data Behavior Control
15. You must register your JDBC driver in your program before using it? True or False
Answers:
• False
• True
16. Which package contains the JDBC classes?
Answers:
• java.sql
• javax.swing
• java.nio
• java.net
17. In order to undo the previous transaction, use
Answers:
• escape
• back
• rollback
• undo
18. The most common exception you'll deal with JDBC:
Answers:
• FileNotFoundException
• SQLException
• NullPointerException
• ArithmeticException
19. If a database operation fails, JDBC raises an:
Answers:
• SecurityException
• SQLException
• AccessException
• NullException
20. _______ extends the RowSet interface.
Answers:
• All of the above
• CachedRowSet
• JoinRowSet
• WebRowSet
21. In the syntax {ts 'yyyy-mm-dd hh:mm:ss'}, ts stands for
Answers:
• date
• time
• seconds
• timestamp
22. What kind of database is the command jdbc:mysql:://localhost:3306/ is connecting to?
Answers:
• Microsoft Access
• IBM DB2
• MySQL
• JavaDB
23. The SQLXML interface provides the _____ method to access its internal content.
Answers:
• getString
• All of the above
• getCharacterStream
• getBinaryStream
24. If the ResultSet type is TYPE_FORWARD_ONLY, it implies:
Answers:
• the cursor can move forward in the result set
• the cursor can scroll backwards and forwards
• the cursor can move backards in the result set
• the cursor can scroll forwards and backwards
25. ______ is NOT a valid parameter mode for a stored procedure.
Answers:
• CONSTANT
• OUT
• IN
• INOUT
26. In order to accept input parameters at runtime, use the following JDBC interface:
Answers:
• RuntimeStatement
• ParameterStatement
• PreparedStatement
• Statement
27. The Class.forname() method is used to:
Answers:
• Rename class
• get name for the Class
• Call another method
• register the jdbc driver
28. If the column you are interested in viewing contains an int, which of the following methods of Resultset can be used?
Answers:
• getDate()
• getString()
• getInt()
• getNumber()
29. {fn length('Friday')} will return
Answers:
• 6
• null
• 12
• Friday
30. Which of the following in not required by the getConnection() method to create a connecton object?
Answers:
• Database url
• Username
• Website url
• Password
31. At the end of the JDBC program, it is explicity required to close al the connections to the database? True or False
Answers:
• False
• True
32. True or False? If executing a Statement object many times, a PreparedStement object will reduce execution time.
Answers:
• False
• True
33. When a Driver Class is loaded, it creates an instance of itself and registers it with:
Answers:
• SocketManager
• ConnectionManager
• DriverManager
• ClassManager
34. ________ is an object used for precompiling SQL statements that may contain input parameters.
Answers:
• Stored Procedure
• Callable Statement
• Prepared Statement
• Query
35. True or False? The RowSet object holds data in a tabular form that is more flexible and easier to use than the ResultSet object.
Answers:
• True
• False
36. In the command jdbc:derby:testdb;create=true, testdb stands for
Answers:
• Server name
• Client name
• Database name
• Port name
37. True or False? The default mode when a connection is created is auto-commit mode.
Answers:
• False
• True
38. The ______ packages contain the JDBC classes.
Answers:
• java.jdbc and javax.jdbc
• java.sql and java.jdbc
• java.rdb and java.sql
• java.sql and javax.sql
39. JDBC API uses which drivers to connect to the database?
Answers:
• .Net
• odbc
• jdbc
• Microsoft
40. Autocommit must be set to false when using batch processing with Statement object? True or Flase
Answers:
• False
• True
41. All JDBC Rowset objects are derived from which interface?
Answers:
• Statement
• CallableStatement
• PreparedStatement
• ResultSet
42. boolean execute (String SQL) returns:
Answers:
• the number of rows affected by the executon of the SQL statement
• boolean value of true if a resultset object can be retrieved
• Returns a Resultset object
• the number of columns affected by the executon of the SQL statement
43. To close existing database connections, you should call
Answers:
• close() method
• shutdown() method
• exit() method
• escape() method
44. The executeUpdate method from Statement returns:
Answers:
• an integer representing the number of rows affected by the SQL statement
• multiple ResultSet objects
• true if the first object that the query returns is a ResultSet object
• one ResultSet object
45. To jump back to a specific point in the program, create a:
Answers:
• Anchor
• Reference
• Savepoint
• Marker
46. Which of the following is not an overloaded DriverManager.getConnection () method?
Answers:
• getConnection(String url, String user, String password)
• getConnections()
• getConnection(String url)
• getConnection(String url, Properties prop)
47. _______ driver type(s) are for use over communication networks.
Answers:
• Type 3
• Type 3 and 4
• Type 1 and 3
• Type 1 and 2
48. A ______ is not contained in an SQLException.
Answers:
• description of the error
• error code
• SQLState code
• effect
49. True or False? JDBC is an API to connect object and XML data sources.
Answers:
• False
• True
50. A _______ is used to access the data in a ResultSet.
Answers:
• loop
• variable
• cursor
• pointer
51. _____ will create a RowSet object.
Answers:
• Using an instance of RowSetFactory, which is created from the class RowSetProvider
• Using the reference implementation constructor that takes a Connection object
• All of the above
• Using the reference implementation default constructor
52. public void updateString(int columnIndex, String s) throws SQLException
Answers:
• Changes the String in the specified row specified by its name to the value of s
• Changes the String in the specified row specified by its index to the value of s
• Changes the String in the specified column specified by its index to the value of s
• Changes the String in the specified column specified by its name to the value of s
53. The _______ method adds SQL commands to the list associated with a Statement object.
Answers:
• select
• updateList
• addSQL
• addBatch
54. _______ driver type(s) can be used in a three-tier architecture and if the web server and DBMS are running on the same machine.
Answers:
• Type 1 and 2
• Type 1 and 3
• Type 2, and 3
• Type 1, 2, 3, and 4
55. Which of the following parameters is used by the Preparedstatement object?
Answers:
• INOUT
• OUT
• IN
• OR
56. _______ driver type is the JDBC-ODBC bridge?
Answers:
• Type 1
• Type 2
• Type 3
• Type 4
57. While accessing databses such as Oracle, Sybase or IBM, the preferred driver type is:
Answers:
• Type 4: 100% Pure Java
• Type 1: JDBC-ODBC Driver Bridge
• Type 3: JDBC-Net pure Java
• Type 2: JDBC-Native API
58. If you are going to use Static SQL statements at runtime, the best JDBC interface to use is:
Answers:
• PreparedStatement
• Statememt
• CallableStatement
• StaticStatement
59. Transaction_read_committed (one example of transaction isolation level) does not alow:
Answers:
• Dirty reads
• Phantom Reads
• Clean reads
• Non-Repeatable reads
60. Which object has the ability to use input and output streams to supply parameter data?
Answers:
• StreamingStatement
• PreparedStatement
• Statement
• CallableStatement
61. _______ is not a valid ResultSet type.
Answers:
• TYPE_FORWARD_ONLY
• TYPE_SCROLL_SENSITIVE
• TYPE_SCROLL_INSENSITIVE
• TYPE_BACKWARD_ONLY
62. A ________ is a subclass of SQLException.
Answers:
• SQLMethod
• SQLError
• SQLWarning
• Exception
63. Which driver type is best suited for development and testing purpose?
Answers:
• Type 2: JDBC-Native API
• Type 1: JDBC-ODBC Driver Bridge
• Type 4: 100% Pure Java
• Type 3: JDBC-Net pure Java
64. The DATALINK SQL data type maps to the JDBC _____ object.
Answers:
• SQLXML interface
• java.net.URL
• java.net
• Ref interface
65. A _______ is a set of one or more statements that is executed as a unit.
Answers:
• prepared statement
• stored procedure
• transaction
• callable statement
66. True or False? After fetching an instance of the Connection object, a live connection must first be established before making queries to the database.
Answers:
• False
• True
67. _______ is NOT a valid example of a transaction isolation level.
Answers:
• TRANSACTION_REPEATABLE_COMMIT
• TRANSACTION_READ_UNCOMMITTED
• TRANSACTION_REPEATABLE_READ
• TRANSACTION_READ_COMMITTED
68. The _______ of a ResultSet object determines what level of update functionality is supported.
Answers:
• holdability
• class
• concurrency
• type
69. True or False? MySQL and Java DB support the ARRAY SQL data type.
Answers:
• True
• False
70. ______ is NOT a subclass of SQLException
Answers:
• SQLNonTransientException
• BatchUpdateException
• SQLTransientException
• SQLFailureException
71. True or False? Applications may release Blob, Clob, and NClob resources by invoking their release method.
Answers:
• True
• False
72. For storing file into the database, which datatype is used in table?
Answers:
• DATALINK
• NLOB
• BLOB
• CLOB
73. Which of the following is not an Advanced Data type in JDBC API?
Answers:
• DATALINK
• Structured type
• ROWID
• varbinary (max)
74. True or False? The list associated with a Statement object may contain a statement that produces a ResultSet object.
Answers:
• False
• True
75. If your Java aplication is accessing multiple databases at the same time, the preferred driver type is:
Answers:
• Type 1: JDBC-ODBC Driver Bridge
• Type 3: JDBC-Net pure Java
• Type 4: 100% Pure Java
• Type 2: JDBC-Native API
76. Resources used by Blob, Clob an NClob Java objects can be released by using which method?
Answers:
• free
• release
• close
• exit
77. General SQL escape syntax format is:
Answers:
• {keyword "parameters"}
• (keyword 'parameters')
• [keyword 'parameters']
• {keyword 'parameters'}
78. True or False? A transaction is finished when commit() or rollback() is called on the Transaction object.
Answers:
• False
• True
79. A ______ RowSet object makes a connection to a data source only to read or write data based on a ResultSet object.
Answers:
• disconnected
• overloaded
• transient connected

• connected

No comments:

Post a Comment