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