| ADVANCE JAVA (3360701) |
141) Which method is used to perform DML statements in JDBC?
A. executeQuery()
B. execute()
C. executeUpdate()
D. executeResult()
Answer : C
142) What is the disadvantage of Type-4 Native-Protocol Driver?
A. At client side, a separate driver is needed for each database.
B. Type-4 driver is entirely written in Java
C. The driver converts JDBC calls into vendor-specific database protocol
D. It does not support to read MySQL data.
Answer : A
143) When the message “No Suitable Driver” occurs?
A. When the driver is not registered by Class.forname () method
B. When the user name, password and the database does not match.
C. When the JDBC database URL passed is not constructed properly.
D. When the type 4 driver is used
Answer : C
144) Which driver is efficient and always preferable for using JDBC applications?
A. Type-1 driver
B. Type-2 driver
C. Type-3 driver
D. Type-4 driver
Answer : D
145) Which is driver called as thin-driver in JDBC?
A. Type-1 driver
B. Type-2 driver
C. Type-3 driver
D. Type-4 driver
Answer : D
146) JDBC Stands For
A. Java Database Component
B. Java Database Control
C. Java Database Connectivity
D. Java Data Oriented Connectivity
Answer : C
147) …………………… is an Open-Source DBMS Product that runs of Linux, UNIX and Windows.
A. JSP/SQL
B.JDBC/SQL
C.SUN/ACCESS
D.MYSQL
Answer : D
148) Which of the following is used to rollback a JDBC transaction?
A. rollback()
B. rollforward()
C. deleteTransaction()
D. RemoveTransaction()
Answer : A
149) Which JDBC driver Type(s) can be used in either applet or servlet code?
A. Both Type 1 and Type 2
B. Both Type 1 and Type 3
C. Both Type 3 and Type 4
D. Type 4 only.
Answer : C
150) Which of the following is used to call stored procedure?
A. Statement
B. PreparedStatement
C. CallableStatment
D. CalledStatement
Answer : C
151) Which of the following is advantage of using Prepared Statement in Java?
A. Slow performance
B. Encourages SQL injection
C. Prevents SQL injection
D. More memory usage
Answer : C
152) The method on the result set that tests whether or not there remains at least one unfetched tuple in the result set, is said to be
A. Fetch method
B. Current method
C. Next method
D. Access method
Answer : C
153) Which of the following statements is false as far as different type of statements is concern in JDBC?
A. Regular Statement
B. Interim Statement
C. Callable Statement
D. Prepared Statement
Answer : B
154) The JDBC-ODBC Bridge driver translates the JDBC API to the ODBC API and used with …….
A. JDBC drivers
B. ODBC drivers
C. Both A and B
D. None of the above
Answer : B
155) The database system compiles the query when it is
A. Executed
B. Initialized
C. Prepared
D. Invoked
Answer : C
156) How many JDBC driver types does Sun define?
A. One
B. Two
C. Three
D. Four
Answer : D
157) The ……………… object provides you with methods to access data from the table.
A. ResultSet
B. Parameterized
C. TableStatement
D. Condition
Answer : A
158) The JDBC-ODBC Bridge is
A. Multithreaded
B. Single threaded
C. Both of the above
D. none of the above
Answer : A
159) The ………………………….. Method executes a simple query and returns a single Result Set object
A. executeUpdate()
B. executeQuery()
C. execute()
D. noexecute()
Answer : A
160) Which of the following methods are needed for loading a database driver in JDBC?
A. registerDriver() method
B. Class.forName()
C. Both A and B
D. getConnection()
Answer : C
161) Which one of the following contains date information?
A. java.sql.TimeStamp
B. java.sql.Time
C. java.io.Time
D. java.io.TimeStamp
Answer : C
162) Full Form of UDA?
A. Unified Data Access
B. Universal Data Access
C. Universal Digital Access
D. Uniform Data Access
Answer : B
163) What is the use of blob, clob data types in JDBC?
A. These are used to store large amount of data into database like images, movie etc. which are extremely large in size.
B. These are used to store XML data.
C. Both of the above.
D. None of the above.
Answer : A
164) You can open only one Statement object per connection when you are using the JDBC-ODBC Bridge.
A. True
B. False
Answer : A
165) Which of the following is first step to create a JDBC Application?
A. Import packages containing the JDBC classes needed for database programming.
B. Register the JDBC driver, so that you can open a communications channel with the database.
C. Open a connection using the DriverManager.getConnection () method.
D. Execute a query using an object of type Statement.
Answer : A
166) Which of the following is correct about transactions in JDBC?
A. A transaction is a logical unit of work.
B. To complete a logical unit of work, several actions may need to be taken against a database.
C. Transactions are used to provide data integrity, correct application semantics, and a consistent view of data during concurrent access.
D. All of the above.
Answer : D
167) Which of the following is correct about Class.forName() method call?
A. This method dynamically loads the driver’s class file into memory, which automatically registers it.
B. This method is preferable because it allows you to make the driver registration configurable and portable.
C. Both of the above.
D. None of the above.
Answer : C
168) Which of the following is not a component/class of JDBC API?
A. Statement
B. ResultSet
C. SQLException
D. ConnectionPool
Answer : D
169) 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
Answer : A
170) 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. jdbc and java.jdbc.sql
Answer : D
171) What is the correct sequence to create a database connection?
- What is the correct sequence to create a database connection?
- Import JDBC packages.
- Open a connection to the database.
- Load and register the JDBC driver.
- Execute the statement object and return a query resultset.
- Create a statement object to perform a query.
- Close the resultset and statement objects.
- Process the resultset.
- 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
Answer: B
172) How many transaction isolation levels provide the JDBC through the Connection interface?
A. 3
B. 4
C. 7
D. 2
Answer: B
173)Which of the following method is static and synchronized in JDBC API?
A. getConnection()
B. prepareCall()
C. executeUpdate()
D. executeQuery()
Answer: A
174) Which methods are required to load a database driver in JDBC?
A. getConnection()
B. registerDriver()
C. forName()
D. Both b and c
Answer: D
175) Parameterized queries can be executed by?
A. ParameterizedStatement
B. PreparedStatement
C. CallableStatement and Parameterized Statement
D. All kinds of Statements
Answer: B
176) Which of the following is not a valid statement in JDBC ?
A. Statement
B. PreparedStatement
C. QueryStatement
D. CallableStatement
Answer: C
177) 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.
Answer: B
178) 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
Answer: A
179) Which JDBC driver can be used in servlet and applet both?
A. Type 3
B. Type 4
C. Type 3 and Type 2
D. Type 3 and Type 4
Answer: D
180) JDBC-ODBC driver is also known as?
A. Type 4
B. Type 3
C. Type 1
D. Type 2
Answer: C
181) Which of the following driver is the fastest one?
A. JDBC-ODBC Bridge Driver
B. Native API Partly Java Driver
C. Network Protocol Driver
D. JDBC Net Pure Java Driver
Answer: D
182) What is JDBC Savepoint?
A. An intermediate or checkpoint in a transaction
B. A point where we can store queries
C. A point where the JDBC application starts execution
D. A memory where we can store transaction
Answer: A
183) How many stages are used by Java programmers while using JDBC in their programs?
A. 3
B. 2
C. 5
D. 6
Answer: D
184) Which of the following is the correct to register a JdbcOdbcDriver?
A. jdbc.odbc.JdbcOdbcDriver obj = new sun.jdbc.odbc.JdbcOdbcDriver();
B. odbc.JdbcOdbcDriver obj = new sun.odbc.JdbcOdbcDriver();
C. jdbc.JdbcOdbcDriver obj = new sun.jdbc.JdbcOdbcDriver();
D. jdbc.odbc.JdbcOdbc obj = new sun.jdbc.odbc.JdbcOdbc();
Answer: A
185) Which of the following driver converts the JDBC calls into database-specific calls?
A. JDBC-ODBC Bridge Driver (Type 1)
B. Native API-partly Java Driver (Type 2)
C. Net Protocol-pure Java Driver (Type 3)
D. Native Protocol-pure Java Driver (Type 4)
Answer: B
186) JDBC API supports and architecture model for accessing the database.
A. Two-tier
B. Three-tier
C. Both a and b
D. Only b
Answer: C
187) Which of the following is correct about Statement class of JDBC ?
A. Statement encapsulates an SQL statement which is passed to the database to be parsed and compiled.
B. Statement encapsulates an SQL statement which is passed to the database to be planned and executed.
C. Both of the above.
D. None of the above.
Answer: C
188) Which of the following type of JDBC driver, uses database native protocol?
A. JDBC-ODBC Bridge plus ODBC driver
B. Native-API, partly Java driver
C. JDBC-Net, pure Java driver
D. Native-protocol, pure Java driver
Answer: D
189) Which method is used to establish the connection with the specified url in a Driver Manager class?
A. public static void registerDriver(Driver driver)
B. public static void deregisterDriver(Driver driver)
C. public static Connection getConnection(String url)
D. public static Connection getConnection(String url,String userName,String password)
Answer: C
190) JDBC RowSet is the wrapper of ResultSet,It holds tabular data like ResultSet but it is easy and flexible to use.
A. True
B. False
Answer: A
191) Which interfaces provide methods for batch processing in JDBC?
A. java.sql.Statement
B. java.sql.PreparedStatement
C. All the above
D. None of the above
Answer: C
192) The performance of the application will be faster if you use PreparedStatement interface because query is compiled only once.
A. True
B. False
Answer: A
193) Which method is used for an SQL statement that is executed frequently?
A. prepareStatement
B. prepareCall
C. createStatement
D. None of the above
Answer: A
194) Which JDBC product components does the Java software provide?
A. The JDBC driver manager
B. The JDBC driver test suite
C. The JDBC-ODBC bridge
D. All mentioned above
Answer: D
195) 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
Answer: D
196) 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
Answer: C
197) What happens if you call deleteRow() on a ResultSet object?
A. The row you are positioned on is deleted from the ResultSet, but not from the database
B. The row you are positioned on is deleted from the ResultSet and from the database
C. The result depends on whether the property synchronizeWithDataSource is set to true or false
D. You will get a compile error: the method does not exist because you cannot delete rows from a ResultSet
Answer : B
198) Which type of Statement can execute parameterized queries?
A. PreparedStatement
B. ParameterizedStatement
C. ParameterizedStatement and CallableStatement
D. All kinds of Statements (i.e. which implement a sub interface of Statement)
Answer : A
199) Which of the following encapsulates an SQL statement which is passed to the database to be parsed, compiled, planned and executed?
A. DriverManager
B. JDBC driver
C. Connection
D. Statement
Answer : D
200) 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
Answer : D
201) Which packages contain the JDBC classes?
A. java.jdbc and javax.jdbc
B. java.jdbc and java.jdbc.sql
C. java.sql and javax.sql
D. java.rdb and javax.rdb
Answer : C
202) Which of the following is not a Common JDBC Components
A. JDBC API
B. JDBC Test Suit.
C. JDBC-ODBC Bridge
D. OracleDriver
Answer : D
203) How many main interfaces available in JDBC API ?
A. 3
B. 2
C. 1
D. 4
Answer : D
204) Which of the following is a Common JDBC API Components?
A. DriverManager
B. Driver
C. Connection
D. All the above
Answer : D
205) Which of the following is a Main drawback in JDBC
A. Exception Handling
B. ResultSet is not a serializable in JDBC
C. RawSet is a serializable in JDBC
D. Properly closing the connection.
Answer : A
206) What are the common JDBC Exceptions?
A. java.sql.SQLExceptions
B. java.sql.BatchUpdateException
C. java.sql.SQLWarning
D. All the above
Answer : D
207) Which of the following is a advanced features of JDBC 4.0 ?
A. Support for large object
B. Better Exception handling
C. Both A and B
D. None of the above
Answer : C
208) Where is metadata stored in MySQL?
A. In the MySQL database metadata
B. In the MySQL database metasql
C. In the MySQL database mysql
D. None of the above is correct
Answer: C
209) How many different types of ResultSet ?
A. 5
B. 6
C. 3
D. 4
Answer: A
210) What are the different types of ResultSet ?
A. ResultSet.TYPE_FORWARD_ONLY
B. ResultSet.TYPE_SCROLL_INSENSITIVE
C. ResultSet.TYPE_SCROLL_SENSITIVE
D. All are above
Answer: D
211) Which of the following is an interfaces of JDBC ?
A. java.sql.Date
B. java.sql.DatabaseMetaData
C. A and B both
D. None of the above
Answer: C