0% found this document useful (0 votes)
15 views3 pages

Java Programming Unit 6 Question Bank

The document is a question bank for a Java programming unit focused on interacting with databases using JDBC. It includes 2-mark, 4-mark, and 6-mark questions covering topics such as JDBC architecture, driver types, PreparedStatement, and transaction management. Additionally, it lists practical programming exercises to reinforce the concepts learned.
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)
15 views3 pages

Java Programming Unit 6 Question Bank

The document is a question bank for a Java programming unit focused on interacting with databases using JDBC. It includes 2-mark, 4-mark, and 6-mark questions covering topics such as JDBC architecture, driver types, PreparedStatement, and transaction management. Additionally, it lists practical programming exercises to reinforce the concepts learned.
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/ 3

k·s

Diplomatech Academy
Java programming unit 5
Vviimp Question bank
:

� UNIT VI – INTERACTING WITH DATABASE

� 2 MARK QUESTIONS (� Total: 20)

Common & Previous-Asked:

1. Define JDBC.
2. What is ODBC?
3. Write any two differences between JDBC and ODBC.
4. State the function of DriverManager class.
5. List any two JDBC interfaces.
6. What is the use of Connection interface in JDBC?
7. Define two-tier architecture.
8. What is a JDBC driver?
9. State any two types of JDBC drivers.
10. What is the role of Statement interface?

� New / Expected Additions:

11. Write the syntax to load and register JDBC driver.


12. What is executeUpdate() method used for?
13. State the role of ResultSet in JDBC.
14. Write the steps to execute a SQL query using JDBC.
15. What is meant by a PreparedStatement in JDBC?
16. What is SQL Injection?
17. List any two limitations of ODBC in Java.
18. Mention any two advantages of JDBC.
19. What is the use of setAutoCommit(false) in JDBC?
20. What is connection pooling?

� 4 MARK QUESTIONS (� Total: 15)

� Common & Important:


k·s

1. Explain JDBC architecture with diagram.


2. Differentiate between two-tier and three-tier JDBC models.
3. Describe the use of DriverManager, Connection, and Statement.
4. Explain PreparedStatement interface with syntax.
5. Differentiate between Statement and PreparedStatement.
6. List and explain types of JDBC drivers.
7. Explain how data is retrieved using ResultSet.
8. Write steps to insert a record into a table using JDBC.
9. Write a code snippet to display all data from a table using Statement.
10. What are the advantages of using PreparedStatement over Statement?

� New / Likely to be Asked:

11. Explain exception handling in JDBC with try-catch-finally.


12. Write a program that inserts a student record using PreparedStatement.
13. Explain how transactions are handled in JDBC.
14. What is connection pooling? How is it better than single connections?
15. Describe the use of ResultSetMetaData with an example.

� 6 MARK QUESTIONS (� Total: 15)

� Board-Focused & Conceptual:

1. Describe JDBC architecture (two-tier and three-tier) with diagrams.


2. Explain all types of JDBC drivers with advantages and disadvantages.
3. Write a complete JDBC program to insert, display, and delete data from student table.
4. Explain the use and working of:
o DriverManager
o Connection
o Statement
o PreparedStatement
o ResultSet
5. Write a JDBC program to retrieve records and handle exceptions.
6. Write a full program to update student marks using PreparedStatement.

� High-Level New & Expected:

7. Explain transaction management in JDBC with code (commit, rollback).


8. Write a program to prevent SQL injection using PreparedStatement.
9. Compare JDBC vs ODBC in tabular form with at least 4 points.
10. Explain the internal working of executeQuery() and executeUpdate().
11. What are batch updates in JDBC? Write a sample program.
12. Explain the role of metadata (DatabaseMetaData, ResultSetMetaData).
13. Write a JDBC program to count records and show column names.
k·s

14. Explain how JDBC handles database portability.


15. Write a JDBC program to search a student by roll number.

� PROGRAMMING / PRACTICAL / VIVA (� Total: 20)

� Must-Practice Core Programs:

1. Program to connect to MySQL database using JDBC.


2. Program to insert a student record using PreparedStatement.
3. Program to display all rows from a table using ResultSet.
4. Program to update a record in a table using JDBC.
5. Program to delete a record using PreparedStatement.
6. Program to handle SQLException in JDBC operations.
7. CRUD Application: Insert, Display, Update, Delete using JDBC.
8. Program to demonstrate difference between Statement and PreparedStatement.
9. Program to fetch records using WHERE clause from user input.
10. Program to read ResultSet and print in formatted output.

� Additional Expected / Real-World Usage:

11. JDBC program to prevent SQL Injection.


12. JDBC program to use setAutoCommit(false) and perform transaction rollback.
13. Program to show metadata info (column names, types).
14. Program to count total records in a table.
15. Program to check if a record exists before inserting.
16. Program to insert multiple rows using batch update.
17. Program to sort data retrieved using SQL ORDER BY clause.
18. JDBC program to read values from console using Scanner and save into DB.
19. Program to read and print only specific fields (e.g., name and marks).
20. Program to connect to database and list all table names using metadata.

You might also like