Extra Practice Questions for EP
Do not rely on the questions for exam, do your own study
Also do the practical done in class
1. What does JDBC stand for?
2. Which method handles POST requests in a servlet?
3. What does getParameter() do in servlets?
4. Which annotation is used to define a servlet without web.xml?
5. Write the syntax of the JSP expression tag.
6. Name any two implicit objects in JSP.
7. What is the use of executeQuery() in JDBC?
8. Write the full form of JSP.
9. What is the return type of executeUpdate()?
10. Mention any two differences between doGet() and doPost().
11. Write a code snippet to connect to a MySQL database using JDBC.
12. Write servlet code to print “Hello, World” using PrintWriter.
13. Write JSP code to add two numbers received from a form.
14. Write a basic servlet using @WebServlet that prints a welcome message.
15. Write servlet code that accepts username and password via form and prints them.
16. Write JDBC code to insert a record into a students table using PreparedStatement.
17. Write a servlet that prints an HTML form using PrintWriter and handles submission
in doPost().
18. Explain the lifecycle methods of a servlet.
19. Write servlet code to display user input received through a form using doPost().
20. Create a JSP program that takes a name and city and displays both.
21. Write code to retrieve all records from a table using ResultSet.
22. Create a servlet that handles both doGet() and doPost() and displays form data.
23. Write a servlet that uses session to store and display a user’s name.
24. Write a JSP program to display whether a number is even or odd.
25. Write JDBC code to validate login credentials using database data.
26. Create a servlet that sets a cookie and another servlet that reads it.
27. Write a JSP program to calculate and display factorial of a number using a loop.
28. Write servlet code to accept a department name via form and display "Welcome to the X
department!".
29. Write JDBC code to fetch all student records whose marks are greater than 75.
30. Explain the client-server flow in servlet and JDBC-based applications with a diagram.
31. Write a servlet that accepts user feedback and stores it in a MySQL table.
32. Write a JSP program that uses request.getParameter() to display submitted form
values.
33. Write a servlet that shows how to create and destroy a session.
34. Create a JSP page that prints the current date and time using Java code.
35. Write JDBC code that demonstrates use of commit() and rollback().
36. Create a JSP login form and show a welcome message on correct login using static
credentials.
37. Create a servlet that prints all request headers.
38. Write servlet code to redirect the user to another page if a condition is met.
39. Write a servlet that accepts two numbers and displays the largest using doPost().
40. Write a JSP page that uses a loop to display the multiplication table of a number.
41. Write servlet code to count the number of times a user visited the page using session or
cookie.
42. Write JDBC code to update a student record where id = 5.
43. Create a JSP page that accepts a number and checks if it is prime.
44. Create a form using PrintWriter and accept name and email in servlet, then print
them.
45. Write code to create a servlet that performs delete operation on a database.
46. Write a servlet using doPost() only to accept and display a user's department.
47. Write a JSP page to accept subject marks and calculate total and percentage.
48. Write JDBC code to fetch and print column names using metadata.
49. Write servlet code to accept and display data from radio buttons and checkboxes.
50. Write a servlet that generates an HTML form in doGet() and processes it in doPost()
using only PrintWriter.