IBM IBM certifications I 000-150 Web Demo
This webdemo is just a demo data, only for reference and learning, there is no other purposes
1. Which method would be used to call a registered servlet within the same Web application and with the following attributes?
A. getServletConfig().getServletContext().getRequestDispatcher
?("http://www.example.com/testApp/TestServlet").forward(req,res);
B. getServletConfig().getServletContext().getRequestDispatcher("/testApp/TestServlet").forward(req,res);
C. getServletConfig().getServletContext().getRequestDispatcher("/TestServlet").forward(req,res);
D. getServletConfig().getServletContext().getRequestDispatcher("TestServlet").forward(req,res);
Answer: C
2.Which of the following would be legal parameters for the include() method of the RequestDispatcher object?
A. ServletHttpRequest, ServletHttpResponse
B. HttpServletReq, HttpServletResp
C. ServletRequest, ServletResponse
D. ServletReq, ServletResp
Answer: C
3. A client has accessed a servlet via a form that uses an HTTP POST
request. Which two methods could be used by the servlet to obtain
information input within the form?
A. Using the servlet object's getServletInfo() method
B. Using the request object's getAttribute() method
C. Using the request object's getParameter() method
D. Using the request object's getParameterValues() method
E. Using the request object's getAttributeValues() method
Answer: CD
4. If a server has URL rewriting enabled, what is the result of using the encodeURL() method of the HttpResponse interface?
A. Encryption of sensitive client data in the URL
B. Increased performance due to browser specific information being encoded in the URL
C. Redirection of all subsequent requests to a unique domain specified as a URL parameter
D. Addition of a client's session ID to the URL in a query string
Answer: D
5. At the top of a JSP page the following directive appears:
What does this indicate about the JSP?
A. That an exception will be thrown within the JSP page
B. That the JSP page will have access to an implicit object called exception
C. That any exceptions thrown within the JSP page should be ignored
D. That if any errors or exceptions occur within the current JSP page, they will be handled by another JSP page
Answer: B
6. A Web application contains a single servlet that handles all types
of requests. Within the Web application there is an HTML page that
contains a form that uses a POST type request. There are also
hyperlinks with query strings associated with them. The servlet must
handle both HTML form and hyperlink requests. Which two methods of the
HttpServlet class should be overridden by the servlet programmer?
A. doGet()
B. doPut()
C. doPost()
D. doQuery()
E. doForm()
Answer: AC
7. Which two of the following situations will result in the init() method of a servlet being invoked?
A. Every time a new client accesses the servlet
B. When the server automatically reloads the servlet
C. When a HTTP INIT type request is made by a client
D. When the servlet is put into service after loading and instantiation
Answer: BD
8. A developer wants to measure how many times a servlet has been invoked. Which listener could be used to accomplish this task?
A. HttpSessionListener
B. ServletContextListener
C. ServletRequestListener
D. ServletRequestAttributeListener
Answer: C