Servlet Objective Questions and Answers (SET - 2)
Please attempt at least 12 objective questions to see the test result.
1) Which cookie it is valid for single session only; it is removed each time when user closes the browser?
2) Which object of HttpSession can be used to view and manipulate information about a session, such as the?
3) These methods doGet(),doPost(),doHead,doDelete(),deTrace() are used in?
4) Which type of ServletEngine is a server that includes built-in support for servlets?
5) Given a web application ShoopingCart with 2 files: ShoppingCart/customer/ addProductToCart.jsp ShoppingCart/customer/ showCart.jsp which of the following code are valid in addProductToCart.jsp to dispatch request to the showCart.jsp?
6) In the web.xml , session configuration is <session-config> <session-timeout>0<session-timeout> </session-config> What does this means?
7) Which of the following statements are correct about the status of the Http response. Select the one correct answer.
8) Name the class that includes the getSession method that is used to get the HttpSession object.
9) Which HTTP method gets invoked when a user clicks on a link? Select the one correct answer.
10) Which of the following are the methods defined in ServletContextListener interface?
11) The sendRedirect method defined in the HttpServlet class is equivalent to invoking the setStatus method with the following parameter and a Location header in the URL. Select the one correct answer.
12) To send binary output in a response, the following method of HttpServletResponse may be used to get the appropriate Writer/Stream object. Select the one correct answer.
13) Name the method defined in the HttpServletResponse class that may be used to set the content type. Select the one correct answer.
14) The sendError method defined in the HttpServlet class is equivalent to invoking the setStatus method with the following parameter. Select the one correct answer.
15) Which three digit error codes represent an error in request from client? Select the one correct answer.