Win a copy of Java Persistence with Spring Data and Hibernate this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

JavaRanch MockExamQuestion

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i dont see why d is not correct answer ?!
 
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Lookout! Runaway whale! Hide behind this tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic