Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JavaRanch MockExamQuestion

 
Divya Guttikonda
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is a Mock Exam Question from JavaRanch:

A client types the URI :
http://www.someserver.com/servlet/SomeServlet?name=fred
The value of name can be obtained by:

a)doGet(HttpServletRequest request, HttpServletResponse response)
{
String name = response.getParameter("name");
...


b) service(HttpServletRequest request, HttpServletResponse response)
{
String name = request.getParameter("name");
...


c)doGet(HttpServletRequest request, HttpServletResponse response)
{
String name = request.getInitParameter("name");
...


d)doGet(HttpServletRequest request, HttpServletResponse response)
{
String name = request.getParameter("name");
...

The answer given is b, but i think the correct answer is d.Can anybody help me with this?

Thanks
Divya.
 
Sirisha Reddy
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i dont see why d is not correct answer ?!
 
shiva viswanathan
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey I think both b and d are correct answers since ultimately the service method calls the doGet method passing the same HttpServletRequest
method
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic