🧪 JDBC MCQ Quiz Hub

JDBC Mcq Set 1

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

1. What are the major components of the JDBC?




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




3. Thin driver is also known as?




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




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




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




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




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




9. Parameterized queries can be executed by?




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




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




12. What does setAutoCommit(false) do?




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




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




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




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




17. JDBC-ODBC driver is also known as?




18. Which of the following driver is the fastest one?




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




20. What is JDBC Savepoint?




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




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




23. How many ways to register a driver?




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




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




26. What are the types of ResultSet in JDBC?




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




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




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




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




31. Are ResultSets updateable?




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




33. How many statement objects can be created using a Connection?




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




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




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




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




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




39. Which one of the following contains date information?




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




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




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




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




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




45. How constructor can be used for a servlet?




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




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




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




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




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