-
The______________ listeners are notified when attributes are added to, removed from, or replaced in the Servlet context.
Skill/Topic: JSP Thread ModelA) Session AttributeB) Servlet context attributeC) Session ListenersD) Session context Listeners
-
Arrange the lifecycle phases of JSP in correct order1. Page translation: -page is parsed, and a java file which is a Servlet is created. 2. Page compilation: page is compiled into a class file 3. Page loading : This class file is loaded. 4. Create an instance :- Instance of Servlet is created 5. jspInit() method is called 6. _jspService is called to handle service calls 7. _jspDestroy is called to destroy it when the Servlet is not required.
Skill/Topic: JSP Life CycleA) 1,2,3,4,5,6,7B) 1,4,3,2,5,6,7C) 3,2,1,4,5,6,7D) 4,5,3,6,2,7,1
-
State true or false - There is a limit to the max amount of data that can be stored in the session object ?
Skill/Topic: JSP Life CycleA) TrueB) FalseExplanation: As such there is no limit on the amount of information that can be saved in a Session Object. Only the RAM available on the server machine is the limitation.
-
If the data being submitted is sensitive, then it's always preferred to use _____________ method
Skill/Topic: ServletsA) doPostB) doGetC) serviceD) None of the aboveExplanation: because the elements don't shown up in URL.
-
The _________interface provides information to servlets regarding the environment in which they are running.
Skill/Topic: ServletsA) ServletContextExplanation: It also provides standard way for servlets to write events to a log file.
-
Which of the following statements is true about the GenericServlet. (Multiple choice)
Skill/Topic: ServletsA) GenericServlet is for servlets that might not use HTTP, like for instance FTP service.B) As of only Http is implemented completely in GenericServlet. C) The GenericServlet has a service() method that gets called when a client request is made. D) GenericServlet is called by both incoming requests and the HTTP requests are given to the servlet as they are.
-
State true or false: - Can the constructor be used instead of init () to initialize a Servlet
Skill/Topic: ServletsA) TrueB) FalseExplanation: But you shouldn’t. The original reason for init() was that ancient versions of Java couldn’t dynamically invoke constructors with arguments, so there was no way to give the constructor a ServletConfig. That no longer applies, but Servlet containers still will only call your no-arg constructor. So you won’t have access to a ServletConfig or ServletContext.
-
Which of the following statements correctly define the use of Servlet over CGI (Multiple choice)
Skill/Topic: ServletsA) Servlet provide a way to generate dynamic documents that is both easier to write and faster to run. B) Servlet also address the problem of doing server-side programming with platform-specific APIsC) They are developed with the Java Servlet API, a standard Java extensionD) They have slower response
-
-
-
-
-
-
-
-
-
-
-
-
JSP Interview Questions
Ans