Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

3 simple servlet test questions

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
These are not taken from any certified exams, but belonging to a assessment test for registration purpose.
Can you guys pls let me know what are the answers or them? (I find the questions to be simple yet not precise per the Servlet APIs)
QUESTIONS: -
1. Which corresponding method in the HttpServlet class do you use to retrieve the value of a text field on an HTML form?

A. doPost

B. getParameter(String fieldName)

C. getHTTP(String fieldName)

D. doGet(String fieldName

2. What causes a servlet to load (2 options, choose the simplest/least operational impact)

A. A Web server start

B. The container detects that a class file has changed.

C. It is configured to do so periodically

D. It is loaded upon every request

3. Which interface defines the methods for retrieving form parameters

A. ServletRequest

B. ServletResponse

C. HTTPRequest

D. HTTPResponse
(This question seems to be quite funky as none of the options are 'interface' in the J2EE 1.3 APIs, right?)
 
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My answer would be 1.A 2.AC 3.A ( it is an interface).
 
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. B
2. A,B (A: still it has to be configured in the web.xml to load at start-up)
3. A

Originally posted by Stephen Lim:

A. ServletRequest

B. ServletResponse

C. HTTPRequest

D. HTTPResponse
(This question seems to be quite funky as none of the options are 'interface' in the J2EE 1.3 APIs, right?)[/QB]


These are all interfaces.
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. A
Because it said HttpServlet class. If it said ServletRequest, I will pick B. getParameter()
2. A, B
When the deployment descriptor file have specified <load-on-startup>, it will load when web server start, otherwise it will load when the first request comming in.
3. A
 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
definitively
1 - B
2 - A and B
3 - A (it is an interface)
Dani
 
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1.A
2.B,C
3.Should be HttpServletRequest
 
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Methods for retrieving form parameters are defined in the ServletRequest interface(SR interface is implemented by the container).
 
Amer Khan
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A, tricky ? (There is no getParameter(String str) defined or inherited in HttpServlet class ,this method is defined in ServletRequest interface and is accessed through the HttpServletRequest object[interface HttpServletRequest extends interface ServletRequest )]NOTE:Both interfaces are implemented by the Container
B,C (<load-on-startup> in web.xml)
A, Methods for retrieving form parameters are defined in the ServletRequest interface(SR interface is implemented by the container).
[ August 05, 2003: Message edited by: Amer Khan ]
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi moderator,
different people gave different answers. Can you please provide the right answers for the above questions.
 
I am going to test your electrical conductivity with this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic