0% found this document useful (0 votes)
87 views

DB Unit 5 AJP Assognment

Uploaded by

shreyachavan1406
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)
87 views

DB Unit 5 AJP Assognment

Uploaded by

shreyachavan1406
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
You are on page 1/ 4

Rayat Shikshan Sanstha’s

KARMAVEER BHAURAO PATIL POLYTECHNIC


Department of Information Technology
Assignment 5
UNIT 5(Interacting with Databases)

1. In following statement rs is an object of interface of JDBC API. System.prinln(re.getString(3)).


(a) RowSet (b) Statement (c) Connection (d) ResultSet

2. Which is main component of JDBC API?


(a) DriverManager (b) Driver (c) Connection (d) All of these

3. How many steps are used to connect any java application with the database using
JDBC ? (a) 5 (b) 4 (c) 3 (d) 6

4. ODBC minimum SQL grammer contains


(a) Stored procedure (b) Data, Time and TimeStamp only (c) create or drop View (d) Insert, update, delete only

5. Which class/interface is used for an SQL statement that is executed frequently?


(a) Statement (b) CallableStatement (c) PreparedStatement (d) None of the above

6. What does the following code do : smt = con.createStatement( )


(a) A PreparedStatement object is created to send SQL commands to database
(b) A Statement object is created to send SQL commands to database.
(c) A CallableStatement is created to send SQL commands to database
(d) A Statement object is created to execute parameterized SQL commands.

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

8. Which method executes an SQL statement that may return multiple results?
(a) executeUpdate( ) (b) executeQuery( ) (c) execute( ) (d) noExecute( )

9. Identify correct syntax of executeQuery( ) of Statement interface.


(a) public static ResultSet executeQuery( ) (b) public ResultSet executeQuery(String q)
(c) public void executeQuery(String q) (d) public int executeQuery(String q)

10. Native API converts into the used by DBMS.


(a) JDBC API, Network Protocol (b) JDBC API, Native API calls(c) JDB
(c) API, use calls (d) JDBC API, ODBC API calls

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( )

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

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

14. Which of the following is not a type of JDBC driver?


(a) 100% pure Java Driver (b) JDBC – net pure Java Driver
(c) JDBC – Native API driver (d) JDBC – Native pure Java Driver
15. Database programming using Java throws which of the following exception?
(a) SQLException (b) ClassNotFoundException (c) None 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

17. What is purpose of next( ) method?


(a) to retain the next element in a series. (b) to retain next table.
(c) to retain next record in a series. (d) None of the above

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

19. Choose the correct syntax for getConnection( ) method.


(a) public static Connection getConnection(String url, String password) throws SQLException
(b) public static Connection getConnection(String name, String password) throws SQLException
(c) public static Connection getConnection(String url, String name, String password) throws SQLException
(d) public static Connection getConnection(String url, String name) throws SQLException

20. SQL stands for .


(a) Structured Query Language (b) Sequential Query Language
(c) Structured Question Language (d) Sequential Question Language

21. is a table of data which represents a data from table.


(a) MetaData (b) ResultSetMetaData (c) ResultSet (d) Statement

22. Public class DriverManager extends .


(a) Object (b) String (c) Connection (d) Statement

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

25. Select the correct method to create CallableStatement.


(a) CallableStatement prepareCall(String sql)
(b) CallableStatement prepareCall(String sql, int resultset type, int resultset_concurrency)
(c) CallableStatement prepareCall(String sql, int resultset_type, int resultset_concurrency, int resultset_holdability)
(d) All of the above

26. Microsoft Access data in file format.


(a) .DAT (b) .MDB (c) .MSSQL (d) .OBJ

27. Which of the following method is used for send SQL statements?
(a) Statement (b) CallableStatement (c) PreparedStatement (d) Both B & C

28. DELETE statement of an SQL is executed by .


(a) execute( ) (b) executeQuery( ) (c) executeUpdate( ) (d) executeDelete()

29. The interface to the database is handle by .


(a) ODBC (b) JDBC (c) JDBC & ODBC (d) APIs

30. DatabaseMetadata are retrieved through .


(a) getDatabaseMetadata( ) (b) getMetaData( ) (c) getDBMetaData( ) (d) getDatabaseMeta( )

31. Which method is used to retrieve the ResultSet created?


(a) executeQuery( ) (b) getResultSet( ) (c) getResultSetResult( ) (d) getResult( )
32. Which of the following is used generally for reading the content of the database?
(a) DabaseData (b) DabaseData (c) ResultSet (d) DatabaseResult.

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

34. Which of the following contains both date and time?


a) java.io.date b) java.sql.date c) java.util.date d) java.util.dateTime

35. Which of the following is advantage of using JDBC connection pool?


a) Slow performance b) Using more memory c) Using less memory d) Better performance

36. Which of the following is advantage of using PreparedStatement in Java?


a) Slow performance b) Encourages SQL injection c) Prevents SQL injection d) More memory usage

37. Which one of the following contains date information?


a) java.sql.TimeStamp b) java.sql.Time c) java.io.Time d) java.io.TimeStamp

38. What does setAutoCommit(false) do?


a) commits transaction after each query b) explicitly commits transaction
c) does not commit transaction automatically after each query d) never commits transaction

39. Which of the following is used to call stored procedure?


a) Statement b) PreparedStatement c) CallableStatment d) CalledStatement

40. Which of the following is used to limit the number of rows returned?
a) setMaxRows(int i) b) setMinRows(int I) c) getMaxrows(int i) d) getMinRows(int i)

41. Which of the following is method of JDBC batch process?


a) setBatch() b) deleteBatch() c) removeBatch() d) addBatch()

42. Which of the following is used to rollback a JDBC transaction?


a) rollback() b) rollforward() c) deleteTransaction() d) RemoveTransaction()

43. Which of the following is not a JDBC connection isolation levels?


a) TRANSACTION_NONE b) TRANSACTION_READ_COMMITTED
c) TRANSACTION_REPEATABLE_READ d) TRANSACTION_NONREPEATABLE_READ

44. Choose the correct syntax for getConnection( ) method.


(a) public static Connection getConnection(String url, String password) throws SQLException
(b) public static Connection getConnection(String name, String password) throws SQLException
(c) public static Connection getConnection(String url, String name, String password) throws SQLException
(d) public static Connection getConnection(String url, String name) 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

46. What are the major components of the JDBC?


(a) DriverManager, Driver, Connection, Statement, and ResultSet
(b) DriverManager, Driver, Connection, and Statement
(c) DriverManager, Statement, and ResultSet
(d) DriverManager, Connection, Statement, and ResultSet

47. Select the packages in which JDBC classes are defined?


a. jdbc and javax.jdbc b. rdb and javax.rdb c. jdbc and java.jdbc.sql d.sql and javax.sql

48. Thin driver is also known as?


a)Type 3 Driver b)Type-2 Driver c)Type-4 Driver d)Type-1 Driver
49. What is the correct sequence to create a database connection?
i. Import JDBC packages. ii. Open a connection to the database.
iii. Load and register the JDBC driver. iv. Execute the statement object and return a query resultset.
v. Create a statement object to perform a query. vi. Close the resultset and statement objects.
vii. Process the resultset. viii. Close the connection.

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()

51. How many transaction isolation levels provide the JDBC through the Connection
interface? a) 3 b) 4 c) 7 d) 2

52. Which of the following method is static and synchronized in JDBC API?
a) getConnection() b)prepareCall() c) executeUpdate() d)executeQuery()

53. Which methods are required to load a database driver in JDBC?


a) getConnection() b) registerDriver() c) forName() d) Both b and c

54. Parameterized queries can be executed by?


a)ParameterizedStatement b)PreparedStatement
c) CallableStatement and Parameterized Statement d)All kinds of Statements

55. Which of the following is not a valid statement in JDBC?


a) statement b) PreparedStatement c) QueryStatement d)CallableStatement

56. What does setAutoCommit(false) do?


a) It will not commit transactions automatically after each query. b) It explicitly commits the transaction.
c) It never commits the transactions. d) It does not commit transaction automatically after each query.

57. A good way to debug JDBC-related problems is to enable???..?


a) JDBC tracing b) Exception handling c) Both a and b d) Only b

58. Which statement is used to roll back a transaction in JDBC?


a) ROLLBACK b) COMMIT c) BEGIN TRANSACTION d) SET TRANSACTION

59. What is the purpose of the java.sql.DriverManager class in JDBC?


a) To manage database transactions b) To create a connection to the database
c) To represent a SQL statement d) To execute stored procedures

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

61. . Which method is used to retrieve the SQL warning associated with a JDBC Connection?
a) getWarning() b) fetchWarning( ) c) retrieveWarning() d) obtainWarning()

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()

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

64. In JDBC, what is the purpose of the ResultSetMetaData interface?


a) To retrieve database metadata b) To represent a result set
c) To execute SQL queries d) To manage database connections

You might also like