RRIT, Department of ISE 2023-24
1. ArrayList Operations in Java
1. What is an ArrayList in Java, and how is it different from an array?
2. Explain the methods used to add and remove elements from an ArrayList.
3. How do you sort elements in an ArrayList? Name the method used.
4. What is the purpose of the toArray() method in ArrayList?
5. Can an ArrayList store primitive data types? If not, how can you store them?
6. How does ArrayList handle dynamic resizing?
7. What is the difference between remove(int index) and remove(Object o) in ArrayList?
8. How can you iterate over an ArrayList?
9. What happens if you try to remove an element from an empty ArrayList?
10. How can you check if an ArrayList contains a specific element?
2. Sorting Random Numbers Using Comparator
1. How do you generate random numbers in a given range in Java?
2. What is the purpose of using a Comparator in sorting?
3. How do you check if a number is a multiple of 2 and 5?
4. Explain how you sorted numbers based on their tens place.
5. What is the difference between Comparable and Comparator?
6. How would you modify the program to sort numbers in descending order?
7. Can you use a lambda expression instead of a Comparator? If yes, how?
8. What happens if two numbers have the same tens digit?
9. How do you ensure that only valid numbers (multiples of 2 and 5) are added to the list?
10. What is the time complexity of the sorting algorithm used in this program?
3. Storing User-Defined Classes in Collection
1. What is a user-defined class in Java?
2. How do you store objects of a user-defined class in a collection?
3. Why should a user-defined class override equals() and hashCode() methods when stored in a collection?
4. Can you store a user-defined class in a TreeSet? What are the requirements?
5. How do you retrieve objects from a collection based on a condition?
6. What is the difference between List and Set when storing user-defined objects?
7. How can you make a user-defined class immutable?
Dr. Vinay Gangaraju Page 42 of 46
RRIT, Department of ISE 2023-24
8. What happens if you add duplicate objects in a HashSet?
9. How do you sort a collection of user-defined objects?
10. What is the role of compareTo() in user-defined classes?
4. String Class Constructors
1. What are the different ways to create a String object in Java?
2. Explain the difference between String s = "hello" and String s = new String("hello").
3. What is the purpose of the char[] constructor in String?
4. How does the String(byte[] bytes) constructor work?
5. What is the difference between String and StringBuilder?
6. Why is String immutable in Java?
7. How can you convert a String to a char array?
8. What happens if you pass null to a String constructor?
9. How do you create an empty String object?
10. What is the use of the String(StringBuffer buffer) constructor?
5. String Manipulation Methods
1. What are some common methods for character extraction in String?
2. How do you compare two strings in Java? Explain equals() vs ==.
3. What is the difference between indexOf() and lastIndexOf()?
4. How do you modify a string in Java since strings are immutable?
5. Explain the use of substring(), concat(), and replace() methods.
6. What does the trim() method do?
7. How do you convert a string to uppercase or lowercase?
8. What is the purpose of matches() in the String class?
9. How do you split a string into an array of substrings?
10. What is the difference between String.valueOf() and Integer.parseInt()?
6. StringBuffer Methods
1. What is StringBuffer, and how is it different from String?
2. Explain the use of append() and insert() methods in StringBuffer.
3. How does StringBuffer handle mutability compared to String?
4. What is the purpose of the reverse() method in StringBuffer?
Dr. Vinay Gangaraju Page 43 of 46
RRIT, Department of ISE 2023-24
5. How do you convert a StringBuffer to a String?
6. What is the difference between StringBuffer and StringBuilder?
7. How does setCharAt() work in StringBuffer?
8. What is the initial capacity of a StringBuffer? How can you change it?
9. How do you delete characters in a StringBuffer?
10. Why is StringBuffer thread-safe?
7. Swing Event Handling
1. What is event handling in Java Swing?
2. How do you create a button in Swing?
3. What is an ActionListener, and how is it used?
4. Explain the difference between Button and JButton.
5. How do you display a message when a button is clicked?
6. Can a single ActionListener handle multiple buttons? If yes, how?
7. What is the purpose of setVisible() and setSize() in Swing?
8. How do you close a Swing application properly?
9. What is the role of JFrame in Swing applications?
10. How can you change the text of a button dynamically?
8. Servlet Greeting Message
1. What is a servlet in Java?
2. How do you retrieve user input from an HTML form in a servlet?
3. Explain the doGet() and doPost() methods.
4. How do you display a greeting message in a servlet?
5. What is the purpose of HttpServletRequest and HttpServletResponse?
6. How do you deploy a servlet in a web server?
7. What is the difference between Servlet and JSP?
8. How can you pass data from a servlet to a JSP page?
9. What is the role of web.xml in servlet configuration?
10. How do you handle exceptions in a servlet?
9. Servlet Student Details
1. How do you accept student details in a servlet?
Dr. Vinay Gangaraju Page 44 of 46
RRIT, Department of ISE 2023-24
2. How do you display student details (name, USN, marks) in a servlet?
3. What is the purpose of request.getParameter()?
4. How can you validate user input in a servlet?
5. How do you format and display data in a servlet response?
6. Can you store student details in a database using a servlet? If yes, how?
7. What is the difference between forward() and sendRedirect() in servlets?
8. How do you handle multiple form submissions in a servlet?
9. What is session management in servlets?
10. How can you make a servlet thread-safe?
10. Cookie Handling in Java
1. What is a cookie in web programming?
2. How do you create a cookie in Java?
3. How do you read a cookie in a servlet?
4. What is the purpose of setMaxAge() in cookies?
5. How do you send a cookie to the client browser?
6. What are the limitations of cookies?
7. How do you delete a cookie?
8. What is the difference between a session and a cookie?
9. Can cookies store sensitive information? Why or why not?
10. How do you check if a cookie exists in a servlet?
11. JDBC Student Database Operations
1. What is JDBC, and how is it used in Java?
2. How do you establish a database connection in Java?
3. Explain the steps to insert data into a database using JDBC.
4. How do you retrieve data from a database using JDBC?
5. What is PreparedStatement, and why is it better than Statement?
6. How do you update and delete records in a database using JDBC?
7. What is ResultSet in JDBC?
8. How do you handle SQL exceptions in JDBC?
9. What is connection pooling in JDBC?
10. How can you search for a student record based on a condition?
Dr. Vinay Gangaraju Page 45 of 46
RRIT, Department of ISE 2023-24
12. JSP Login Page with Database Validation
1. What is JSP, and how is it different from servlets?
2. How do you create a login form in JSP?
3. How do you validate user credentials against a database in JSP?
4. What is the role of session in JSP?
5. How do you handle failed login attempts in JSP?
6. What are JSP directives, and how are they used?
7. How do you prevent SQL injection in JSP?
8. What is the difference between include directive and include action in JSP?
9. How do you redirect a user after successful login?
10. How can you secure a JSP page from unauthorized access?
Dr. Vinay Gangaraju Page 46 of 46