0% found this document useful (0 votes)
28 views4 pages

Unit 5 Set 1 Question-63

Uploaded by

mehfoozpathan75
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)
28 views4 pages

Unit 5 Set 1 Question-63

Uploaded by

mehfoozpathan75
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

COMPUTER ENGNEERING DEPARTMENT

Sub Name : Advanced Java Programming (AJP-22517) Course Code : CO-5-I


Name : Date: / /2024
Roll No :
Practice Test: [ Unit V- Interacting with Database]

1. What does JDBC stand for? –


a) Java Database Control b) Java Database Connectivity c) Java Data Binding Connector d) Java Database Console

2. Which package in Java contains the JDBC classes?


a) java.sql b) java.jdbc c) java.db d) java.connection

3. In JDBC, which interface is responsible for making a connection to the database?


a) Driver b) Connection c) Statement d) ResultSet

4. Which of the following is used to execute SQL queries in JDBC?


a) DriverManager b) Connection c) ResultSet d) PreparedStatement

5. What is the purpose of the `ResultSet` interface in JDBC?


a) To connect to the database b) To execute SQL queries c) To store query results d) To create a database table

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


a) Type 1 b) Type 2 c) Type 4 d) Type 6

7. Which driver type is known as the “Thin driver” in JDBC?


a) Type 1 b) Type 2 c) Type 3 d) Type 4

8. What is the purpose of the `PreparedStatement` interface in JDBC?


a) To connect to the database b) To store query results c) To precompile SQL statements d) To execute DDL commands

9. Which method is used to establish a connection to the database in JDBC?


a) createConnection() b) openConnection() c) getConnection() d) establishConnection()

10. Which of the following is not a valid SQL data type in JDBC?
a) VARCHAR b) INT c) DOUBLE d) BOOLEAN

11. What is the purpose of the `Statement` interface in JDBC?


a) To connect to the database b) To execute SQL queries c) To precompile SQL statements d) To store query results

12. In JDBC, which exception is thrown when there is a problem with the SQL syntax?
a) SQLException b) SQLSyntaxException c) SQLQueryException d) SyntaxError

13. Which method is used to execute a query in JDBC and retrieve the results in a `ResultSet`?
a) executeQuery() b) executeUpdate() c) execute() d) executeBatch()

14. What is the purpose of the `Connection` interface in JDBC?


a) To execute SQL queries b) To store query results c) To manage the connection to the database d) To compile SQL
15. In JDBC, what is the role of the `DriverManager` class?
a) To establish a connection to the database b) To execute SQL queries
c) To manage the result set d) To manage the connection pool database
16. Which of the following is not a JDBC driver?
A. MySQL Connector/J B. PostgreSQL JDBC Driver C. Microsoft SQL Server JDBC Driver D. ODBC Driver

17. Which of the following is used to create a JDBC connection to a database?


A. DriverManager.getConnection() B. Connection.getConnection()
C. Statement.getConnection() D. PreparedStatement.getConnection()

18. Which of the following is used to execute an SQL query in JDBC?


A. Statement.executeQuery() B. Connection.executeQuery()
C. PreparedStatement.executeQuery() D. ResultSet.executeQuery()

19. Which of the following is used to close a JDBC connection?


A. Connection.close() B. Statement.close() C. PreparedStatement.close() D. ResultSet.close()

20. Which of the following is used to handle exceptions in JDBC?


A. try-catch block B. throws clause C. finally block D. All of the above

21. Which of the following is a benefit of using a PreparedStatement in JDBC?


A. It prevents SQL injection. B. It improves performance. C. Both A and B. D. None of the above.

22. Which of the following is a JDBC transaction?


A. A sequence of database operations that are treated as a single unit. B. A way to rollback database changes if an error occurs.
C. Both A and B. D. None of the above.

23 Which of the following is a JDBC connection isolation level?


A. READ UNCOMMITTED B. READ COMMITTED C. REPEATABLE READ
D. SERIALIZABLE E. All of the above

24. Which of the following is a JDBC savepoint?


A. A point in a transaction where you can rollback to if an error occurs.
B. A way to commit a subset of the changes made in a transaction.
C. Both A and B.
D. None of the above.

25. Which of the following is a JDBC batch update?


A) A way to execute multiple SQL statements at once. B) A way to improve the performance of bulk database operations.
C) Both A and B. D). None of the above.

26. 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)b.sql (c)pkg.sql (d)java.sql

27. 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

28.In JDBC imports all Java classes that are concern with Database connectivity.
(a) javax.sql (b)java.mysql (c)java.sql (d)com.sql

29.Database programming using Java throws which of the following exception?


(a)SQLException (b)ClassNotFoundException (c)None of these (d) Both of these

30.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

31. 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
32.What are the major component of the jdbc?
a) DriverManager, DriverConnection, Statement and Resultset b) DriverManager, DriverConnection, and Resultset
c) DriverManager, DriverConnection, Statement d) DriverManager, Connection, Statement and Resultset

33. How Many Transaction isolation levels divide the JDBC through the connection interface?
a) 3 b) 4 c) 7 d) 2

34. Identify the isolation level the prevents the dirty in the JDBC connection class?
a) TRANSACTION_READABLE_READ
b) TRANSACTION_READ_COMMITED
c) TRANSACTION_READ_UNCOMMITED
d) TRANSACTION_NONE

35. In order to transfer data between a database and an application written in the Java programming language, the JDBC API
provides which of these methods?
a. Methods on the ResultSet class for retrieving SQL SELECT results as Java types.
b. Methods on the PreparedStatement class for sending Java types as SQL statement parameters.
c. Methods on the CallableStatement class for retrieving SQL OUT parameters as Java types.
d. All mentioned above

36. The JDBC API has always supported persistent storage of objects defined in the Java programming language through the
methods getObject and setObject.
a. True b. False

37.Which JDBC type represents a "single precision" floating point number that supports seven digits of mantissa?
a. REAL b. DOUBLE c. FLOAT d. INTEGER

38. Which method is used for retrieving streams of both ASCII and Unicode characters is new in the JDBC 2.0 core API?
a. getCharacterStream b. getBinaryStream c. getAsciiStream d. getUnicodeStream

39. How many Result sets available with the JDBC 2.0 core API?
a. 2 b. 3 c. 4 d. 5

40. Abbreviate the term UDA?


a. Unified Data Access b. Universal Data Access
c. Universal Digital Access d. Uniform Data Access

41. The performance of the application will be faster if you use PreparedStatement interface because query is compiled only once.
a. True b. False

42. Which method Drops all changes made since the previous commit/rollback?
a. public void rollback() b. public void commit()
c. public void close() d. public Statement createStatement()

43. The intent is for JDBC drivers to implement nonscrollable result sets using the support provided by the underlying database
systems.
a. True b. False

44. Which methods returns a stream that simply provides the raw bytes from the database without any conversion?
a. getCharacterStream b. getBinaryStream c. getAsciiStream d. getUnicodeStream

45. Which of the following is a JDBC batch update?


A. A way to execute multiple SQL statements at once.
B. A way to improve the performance of bulk database operations.
C. Both A and B.
D. None of the above.

46. Which of the following is not a JDBC driver?


A. MySQL Connector/J B. PostgreSQL JDBC Driver
C. Microsoft SQL Server JDBC Driver D. ODBC Driver
47. Which of the following is used to close a JDBC connection?
A. Connection.close() B. Statement.close() C. PreparedStatement.close() D. ResultSet.close()
48. Where is metadata stored in MySQL.
A) in the MySQL database metadata B)In the MySQL database metasql C)In the MySQL database mysql

49. Which JDBC driver types can you use in a three-tier architecture and if the web server and the DBMS are running on the same
machine.
a)Type 1 b)Type 2 c)Type 3 and 4 d)Type 1, Type 2, Type 3 and Type 4

50. Which driver Network connection is indirect that a JDBC client makes to a middleware process that acts as a bridge to the
DBMS server?
a)JDBC-NET b)JDBC-ODBC Bridge c)Native api as basis d)native protocol as basis

51. Which of the following is correct about JDBC?


a)JDBC Architecture decouples an abstraction from its implementation b)JDBC Follows a bridge design pattern
c)both of the above d)none of the above\

53. Which of the following is used to execute an SQL query in JDBC?


A. Statement.executeQuery() B. Connection.executeQuery()
C. PreparedStatement.executeQuery() D. ResultSet.executeQuery()

54. What must be the first characters of a database URL?


a)db, b)db; c)jdbc, d)odbc

55. What is, in terms of JDBC, a DataSource?


a) A DataSource is the basic service for managing a set of JDBC drivers
b) A DataSource is the Java representation of a physical data source
c) A DataSource is a registry point for JNDI-services
d) A DataSource is a factory of connections to a physical data source

56. Which of the following is a benefit of database normalization?


A. It can improve the performance of database applications.
B. It can reduce the amount of data that needs to be stored in the database.
C. It can make the database easier to maintain and update.
D. All of the above

57. Which of the following is a type of database join?


A. INNER JOIN B. LEFT JOIN C. RIGHT JOIN D. All of the above

58. Which of the following is a database normalization form?


A. 1NF B. 2NF C. 3NF D. All of the above

59. Which of the following describes the correct sequence of the steps involved in making a connection with a database.
1. Loading the driver 2. Process the results.
3. Making the connection with the database. 4. Executing the SQL statements.
A. 1,3,4,2 B. 1,2,3,4 C. 2,1,3,4 D. 4,1,2,3

60. All raw data types (including binary documents or images) should be read and uploaded to the database as an array of
a. byte b. int c. Boolean d. char

61. Which of the following is a connection pool?


A. A set of connections to a database that can be reused by multiple threads
B. A type of database that is optimized for performance

62. Which statement type is used to execute SQL queries that do not return results, such as INSERT, UPDATE, and DELETE
statements?
A. PreparedStatement B. Statement

63. Which method is used to commit a transaction in JDBC?


A. commit() B. rollback()

You might also like