File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Mock Questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Mock Questions" Watch "Mock Questions" New topic

Mock Questions

S. Palanigounder
Ranch Hand

Joined: Apr 03, 2003
Posts: 145
A servlet can pass on a request to another resource, such as a servlet, JSP, or HTML Page by either using the include() or forward() method of the RequestDispatcher interface. Which of the following is/are the correct way(s) of creating the requestdispatcher object?
a. Using the ServletConfig object
b. Using the ServletContext
c. Using the HTTPServletRequest
d. Using the HTTPServletResponse
A web server has a web application named “fruits” deployed in it. This application has three servlets mapped under URL patterns /apples, /oranges and /grapes. Without making any further assumptions about the deployment, which of the following will invoke the oranges servlet from this Server?
a. http://host ort/oranges
b. http://host ort/fruits/oranges
c. http://host ort/oranges/index.htm
[ June 02, 2003: Message edited by: S. Palanigounder ]
yogen joshi

Joined: May 02, 2003
Posts: 21
Question 1
If the question asks for 1 correct answer then
b. ServletContext

If the question asks for all possible answers then
b. ServletContext
c. HTTPServletRequest.

This is because the method getRequestDispatcher() belongs to the ServletRequest.

Question 2
My answer is
a, c, - will give resource not found since there is no web app context.
b - will call the oranges servlet because /fruits/oranges matches the url pattern /oranges
d - will return the default index page.
I agree. Here's the link:
subject: Mock Questions
It's not a secret anymore!