SCWCD : Servlet Filter Mock Exam Practice Questions
Questions no -1
What is the sequence of method execution in Filter?
Correct answer is : A
Explanations : The init method is called by the container when the filter is instantiated.
If you wish to pass initialization parameters to the filter, you retrieve them from the FilterConfig object passed to init.
Then doFilter and last is destroy.
Questions no -2
Which of the following statement is true about servlet filter ?
A)A filter is a reusable piece of code that can transform the content of HTTP requests, responses, and header information.
B)Filters do not generally create a response or respond to a request as servlets do.
C)Filters can act on dynamic or static content.
D)All of the above
Correct answer is : D
Explanations : All statements are true.