JSP and Servlet Questions and Answers - Java Programming (MCQ)

JSP and Servlet Multiple Choice Questions and Answers in Java Programming.

1) What are the mechanisms available in ServletContextListener interface?

  1. contextInit(), contextService(), contextDestroyed()
  2. contextInitialized((),contextDestroyed()
  3. contextInitialized(), contextService(), contextDestroyed()
  4. None of the above
Show Answer
Answer = contextInitialized((),contextDestroyed()

2) A deployment descriptor describes
  1. web component response settings
  2. web component settings
  3. web component request objects
  4. All of the above
Show Answer
Answer = web component settings

3) Dynamic interception of requests and responses to transform the information is done by
  1. servlet container
  2. servlet config
  3. servlet context
  4. servlet filter
Show Answer
Answer = servlet filter

4) The life cycle of a servlet is managed by
  1. servlet context
  2. servlet container
  3. the supporting protocol (such as http or https)
  4. all of the above
Show Answer
Answer = servlet container

5) The include() method of RequestDispatcher
  1. sends a request to another resource like servlet, jsp or html
  2. includes resource of file like servlet, jsp or html
  3. appends the request and response objects to the current servlet
  4. None of the above
Show Answer
Answer = sends a request to another resource like servlet, jsp or html

6) The method forward(request,response) will
  1. return back to the same method from where the forward was invoked
  2. not return back to the same method from where the forward was invoked and the web pages navigation continues
  3. Both A and B are correct
  4. None of the above
Show Answer
Answer = 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?
  1. 4K
  2. 8K
  3. 2K
  4. 1K
Show Answer
Answer = 2K

8) The getSession() method with ‘true’ as its parameter [ getSession(true) ] it will return the appropriate session object when
  1. the session is completed
  2. the session object is passed to another method
  3. the session does not exists
  4. the session is existing
Show Answer
Answer = the session is existing

9) Which of the following are the session tracking techniques?
  1. URL rewriting, using session object, using response object, using hidden fields
  2. URL rewriting, using session object, using cookies, using hidden fields
  3. URL rewriting, using servlet object, using response object, using cookies
  4. URL rewriting, using request object, using response object, using session object
Show Answer
Answer = 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

  1. 1,2,3 are correct
  2. 1,2 are correct
  3. 1,3 are correct
  4. 1,2,3,4 are correct
Show Answer
Answer = 1,2 are correct



For More Questions visit Here -


Do You Like This? Please take 5 seconds to share with your firends.

0 comments:

Post a Comment