wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Which statement is true regarding initialization parameter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Which statement is true regarding initialization parameter" Watch "Which statement is true regarding initialization parameter" New topic
Author

Which statement is true regarding initialization parameter

pradeep singh
Ranch Hand

Joined: Oct 23, 2007
Posts: 339
Q-33
Marks: 1 Given a valid deployment descriptor (WEB.XML) containing the following code

<context-param>
<param-name>bestwebsite</param-name>
<param-value>www.examulator.com</param-value>
</context-param>
<servlet>
<servlet-name>GetInitParameter</servlet-name>
<servlet-class>com.examulator.GetInitParameter</servlet-class>
<init-param>
<param-name>bestwebsite</param-name>
<param-value>www.javaranch.com</param-value>
</init-param>
</servlet>

And given that cfg is a valid ServletConfig object and ctx is a valid ServletContext object which of the following statements are true?


Choose at least one answer.
a. cfg.getInitParameter("bestwebsite") will return http://www.examulator.com/
b. ctx.getInitParameter("bestwebsite") will return http://www.javaranch.com/
c. ctx.getInitParameter("bestwebsite") will return http://www.examulator.com/
d. cfg.getServletContext().getInitParameter("bestwebsite"); will cause a compile time error
e. ctx.getServletConfig().getInitParameter("bestwebsite"); will cause a compile time error


Answer given only c. But I think e is also correct.What you say?



Source:Marcus mock exam 3


SCJP 5.0(75%), SCWCD 5.0(88%)
S Sravs
Ranch Hand

Joined: Feb 25, 2008
Posts: 85
i too think both c and e are true

Regards
Sravanthi
pradeep singh
Ranch Hand

Joined: Oct 23, 2007
Posts: 339
Any update?
John Pearson
Ranch Hand

Joined: Oct 19, 2007
Posts: 51
You are right, e is also correct. I ran a quick test just to make sure I wasn't missing anything, and it failed with a "cannot find symbol" compile error.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Which statement is true regarding initialization parameter
 
Similar Threads
ServletConfig & ServletContext
ServletContext related
initialization parameters and error-page related
marcus green: Mock test
answers to questions in Macus Green tests