Unit6 - Subjective Questions

CSE310 • Practice Questions with Detailed Answers

1

What are Generics in Java? Explain how to create a collection using generics with a code example.

2

Explain the implementation of the ArrayList class. Discuss its performance in terms of access and manipulation time complexity.

3

Differentiate between the Comparable and Comparator interfaces in Java with respect to the TreeSet implementation.

4

Write a Java program to implement a TreeSet that stores Student objects (id, name) and sorts them by name using the Comparator interface.

5

Explain the internal working of a HashMap in Java. How are collisions handled?

6

What is a Deque? Explain the implementation of ArrayDeque with its advantages over LinkedList.

7

Explain the JDBC Architecture with the help of a diagrammatic representation description.

8

List and explain the four types of JDBC Drivers.

9

Why is the Type-4 JDBC driver considered the most efficient for web applications?

10

Outline the standard steps required to connect a Java application to a Database using JDBC.

11

Distinguish between Statement and PreparedStatement in JDBC. Which one protects against SQL Injection?

12

Write a JDBC code snippet to perform a CRUD Insert operation using PreparedStatement.

13

Explain the ResultSet interface. What are the differences between executeQuery, executeUpdate, and execute methods?

14

Write a Java program to retrieve and display data (Select operation) from a database table named Employees.

15

What is meant by connecting to 'Non-conventional Databases'? Explain how Java connects to NoSQL databases like MongoDB.

16

Differentiate between Array and ArrayList in Java.

17

Explain the different ways to iterate over a HashMap.

18

Explain the concept of Transaction Management in JDBC with the commit and rollback methods.

19

What is ListIterator? How is it different from Iterator?

20

What are the core interfaces of the Java Collections Framework? Briefly describe the hierarchy.