Java Programming - JSP And Servlet Questions and Answers

Related Topics:

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

Answer: B. contextInitialized((),contextDestroyed()

2. A deployment descriptor describes
[A] web component response settings
[B] web component settings
[C] web component request objects
[D] All of the above

Answer: B. web component settings

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

Answer: D. servlet filter

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

Answer: B. servlet container

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

Answer: A. sends a request to another resource like servlet, jsp or html

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

Answer: A. return back to the same method from where the forward was invoked

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

Answer: C. 2K

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

Answer: D. the session is existing

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

Answer: B. URL rewriting, using session object, using cookies, using hidden fields

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

Answer: B. 1,2 are correct


Comments: (Your feedback is valuable to us)

Sahib Zar Khan 7 months ago Reply

In the last question PintWriter is misspelled it should be PrintWriter

Davinder Singh 7 months ago

thanks for correction ...


NIlesh Unde 9 months ago Reply

Nice for learning


umang Naik 1 year ago Reply

(y)


Chanikya Reddy 1 year ago Reply

thank you


Gidraf Kungu 1 year ago Reply

fine


;