5 Answer
5 Answer
SANJIVANI K. B. P. POLYTECHNIC
Department of Computer Technology
/ 64
KOPARGAON – 423601, DIST: AHMEDNAGAR
2023-2024
Sub Name : Advanced Java Programming (AJP-22517) Course Code : CM-5-I
Name : Date: / /2023
Roll No : Set: I
Practice Test: [Unit V – Interacting with Database]
(d) ResultSet
3. How many steps are used to connect any java application with the database using JDBC ?
(a) 5 (b) 4 (c) 3 (d) 6
(b) 4
(c) PreparedStatement
7. Which kind of driver converts JDBC calls into calls on the Client API for Oracle, Sybase, Informix, IBM DB2, or other DBMS
(a) JDBC ODBC bridge + ODBC Driver (b) Native API partly ñ Java Driver
(c) JDBC ñ Net pure Java Driver (d) Native Protocol Pure Java Driver
(c) execute( )
11. Which of the following function is used to find the column count of the particular ResultSet.
(a) getMetadata( ) (b) metadata( ) (c) getColumnCount( ) (d) getCount( )
(a) getMetadata( )
12. In JDBC ______________ imports all Java classes that are concern with Database connectivity.
(a) javax.sql (b) java.mysql (c) java.sql (d) com.sql
(c) java.sql
13. The __________ package contains classes that help in connecting to a database, sending SQL statements to the database and
process the query request.
(a) connection.sql (b) db.sql (c) pkg.sql (d) java.sql
(d) java.sql
15. Database programming using Java throws which of the following exception?
(a) SQLException (b) ClassNotFoundException (c) None of these (d) Both of these (d) Both of these
16. In the below statement, which type of query can be used with executeUpdate( ) method. statement.executeUpdate(query here)
(a) Insert, Update, Delete (b) Insert, Select, Delete (c) Only Select (d) Any Query
18. Native – protocol pure Java Driver converts _______ into the _________ directly.
(a) JDBC calls, network protocol (b) ODBC class, network protocol
(c) ODBC class, user calls (d) JDBC calls, user calls
(c) public static Connection getConnection(String url, String name, String password) throws SQLException
(c) ResultSet
(a) Object
23. Which of the following method is supported by Statement interface?
(a) public boolean execute(String query) (b) public ResultSet executeQuery(String query)
(c) public int executeUpdate(String query) (d) All of above
24. The JDBC‐ODBC bridge supports how many concurrent open statements per connection ?
(a) 1 (b) 0 (c) Does not support conection (d) None of these
(a) 1
(b) .MDB
27. Which of the following method is used for send SQL statements?
(a) Statement (b) CallableStatement (c) PreparedStatement (d) Both B & C
(c) executeUpdate()
(b) JDBC
(b) getMetaData()
31. Which method is used to retrieve the ResultSet created?
(a) executeQuery( ) (b) getResultSet( ) (c) getResultSetResult( ) (d) getResult( )
(a) executeQuery()
32. Which of the following is used generally for reading the content of the database?
(a) DabaseData (b) DabaseData (c) ResultSet (d) DatabaseResult.
(c) ResultSet
33. The syntax to create a table named “Course”, should begin with __________.
(a) create new table course (b) create table course (c) table course create (d) new table course
(c) java.util.Date
(a) java.sql.Timestamp
a) setMaxRows(int i)
d) addBatch()
a) rollback()
(d) TRANSACTION_NONREPEATABLE_READ
(c) public static Connection getConnection(String url, String name, String password) throws SQLException
45. The syntax to create a table named ìCourseî, should begin with ____.
(a) create new table course (b) create table course
(c) table course create (d) new table course
a) i, ii, iii, v, iv, vii, viii, vi b) i, iii, ii, v, iv, vii, vi, viii c)ii, i, iii, iv, viii, vii, v, vi d)i, iii, ii, iv, v, vi, vii, viii
50. Which of the following method is used to perform DML statements in JDBC?
a) executeResult() b) executeQuery() c) executeUpdate() d) execute()
(c) executeUpdate()
51. How many transaction isolation levels provide the JDBC through the Connection interface?
a) 3 b) 4 c) 7 d) 2
(b) 4
52. Which of the following method is static and synchronized in JDBC API?
a) getConnection() b)prepareCall() c) executeUpdate() d)executeQuery()
(a) getConnection()
(c) QueryStatement
(a) ROLLBACK
60. Which type of ResultSet allows changes made in the ResultSet to be reflected in the database?
a) ResultSet.TYPE_FORWARD_ONLY b) ResultSet.TYPE_SCROLL_INSENSITIVE
c) ResultSet.TYPE_SCROLL_SENSITIVE d) ResultSet.TYPE_UPDATABLE
(d) ResultSet.TYPE_UPDATABLE
61. . Which method is used to retrieve the SQL warning associated with a JDBC Connection?
a) getWarning() b) fetchWarning( ) c) retrieveWarning() d) obtainWarning()
(a) getWarning()
62. Which method is used to retrieve the auto-generated keys after an INSERT operation, but only for specific columns?
a) getGeneratedKeys() b) fetchGeneratedKeys() c) retrieveGeneratedKeys() d) obtainGeneratedKeys()
(a) getGeneratedKeys()
63. In JDBC, which interface provides methods to work with large binary data, such as images or files, stored in a database?
a) java.sql.Clob b) java.sql.Blob c) java.sql.BinData d) java.sql.LargeData
(b) java.sql.Blob