🧪 Servlets MCQ Quiz Hub

Servlets - Java (MCQ) questions

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

1. Which object of HttpSession can be used to view and manipulate information about a session?




2. Which class provides stream to read binary data such as image etc. from the request object?




3. Which class provides stream to read binary data such as image etc. from the request object?




4. Which of these ways used to communicate from an applet to servlet?




5. Which methods are used to bind the objects on HttpSession instance and get the objects?




6. Which type of ServletEngine is a server that includes built-in support for servlets?




7. What type of servlets use these methods doGet(), doPost(),doHead, doDelete(), doTrace()?




8. Which cookie it is valid for single session only and it is removed each time when the user closes the browser?




9. Which method is used to send the same request and response objects to another servlet in RequestDispacher ?




10. Which packages represent interfaces and classes for servlet API?




11. Which class can handle any type of request so that it is protocol-independent?




12. Which HTTP Request method is non-idempotent?




13. Which object is created by the web container at time of deploying the project?




14. What is the lifecycle of a servlet?




15. Which method in session tracking is used in a bit of information that is sent by a web server to a browser and which can later be read back from that browser?




16. In HTTP Request what asks for the loopback of the request message, for testing or for troubleshooting?




17. In HTTP Request what asks for the loopback of the request message, for testing or for troubleshooting?




18. In HTTP Request what asks for the loopback of the request message, for testing or for troubleshooting?




19. In HTTP Request what asks for the loopback of the request message, for testing or for troubleshooting?




20. Which one of the following scopes does the attribute in servlet is an object that can be set, get or removed?




21. Which are the examples of Application Server?




22. How many techniques are used in Session Tracking?




23. In the following statements identify the disadvantages of CGI?




24. Which method is used to specify before any lines that uses the PintWriter?




25. What are the functions of Servlet container?




26. What are the functions of Servlet container?




27. . What is bytecode?




28. Which of the following statements are correct about the status of the Http response.




29. Which JDBC driver Type(s) can be used in either applet or servlet code?




30. Which of the following code retrieves the MIME type of the body of the request?




31. To send text output in a response, the following method of HttpServletResponse may be used to get the appropriate Writer/Stream object.




32. Which method take a string not a URL?




33. RequestDispatcher object is used




34. Which of the following are interface? 1. ServletContext 2. Servlet 3. GenericServlet 4. HttpServlet




35. What is the meaning of response.setHeader("xyz", "abc




36. How many JDBC driver types does Sun define? One




37. What are the features added in Servlet 2.5?




38. The life cycle of a servlet is managed by




39. Which of the following method sets application/context init parameter?




40. Which method shows the client what server is receiving?