Home / CSE MCQs / Servlets-1 ::

CSE MCQs :: Servlets-1

  1. To send text output in a response, the following method of HttpServletResponse may be used to get the appropriate Writer/Stream object.
  2. A.
    getStream
    B.
    getOutputStream
    C.
    getBinaryStream
    D.
    getWriter

  3. Which method take a string not a URL?
  4. A.
    sendRedirect
    B.
    forward
    C.
    Both
    D.
    None

  5. RequestDispatcher object is used
  6. A.
    to include other resources
    B.
    to include an image
    C.
    to include xml object
    D.
    to include e-mailing response

  7. Which of the following are interface? 1. ServletContext 2. Servlet 3. GenericServlet 4. HttpServlet
  8. A.
    1,2,3,4
    B.
    1,2
    C.
    1,3,4
    D.
    1,4

  9. What is the meaning of response.setHeader("xyz", "abc");
  10. A.
    Add a new header and value
    B.
    Add an additional value to exiting header
    C.
    Add a new header and value or add an additional value to exiting header
    D.
    Add new header and value always

  11. How many JDBC driver types does Sun define?
  12. A.
    One
    B.
    Two
    C.
    Four
    D.
    Three

  13. What are the features added in Servlet 2.5?
  14. A.
    Dependency on J2SE 5.0
    B.
    Support for annotations
    C.
    Loading the class
    D.
    All of these

  15. The life cycle of a servlet is managed by
  16. A.
    servlet context
    B.
    servlet container
    C.
    the supporting protocol (such as http or https)
    D.
    All of the above

  17. Which of the following method sets application/context init parameter?
  18. A.
    setParameter(String name,String value)
    B.
    Its not possible in the method
    C.
    setParameter(String name,Object value)
    D.
    setParameter(Object name,Object value)

  19. Which method shows the client what server is receiving?
  20. A.
    goGet
    B.
    doOption
    C.
    doTrace
    D.
    doPost