• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

marcus green mock exam

 
vani venkat
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Which of the following statements are true?
Choose at least one answer.
A. Every (non distributed) web application has only one instance of ServletContext
B. Every instance of HttpServlet has only one instance of ServletContext
C. The ServletContext object is retrieved via the getServletContext method of ServletConfig
D. The ServletConfig object is retrieved via the getServletConfig method of ServletContext

Why is option B incorrect here? Every instance of servlet class will have one servlet context associated with it. it can't have multiple instances of servlet context. how is this incorrect?
 
Shailesh Narkhede
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thing they mean to say,
Every Servlet Instance have its own servletContext object that is wrong.
 
vani venkat
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sailesh, it doesnot sound like that. is it mentioned anywhere that option B should be interpreted that way?
 
Shailesh Narkhede
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
B. Every instance of HttpServlet has only one instance of ServletContext


In this statement they had not tell us that context is same for all servlets or not.
might be they mean to say,

Every instance of HttpServlet has its own one instance of ServletContext.
 
Naren Chivukula
Ranch Hand
Posts: 577
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A & C?!!??!

Cheers,
Naren

SCJP - 93%
SCDJWS - 86%
SCWCD - ?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic