Java JDBC Quiz 1 | JDBC online test, Online practice Test
Finish Quiz
0 of 20 questions completed
Questions:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
Information
Java JDBC Quiz 1 | JDBC online test, Online practice Test. Free Java JDBC Quiz. The purpose of this Free Java online test is to help you evaluate your JDBC knowledge yourself via online mode.
This paper has 20 questions.
Time allowed is 25 minutes.
The Java JDBC Mock Test is Very helpful for all students. Now Scroll down below n click on “Start Quiz” or “Start Test” and Test yourself.
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading...
You must sign in or sign up to start the quiz.
You have to finish following quiz, to start this quiz:
Results
0 of 20 questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 points, (0)
Average score |
|
Your score |
|
Categories
- Not categorized 0%
Pos. | Name | Entered on | Points | Result |
---|---|---|---|---|
Table is loading | ||||
No data available | ||||
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- Answered
- Review
-
Question 1 of 20
1. Question
Which of the following is correct about driver interface of JDBC?
Correct
JDBC driver is an interface enabling a Java application to interact with a database. To connect with individual databases, JDBC requires drivers for each database. The JDBC driver gives out the connection to the database and implements the protocol for transferring the query and result between client and database.
Incorrect
JDBC driver is an interface enabling a Java application to interact with a database. To connect with individual databases, JDBC requires drivers for each database. The JDBC driver gives out the connection to the database and implements the protocol for transferring the query and result between client and database.
-
Question 2 of 20
2. Question
Which of the following encapsulates an SQL statement which is passed to the database to be parsed, compiled, planned and executed?
Correct
Statement encapsulates an SQL statement which is passed to the database to be parsed, compiled, planned and executed.
Incorrect
Statement encapsulates an SQL statement which is passed to the database to be parsed, compiled, planned and executed.
-
Question 3 of 20
3. Question
Which of the following type of JDBC driver should be used where a type 3 or type 4 driver is not available yet for your database?
Correct
Type 2 drivers are useful in situations where a type 3 or type 4 driver is not available yet for your database.
Incorrect
Type 2 drivers are useful in situations where a type 3 or type 4 driver is not available yet for your database.
-
Question 4 of 20
4. Question
Which of the following type of JDBC driver is the fastest one?
Correct
JDBC Net pure Java driver(Type 4) is the fastest driver because it converts the JDBC calls into vendor specific protocol calls and it directly interacts with the database.
Incorrect
JDBC Net pure Java driver(Type 4) is the fastest driver because it converts the JDBC calls into vendor specific protocol calls and it directly interacts with the database.
-
Question 5 of 20
5. Question
Which of the following is used to call stored procedures on the database?
Correct
CallableStatement is used to call stored procedures on the database.
Incorrect
CallableStatement is used to call stored procedures on the database.
-
Question 6 of 20
6. Question
Which of the following is correct about transactions in JDBC?
Correct
A transaction is a logical unit of work. To complete a logical unit of work, several actions may need to be taken against a database. Transactions are used to provide data integrity, correct application semantics, and a consistent view of data during concurrent access.
Incorrect
A transaction is a logical unit of work. To complete a logical unit of work, several actions may need to be taken against a database. Transactions are used to provide data integrity, correct application semantics, and a consistent view of data during concurrent access.
-
Question 7 of 20
7. Question
Which of the following is correct about connection pooling?
Correct
Connection Pooling is a technique used for reuse of physical connections and reduced overhead for your application. Connection pooling functionality minimizes expensive operations in the creation and closing of sessions.
Incorrect
Connection Pooling is a technique used for reuse of physical connections and reduced overhead for your application. Connection pooling functionality minimizes expensive operations in the creation and closing of sessions.
-
Question 8 of 20
8. Question
Which of the following is first step to create a JDBC application?
Correct
First step is to import packages containing the JDBC classes needed for database programming.
Incorrect
First step is to import packages containing the JDBC classes needed for database programming.
-
Question 9 of 20
9. Question
Which isolation level prevents dirty read in JDBC, connection class?
Correct
TRANSACTION_READ_COMMITTED prevents dirty read in JDBC, connection class.
Incorrect
TRANSACTION_READ_COMMITTED prevents dirty read in JDBC, connection class.
-
Question 10 of 20
10. Question
Prepared statements are more secure because they use bind variables, which can prevent SQL injection attack.
Correct
Prepared statements are more secure because they use bind variables, which can prevent SQL injection attack.
Incorrect
Prepared statements are more secure because they use bind variables, which can prevent SQL injection attack.
-
Question 11 of 20
11. Question
To execute a stored procedure “totalStock” in a database server, which of the following code snippet is used?
Correct
A CallableStatement can return one ResultSet object or multiple ResultSet objects. Multiple ResultSet objects are handled using operations inherited from Statement. To execute a stored procedure “totalstock” in a database server the snippet used is as follows:
CallableStatement clbstmnt = con.prepareCall(“{call totalStock}”); cs.executeQuery();
To have maximum portability, ResultSet objects and update counts should be processed prior to getting the values of output parameters.
Incorrect
A CallableStatement can return one ResultSet object or multiple ResultSet objects. Multiple ResultSet objects are handled using operations inherited from Statement. To execute a stored procedure “totalstock” in a database server the snippet used is as follows:
CallableStatement clbstmnt = con.prepareCall(“{call totalStock}”); cs.executeQuery();
To have maximum portability, ResultSet objects and update counts should be processed prior to getting the values of output parameters.
-
Question 12 of 20
12. Question
Which driver is efficient and always preferable for using JDBC applications?
Correct
Type 4 Driver is a Database-Protocol Driver(Pure Java Driver). Its implementation allows the conversion of JDBC calls directly into a vendor-specific database protocol. They are installed inside JVM or Java Virtual Machine on the client side system. It is better in performance than type 1 and type 2 drivers as it does not have the overhead of conversion of calls into ODBC or database API calls. It doesn’t require to be associated with the software to work. The advantage of type-4 is that it gets completely implemented in Java to achieve platform independence.
Incorrect
Type 4 Driver is a Database-Protocol Driver(Pure Java Driver). Its implementation allows the conversion of JDBC calls directly into a vendor-specific database protocol. They are installed inside JVM or Java Virtual Machine on the client side system. It is better in performance than type 1 and type 2 drivers as it does not have the overhead of conversion of calls into ODBC or database API calls. It doesn’t require to be associated with the software to work. The advantage of type-4 is that it gets completely implemented in Java to achieve platform independence.
-
Question 13 of 20
13. Question
JDBC facilitates to store the java objects by using which of the methods of PreparedStatement
1. setObject ()
2. setBlob()
3. setClob()Correct
PreparedStatement object are used for the ease of calling the methods or for sending SQL statements to the database. It is a special type of statement derived from the more general class, Statement. It reduces the execution time when a statement object needs to be executed many times. JDBC uses methods like:
1) setobject() – The setObject( ) method can insert Java object types into the database, provided that those objects can be converted to standard SQL types.
2) setBlob()
3) setClob()to store the java objects. PreparedStatement object contains not just a SQL statement, but a precompiled SQL statement.
Incorrect
PreparedStatement object are used for the ease of calling the methods or for sending SQL statements to the database. It is a special type of statement derived from the more general class, Statement. It reduces the execution time when a statement object needs to be executed many times. JDBC uses methods like:
1) setobject() – The setObject( ) method can insert Java object types into the database, provided that those objects can be converted to standard SQL types.
2) setBlob()
3) setClob()to store the java objects. PreparedStatement object contains not just a SQL statement, but a precompiled SQL statement.
-
Question 14 of 20
14. Question
Which statement is static and synchronized in JDBC API?
Correct
JDBC API is used to access a database from a Java application. In this case user need to provide the code to register the installed driver with the program. SQL driver manager is used with static registerDriver(). This class provides the basic requirements and methods to assign the JDBC drivers. getConnection() method allows the program to get the connection to run the program. This method takes the following structure:
getConnection(String URL);
Where the URL is of the form:
jdbc:oracle:: / @ 1)URL
2)UserName – scott
3)Password – tigerIncorrect
JDBC API is used to access a database from a Java application. In this case user need to provide the code to register the installed driver with the program. SQL driver manager is used with static registerDriver(). This class provides the basic requirements and methods to assign the JDBC drivers. getConnection() method allows the program to get the connection to run the program. This method takes the following structure:
getConnection(String URL);
Where the URL is of the form:
jdbc:oracle:: / @ 1)URL
2)UserName – scott
3)Password – tiger -
Question 15 of 20
15. Question
The JDBC-ODBC bridge is
Correct
No. The JDBC-ODBC Bridge does not support concurrent access from different threads. The JDBC-ODBC Bridge uses synchronized methods to serialize all of the calls that it makes to ODBC. Multi-threaded Java programs may use the Bridge, but they won’t get the advantages of multi-threading. In addition, deadlocks can occur between locks held in the database and the semaphore used by the Bridge.
Incorrect
No. The JDBC-ODBC Bridge does not support concurrent access from different threads. The JDBC-ODBC Bridge uses synchronized methods to serialize all of the calls that it makes to ODBC. Multi-threaded Java programs may use the Bridge, but they won’t get the advantages of multi-threading. In addition, deadlocks can occur between locks held in the database and the semaphore used by the Bridge.
-
Question 16 of 20
16. Question
All raw data types (including binary documents or images) should be read and uploaded to the database as an array of
Correct
Any data type reads and uploaded itself as an array of byte. Byte is an 8-bit signed two’s complement integer which wraps a value used a primitive type byte in an object. Object of type byte consists of a single field whose type is byte. It also provides several methods for converting a byte to a String and a String to a byte, as well as other constants and methods useful when dealing with a byte. It is also useful for saving memory in large arrays.
Incorrect
Any data type reads and uploaded itself as an array of byte. Byte is an 8-bit signed two’s complement integer which wraps a value used a primitive type byte in an object. Object of type byte consists of a single field whose type is byte. It also provides several methods for converting a byte to a String and a String to a byte, as well as other constants and methods useful when dealing with a byte. It is also useful for saving memory in large arrays.
-
Question 17 of 20
17. Question
The class java.sql.Timestamp has its super class as
Correct
TimeStamp has the super class as Date which represents a specific instant in time, with millisecond precision. It allows the date to include year, month, day, hour, minute, and second values. It also allowed the formatting and parsing of date strings. The Calendar class is used to convert between dates and time fields and the DateFormat class is used to format and parse date strings. Although the Date class is intended to reflect coordinated universal time (UTC).
Incorrect
TimeStamp has the super class as Date which represents a specific instant in time, with millisecond precision. It allows the date to include year, month, day, hour, minute, and second values. It also allowed the formatting and parsing of date strings. The Calendar class is used to convert between dates and time fields and the DateFormat class is used to format and parse date strings. Although the Date class is intended to reflect coordinated universal time (UTC).
-
Question 18 of 20
18. Question
BLOB, CLOB, ARRAY and REF type columns can be updated in
Correct
JDBC 3.0 provide an updation classes for BLOB, CLOB, ARRAY and REF functions. It fills up smaller areas of missing functionality. The following list outlines the goals and design for the JDBC API in general and the JDBC 3.0 API:
1. It Fit into the J2EE and J2SE platforms
The JDBC API is a constituent technology of the Java platform. The JDBC 3.0 API should be aligned with the overall direction of the Java 2 Enterprise Edition and Java 2 Standard Edition platforms.
2. It is consistent with SQL99
The JDBC API provides programmatic access from applications written in the Java programming language to standard SQL. SQL99 is now a published standard and includes features that are widely supported among DBMS vendors as well as features that only a few vendors support.
3. Consolidate predecessor specifications
This document incorporates content from three prior JDBC specifications to provide a single standalone specification of the JDBC API.
4. It offers vendor-neutral access to common featureIncorrect
JDBC 3.0 provide an updation classes for BLOB, CLOB, ARRAY and REF functions. It fills up smaller areas of missing functionality. The following list outlines the goals and design for the JDBC API in general and the JDBC 3.0 API:
1. It Fit into the J2EE and J2SE platforms
The JDBC API is a constituent technology of the Java platform. The JDBC 3.0 API should be aligned with the overall direction of the Java 2 Enterprise Edition and Java 2 Standard Edition platforms.
2. It is consistent with SQL99
The JDBC API provides programmatic access from applications written in the Java programming language to standard SQL. SQL99 is now a published standard and includes features that are widely supported among DBMS vendors as well as features that only a few vendors support.
3. Consolidate predecessor specifications
This document incorporates content from three prior JDBC specifications to provide a single standalone specification of the JDBC API.
4. It offers vendor-neutral access to common feature -
Question 19 of 20
19. Question
Which of the following methods finds the maximum number of connections that a specific driver can obtain?
Correct
DatabaseMetaData.getMaxConnections – Retrieves the maximum number of concurrent connections to this database that are possible. The interface is implemented by the driver vendors which let the users know the capabilities of a Database Management System (DBMS) in combination with the driver based on JDBCTM technology (“JDBC driver”) that is used with it.
Information is usually returned by methods in the interface and it applies to the capabilities of a particular driver and a particular DBMS which is working together.
Incorrect
DatabaseMetaData.getMaxConnections – Retrieves the maximum number of concurrent connections to this database that are possible. The interface is implemented by the driver vendors which let the users know the capabilities of a Database Management System (DBMS) in combination with the driver based on JDBCTM technology (“JDBC driver”) that is used with it.
Information is usually returned by methods in the interface and it applies to the capabilities of a particular driver and a particular DBMS which is working together.
-
Question 20 of 20
20. Question
Are prepared statements actually compiled?
Correct
PreparedStatement object are used for sending SQL statements to the database. It is a special type of statement derived from the more general class, Statement. If any execution of Statement object needs to be done many times then the PreparedStatement object reduces the time considerably. PreparedStatement uses SQL statements to send the data to DBMS right away after being compiled. It just not contain SQL statement, but a SQL statement that has been precompiled. This means that when the PreparedStatement is executed, the DBMS can just run the PreparedStatement SQL statement without having to compile it first.
Incorrect
PreparedStatement object are used for sending SQL statements to the database. It is a special type of statement derived from the more general class, Statement. If any execution of Statement object needs to be done many times then the PreparedStatement object reduces the time considerably. PreparedStatement uses SQL statements to send the data to DBMS right away after being compiled. It just not contain SQL statement, but a SQL statement that has been precompiled. This means that when the PreparedStatement is executed, the DBMS can just run the PreparedStatement SQL statement without having to compile it first.