Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Which statement is true regarding initialization parameter

 
pradeep singh
Ranch Hand
Posts: 339
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
S Sravs
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i too think both c and e are true

Regards
Sravanthi
 
pradeep singh
Ranch Hand
Posts: 339
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any update?
 
John Pearson
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic