Java Programming - JSP And Servlet Questions and Answers

Java Programming : JSP And Servlet

This is Java Programming Section of Multiple Choice Questions and answers on JSP and Servlet.
1. What are the mechanisms available in ServletContextListener interface?
[A] contextInit(), contextService(), contextDestroyed()
[B] contextInitialized((),contextDestroyed()
[C] contextInitialized(), contextService(), contextDestroyed()
[D] None of the above
Loading...
2. A deployment descriptor describes
[A] web component response settings
[B] web component settings
[C] web component request objects
[D] All of the above
Loading...
3. Dynamic interception of requests and responses to transform the information is done by
[A] servlet container
[B] servlet config
[C] servlet context
[D] servlet filter
Loading...
4. The life cycle of a servlet is managed by
[A] servlet context
[B] servlet container
[C] the supporting protocol (such as http or https)
[D] all of the above
Loading...
5. The include() method of RequestDispatcher
[A] sends a request to another resource like servlet, jsp or html
[B] includes resource of file like servlet, jsp or html
[C] appends the request and response objects to the current servlet
[D] None of the above
Loading...
6. The method forward(request,response) will
[A] return back to the same method from where the forward was invoked
[B] not return back to the same method from where the forward was invoked and the web pages navigation continues
[C] Both A and B are correct
[D] None of the above
Loading...
7. What is the limit of data to be passed from HTML when doGet() method is used?
[A] 4K
[B] 8K
[C] 2K
[D] 1K
Loading...
8. The getSession() method with 'true' as its parameter [ getSession(true) ] it will return the appropriate session object when
[A] the session is completed
[B] the session object is passed to another method
[C] the session does not exists
[D] the session is existing
Loading...
9. Which of the following are the session tracking techniques?
[A] URL rewriting, using session object, using response object, using hidden fields
[B] URL rewriting, using session object, using cookies, using hidden fields
[C] URL rewriting, using servlet object, using response object, using cookies
[D] URL rewriting, using request object, using response object, using session object
Loading...
10. What's the difference between servlets and applets?




1.Servlets executes on Servers, where as Applets executes on Browser


2.Servlets have no GUI, where as an Applet has GUI


3.Servlets creates static web pages, where as Applets creates dynamic web pages


4.Servlets can handle only a single request, where as Applet can handle multiple requests
[A] 1,2,3 are correct
[B] 1,2 are correct
[C] 1,3 are correct
[D] 1,2,3,4 are correct
Loading...

Are these questions helpful for you?



Comments: (Your feedback is valuable to us)

Sahib Zar Khan 1 year ago Reply

In the last question PintWriter is misspelled it should be PrintWriter

Davinder Singh 1 year ago

thanks for correction ...