πŸ§ͺ JDBC MCQ Quiz Hub

JDBC Mcq Set 1

Choose a topic to test your knowledge and improve your JDBC skills

What are the major components of the JDBC?





βœ… Correct Answer: 1

Select the packages in which JDBC classes are defined?





βœ… Correct Answer: 4

Thin driver is also known as?





βœ… Correct Answer: 3

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.





βœ… Correct Answer: 2

Which of the following method is used to perform DML statements in JDBC?





βœ… Correct Answer: 3

How many transaction isolation levels provide the JDBC through the Connection interface?





βœ… Correct Answer: 2

Which of the following method is static and synchronized in JDBC API?





βœ… Correct Answer: 1

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





βœ… Correct Answer: 4

Parameterized queries can be executed by?





βœ… Correct Answer: 2

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





βœ… Correct Answer: 3

Identify the isolation level that prevents the dirty in the JDBC Connection class?





βœ… Correct Answer: 2

What does setAutoCommit(false) do?





βœ… Correct Answer: 2

Stored procedure can be called by using the ????..?





βœ… Correct Answer: 2

What should be the correct order to close the database resource?What should be the correct order to close the database resource?





βœ… Correct Answer: 4

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





βœ… Correct Answer: 1

Which JDBC driver can be used in servlet and applet both?





βœ… Correct Answer: 4

JDBC-ODBC driver is also known as?





βœ… Correct Answer: 3

Which of the following driver is the fastest one?





βœ… Correct Answer: 4

Which of the following is not a type of ResultSet object?





βœ… Correct Answer: 2

What is JDBC Savepoint?





βœ… Correct Answer: 1

How many stages are used by Java programmers while using JDBC in their programs?





βœ… Correct Answer: 2

Which of the following is the correct to register a JdbcOdbcDriver?





βœ… Correct Answer: 1

How many ways to register a driver?





βœ… Correct Answer: 3

Identify the DSN in the following statement: DriverManager.getConnection("jdbc:odbc:oradsn", "scott", "tiger")





βœ… Correct Answer: 4

Which statement is correct if we want to connect the Oracle database using the thin driver provided by Oracle Corp.?





βœ… Correct Answer: 1

What are the types of ResultSet in JDBC?





βœ… Correct Answer: 1

What is blob in the following statement? create table profilepic(photo blob);





βœ… Correct Answer: 3

Which data type is used to store files in the database table?





βœ… Correct Answer: 2

DatabaseMetaData interface is used to get?????..?





βœ… Correct Answer: 1

Which of the following driver converts the JDBC calls into database-specific calls?





βœ… Correct Answer: 2

Are ResultSets updateable?





βœ… Correct Answer: 2

Which of the following interface provides the commit() and rollback() methods?





βœ… Correct Answer: 3

How many statement objects can be created using a Connection?





βœ… Correct Answer: 4

JDBC API supports____________ and __________ architecture model for accessing the database.





βœ… Correct Answer: 3

Which statement(s) is/ are true about transactions? i. A transaction is a set of one or more SQL statements that make up a logical unit of work. ii. A transaction ends with either a commit or a rollback, depending on whether there are any problems with data consistency or data concurrency. iii. A lock is a mechanism that allows two transactions from manipulating the same data at the same time. iv. To avoid conflicts during a transaction, a DBMS uses locks, mechanisms for blocking access by others to the data that is being accessed by the transaction.





βœ… Correct Answer: 3

Which of the following contains both date and time?





βœ… Correct Answer: 4

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





βœ… Correct Answer: 4

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





βœ… Correct Answer: 3

Which one of the following contains date information?





βœ… Correct Answer: 1

Which of the following is used to call stored procedure?





βœ… Correct Answer: 3

Which of the following is used to limit the number of rows returned?





βœ… Correct Answer: 1

Which of the following is method of JDBC batch process?





βœ… Correct Answer: 4

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





βœ… Correct Answer: 1

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





βœ… Correct Answer: 4

How constructor can be used for a servlet?





βœ… Correct Answer: 3

Can servlet class declare constructor with ServletConfig object as an argument?





βœ… Correct Answer: 2

What is the difference between servlets and applets? i. Servlets execute on Server; Applets execute on browser ii. Servlets have no GUI; Applet has GUI iii. Servlets creates static web pages; Applets creates dynamic web pages iv. Servlets can handle only a single request; Applet can handle multiple requests





βœ… Correct Answer: 2

Which of the following code is used to get an attribute in a HTTP Session object in servlets?





βœ… Correct Answer: 1

Which method is used to get three-letter abbreviation for locale’s country in servlets?





βœ… Correct Answer: 1

Which of the following code retrieves the body of the request as binary data?





βœ… Correct Answer: 3