• Skip to primary navigation
  • Skip to content
  • Skip to primary sidebar
  • Skip to footer
  • Core Java
  • Design Patterns
  • JSP
  • Servlets
  • Building Tools
  • jQuery
  • Spring
  • Hibernate
  • Mongo DB
  • More
    • HTML
    • SCJP
    • AJAX
    • UML
    • Struts
    • J2EE
    • Testing
    • Angular JS

J2EE Reference

  • Home
  • About Us
    • Java Learning Centers
  • Contact Us

Servlet Quiz

February 8, 2013 By j2eereference Leave a Comment

Servlet Quiz

Start

Congratulations - you have completed Servlet Quiz.

You scored %%SCORE%% out of %%TOTAL%%.

Your performance has been rated as %%RATING%%


Your answers are highlighted below.
Question 1
In which file do we define a servlet mapping?
A
web.xml
B
servlet.xml
C
mapping.xml
D
deployment.xml
Question 2
Servlets and JavaServer Pages have become so popular that they are now supported directly or with third-party plug-ins by most major Web servers and application servers.
A
true
B
false
C
can not say
D
None of these
Question 3
What is the limit of data to be passed from HTML when doGet() method is used?
A
1k
B
2k
C
4k
D
8k
Question 4
The tasks – authentication-blocking of requests, data compression, logging and auditing – are performed by
A
servlet filter
B
servlet config
C
servlet context
D
servlet container
Question 5
Which of the following can be used to store client side user state information while avoiding any impact due to the users web browser configuration ?
A
Cookies
B
URL rewriting
C
HttpSessions
D
Hidden tags
Question 6
Which of the following is not true about Servlets?
A
They are instantiated every time a request is made.
B
They are a mechanism used by the class loader to download applets.
C
They can be used instead of CGI scripts.
D
They require a web browser that supports JDK 1.1
Question 7
Dynamic interception of requests and responses to transform the information is done by
A
servlet filter
B
servlet context
C
servlet config
D
servlet container
Question 8
The include() method of RequestDispatcher
A
includes resource of file like servlet, jsp or html
B
sends a request to another resource like servlet, jsp or html
C
appends the request and response objects to the current servlet
D
None of the above
Question 9
Using relative paths to reference resources in the same context root makes your Web application more flexible.
A
false
B
true
C
can't say
D
None of the above
Question 10
What is the servlet ?
A
Client side program
B
Server side program
C
Both are true
D
None of these
Question 11
How many ServletContext objects are available for an entire web application?
A
One each per servlet
B
One each per request
C
One each per response
D
Only One
Question 12
Which of the following describe ways that dynamic information can be made available to all servlet requests sent to an application
A
Make the information available from a singleton
B
Store the information in the ServletContext
C
Store the information in an HttpSession
D
Store the information in a Properties file
Question 13
Choose correct ansewrs
1. Servlet is a  Java technology based Web component.
2. Servlets are platform-independent 
3. Servlet has run on Web server which has a containers
4. Servlets interact with Web clients via a request/response using HTTP protocol. 
A
1,2,3,4
B
1,2,3
C
1,3,4
D
1,2,4
Question 14
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
Question 15
All servlets must implement the Servlet interface of package:
A
java.servlet
B
javax.servlet
C
.servlet
D
All are same
Question 16
Servlet A receives a request that it forwards to servlet B within another web application in the same web container. Servlet A needs to share data with servlet B and that data must not be visible to other servlets in A's web application. In which object can the data that A shares with B be stored?
A
HttpServletResponse
B
HttpServletRequest
C
ServletContext
D
HttpSession
Question 17
Servlet mapping defines
A
an association between a URL pattern and a servlet
B
an association between a URL pattern and a request page
C
an association between a URL pattern and a response page
D
All of the above
Question 18
A developer wants a web application to be notified when the application is about to be shut down. Which two actions are necessary to accomplish this goal? (Choose two.)
A
include a listener directive in a JSP page
B
configure a listener in the TLD file using the element
C
include a element in the web application deployment descriptor
D
configure a listener in the application deployment descriptor, using the element
E
include a class implementing ServletContextListener as part of the web application deployment
Question 19
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
Question 20
Which three are true about the HttpServletRequestWrapper class? (Choose three.)
A
The HttpServletRequestWrapper is an example of the Decorator pattern.
B
The HttpServletRequestWrapper can be used to extend the functionality of a servlet request.
C
A subclass of HttpServletRequestWrapper CANNOT modify the behavior of the getReader method.
D
An HttpServletRequestWrapper may be used only by a class implementing the javax.servlet.Filter interface.
E
An HttpServletRequestWrapper may modify the header of a request within an object implementing the javax.servlet.Filter interface.
Once you are finished, click the button below. Any items you have not completed will be marked incorrect. Get Results
There are 20 questions to complete.
←
List
→
Return
Shaded items are complete.
12345
678910
1112131415
1617181920
End
Return
You have completed
questions
question
Your score is
Correct
Wrong
Partial-Credit
You have not finished your quiz. If you leave this page, your progress will be lost.
Correct Answer
You Selected
Not Attempted
Final Score on Quiz
Attempted Questions Correct
Attempted Questions Wrong
Questions Not Attempted
Total Questions on Quiz
Question Details
Results
Date
Score
Hint
Time allowed
minutes
seconds
Time used
Answer Choice(s) Selected
Question Text
All done
Need more practice!
Keep trying!
Not bad!
Good work!
Perfect!

Filed Under: Servlets

Reader Interactions

Leave a Reply Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

FOLLOW US ONLINE

  • View J2eereference-166104970118637’s profile on Facebook
  • View j2eereference’s profile on Twitter
  • View j2eereference’s profile on LinkedIn

Subscribe by email

Recent posts

  • Java Buzzwords
  • Anonymous Inner Class in Java
  • Network Programming – java.net Package
  • Java Regular Expressions
  • Method Local Inner Class in Java
  • URL Processing in Java
  • Iterator Design Pattern Implementation using Java
  • Strategy Design Pattern Implementation using Java
  • Decorator Design Pattern
  • Adapter Design Pattern Implementation using Java
  • JSF Composite Components
  • JSF UI Components
  • What is JavaServer Faces (JSF)?
  • GOF Design Patterns
  • History and Need for Design Patterns

Footer

Core Java
Design Patterns
JSP
Servlets
HTML
Building Tools
AJAX
SCJP
jQuery
Testing
Spring
UML
Struts
Java Centers
Java Training
Home
About Us
Contact Us
Copyright © j2eereference.com. All right reserved.