Sei sulla pagina 1di 18

Question -1 If a servlet generates an error that is not handled by the error_page mechanism, the container must ensure to send

a response with status ______?.

options A !"" # $"$ % $"" & $"1 %orrect answer is ' A ()planations ' If a servlet generates an error that is not handled by the error_page mechanism , the container must ensure to send a response with status !"". Question -* +eb applications can be pac,aged and signed into a +eb Archive format -+A. file using the standard /ava archive tools. +hen pac,aged into such a form, a 0(1A-I23 directory will be present which contains information useful to /ava archive tools. Any re4uests from the client to access the resources in 0(1A-I235 directory 0671 be returned with a ________ ?

options A 7%_281_3862& # 7%_I21(.2A9_7(.:(._(..8. % (7%_#A&_.(Q6(71 & 2one of the above %orrect answer is ' A ()planations ' Any re4uests from the client to access the resources in 0(1A-I235 directory 0671 be returned with a 7%_281_3862& -$"$ Question -; response.

1he classes in _________ directory must be available to the application class loader ?

options A 5+(#-I235classes5 # 5+(#-I235lib5classes5 % 5root5classes5 & 5root5lib5classes5 %orrect answer is ' A ()planations ' 1he 5+(#-I235classes5 directory for servlet and utility classes. 1he classes in this directory must be available to the application class loader. Questions no -$ A /7< file that uses a tag library must declare the tag library first. 1he tag library is defined using the taglib directive - taglib uri=>...> prefi)=>...> +hich of the following specifies the correct purpose of prefi) attribute.

options A 1he prefi) defines the name of the tag that may be used for a tag library. # 1he prefi) attribute defines the location of the tag library descriptor file. % 1he prefi) attribute should refer to the short name attribute of the tag library file that is defined by the uri attribute of taglib directive & 1he prefi) attribute is used in front of a tagname of a tag defined within the tag library. %orrect answer is ' &

()planations ' If the taglib directive directive defines a prefi) of >test>, and a tag is called >mtag>, then the tag is used as >test'mtag>. Questions no -! ?iven a tag handler defined with /7< which implements 1ag7upport and 829@ overrides doAfter#ody with the following lines' public int doAfter#ody- throws /sp()ception A try A page%onte)t.get8ut- .print->Bi> CDcatch-I8()ception e return 7EI<_#8&@C D +hat will be the result of a Fsp with the following part? Gprefi)'sufi)H GiHBelloG5iH G5prefi)'sufi)H

AD

options A 1he Fsp page will print' Bello # 1he Fsp page will print' Bello Bi % 1he Fsp page will print' Bi Bello & 1he Fsp wonIt print anything %orrect answer is ' & ()planations ' 1ag7upport.do7tart1ag by default returns 7EI<_#8&@ and as it is not overridden the body is ignored. Questions no -J +hat is the default value of session Attribute in /7< ?

options A GKL page session=>true> KH # GKL page session=>false> KH % GKL page session=>yes> KH & GKL page session=>no> KH

%orrect answer is ' A ()planations ' GKL page session=>true> KH is the default value. Questions no -M A /7< page does not contain e)ception implicit valiable. page attribute and trying to acccess

options A e)ception implicit avaliable not available in the /7< page. # e)ception implicit avaliable is available in the /7< page. % 2o relation between is(rror<age attribute and e)ception implicit variable. & 2one of the above %orrect answer is ' A ()planations ' e)ception implicit valiable not available in all /7< pages. 2eed to add page attribute to the /7< to avaliable e)ception implicit in the /7< page. Questions no -N If the servlet code public class test7ervlet e)tends Bttp7ervlet A public void do?et-Bttp7ervlet.e4uest re4uest, Bttp7ervlet.esponse response throws 7ervlet()ception, I8()ception A re4uest.setAttribute->attribute1>, >attribute1> C Bttp7ession session = re4uest.get7ession- C session.setAttribute->attribute*>, >attribute*> C 7ervlet%onte)t application = get7ervlet%onte)t- C application.setAttribute->attribute;>,>attribute;> C .e4uest&ispatcher dispatcher = re4uest.get.e4uest&ispatcher->5test.Fsp> C dispatcher.forward-re4uest, response C D D and in the test.Fsp

attribute1' OAattribute1D attribute*' OAattribute*D attribute;' OAattribute;D +hat is the value of attribute1, attribute*, attribute; ?

options A attribute1' attribute1 attribute*' attribute* attribute;' attribute; # attribute1' attribute1 attribute*' null attribute;' null % attribute1' null attribute*' null attribute;' attribute; & attribute1' attribute1 attribute*' null attribute;' attribute; %orrect answer is ' A ()planations ' OAattribute1D is same as page%onte)t.findAttribute->attribute1> . page%onte)t.findAttributescope. Questions no -P If in test.Fsp QOA;R*-1D ' OA;R*-1D +hat is the output? find in re4uest then session then application

options A QOA;R*-1D ' $ # QO$ ' $ % $ ' $ & Q$ ' $ %orrect answer is ' A ()planations ' adding Q before (9 , does not e)ecute the (9.

QOA;R*-1D ' OA;R*-1D value is QOA;R*-1D ' $

Questions no -1" +hat is the se4uence of method e)ecution in 3ilter?

options A init,do3ilter,destroy # do3ilter,init,destroy % destroy,do3ilter,init & destroy,do3ilter %orrect answer is ' A ()planations ' 1he init method is called by the container when the filter is instantiated. If you wish to pass initialiSation parameters to the filter, you retrieve them from the 3ilter%onfig obFect passed to init. 1hen do3ilter and last is destroy. Questions no -11 +hich of the following statement is true about servlet filter ?

options A A filter is a reusable piece of code that can transform the content of B11< re4uests, responses, and header information. # 3ilters do not generally create a response or respond to a re4uest as servlets do. % 3ilters can act on dynamic or static content. & All of the above %orrect answer is ' & ()planations ' All statements are true. Questions no -1* +hich of the following is not implicit obFect in /7< ?

options A re4uest # response % page & system %orrect answer is ' & ()planations ' /7< implicit obFects are' -a out, -d session, -e config, -f application, -g page, -h re4uest, -b response, -c e)ception

page%onte)t, and -i

Questions no -1; +hat is the scope of response obFect?

options A re4uest # response % page & session %orrect answer is ' % ()planations ' scope of response obFect is page. Questions no -1$ +hich of the following elements can use the element Fsp'param ?

options A GFsp'include ...H # GFsp'forward ...H % GFsp'params H & All of the above %orrect answer is ' & ()planations ' All of the above elememts can use Fsp'param inside it.

Questions no -1! +hich of the following statements are correct about the following Fsp lines' GFps'use#ean id=>lname> class=>Fava.lang.7tring> 5H GK= lnameKH

options A It wonIt compile # It is a valid Fsp line and it will print the variable called lname. % It will compile but it will always produce null as the output. & 2one of the above %orrect answer is ' # ()planations ' It will wor, properly .1o have valid functionality you have to set an attribute of 7tring type in the proper scope before it is accessed by GFsp'use#ean ...H . Questions no -1J A developer is designing a multi-tier web application and discovers > need to log each incoming client re4uest >. +hich patterns, ta,en independently, provide a solution for this problem?

options A 1ransfer 8bFect # 7ervice 9ocator % 3ront %ontroller & 0odel-:iew-%ontroller %orrect answer is ' % ()planations ' 3ront %ontroller is the best choice for this re4uirement because every re4uest should go through the front controller. 3ront %ontroller provide >centraliSed controller for managing the handling of re4uests>. Questions no -1M

+hich of the following design pattern >.educes coupling between presentation tier and business services> ?

options A #usiness &elegate # 7ervice 9ocator % 3ront %ontroller & 1ransfer 8bFect Assembler %orrect answer is ' A ()planations ' #usiness &elegate >.educes coupling between presentation tier and business services>. Questions no -1N After translation of a /7< source page into its implementation class, 1he Fsp implementation class is ________ ?

options A final # static % abstract & private %orrect answer is ' A ()planations ' After translation /7< page loo,s li,e ' public final class test_Fsp e)tends org.apache.Fasper.runtime.Bttp/sp#ase implements org.apache.Fasper.runtime./sp7ource&ependent A ... D Questions no -1P +hat is the output of the below test.Fsp ? 55test.Fsp

GKT public void _Fsp7ervice-Bttp7ervlet.e4uest re4uest, Bttp7ervlet.esponse response throws Fava.io.I8()ception, 7ervlet()ception A out.println->Bello> C

D KH

options A Bello # %ompile (rror _Fsp7ervice-Fava).servlet.http.Bttp7ervlet.e4uest,Fava).servlet.http.Bttp7 ervlet.esponse is already defined in org.apache.Fsp.test_Fsp % .untime e)ception & 2one of the above %orrect answer is ' & ()planations ' After translation /7< page _Fsp7ervice automatically created by /7< compiler. In the /7< page if you define method name _Fsp7ervice-Fava).servlet.http.Bttp7ervlet.e4uest,Fava).servlet.http.Bttp7 ervlet.esponse then compiler will complain _Fsp7ervice-Fava).servlet.http.Bttp7ervlet.e4uest,Fava).servlet.http.Bttp7 ervlet.esponse is already defined in org.apache.Fsp.test_Fsp. Questions no -*" +hat get printed when the following /719 code fragment is e)ecuted? GKL taglib uri=>http'55Fava.sun.com5Fsp5Fstl5core> prefi)=>c> KH Gc'set var=>item> value=>*>5H Gc'for(ach var=>item> begin=>"> end=>"> step=>*>H Gc'out value=>OAitemD> default=>abc>5H G5c'for(achH

options A " # * % abc & $ %orrect answer is ' A ()planations ' for(ach tag gets e)ecuted once, and prints Sero. Questions no -*1 +hat get printed when the following /719 code fragment is e)ecuted? GKL taglib uri=>http'55Fava.sun.com5Fsp5Fstl5core> prefi)=>c> KH Gc'for(ach var=>item> begin=>"> end=>1*> step=>;>H OAitemD G5c'for(achH

options A ",;,J,P,1* # ;,J,P,1* % ",J,P,1* & ",;,J,P %orrect answer is ' A ()planations ' start from " to end 1* and step is ; so ",;,J,P,1* printed.

Questions no -** Implementations of the ________ interface are notified of changes to the list of active sessions in a web application.

options A Bttp7ession9istener

# Bttp7essionAttribute9istener % Bttp.e4uest9istener & Bttp%onte)t9istener %orrect answer is ' A ()planations 'Implementations of the Bttp7ession9istener interface are notified of changes to the list of active sessions in a web application. Questions no -*; All ____________ are notified of conte)t initialiSation before any filter or servlet in the web application is initialiSed.

options A 7ervlet%onte)t9isteners # Bttp7ession9istener % 7ervlet.e4uest9istener & All of the above %orrect answer is ' A ()planations ' All 7ervlet%onte)t9isteners are notified of conte)t initialiSation before any filter or servlet in the web application is initialiSed. All servlets and filters have been destroyed before any 7ervlet%onte)t9isteners are notified of conte)t destruction. Questions no -*$ +hich of the following element ? is the mandatory sub-elements of login-config

options A realm-name # auth-method % form-login-config & login-config doesnIt have mandatory sub-elements %orrect answer is ' &

()planations ' login-config doesnIt have mandatory sub-elements. Questions no -*! +hich of the following statement true about B11< &igest Authentication ?

options A Authentication is performed by transmitting the password in an (2%.@<1(& . # Authentication is performed by transmitting the password in an 281 (2%.@<1(& % 779 connection & All of the above %orrect answer is ' A ()planations ' Authentication is performed by transmitting the password in an (2%.@<1(& in B11< &igest Authentication . #ut not 779. Questions no -*J 2ame the class that includes the get7ession method that is used to get the Bttp7ession obFect?

options A Bttp7ervlet.e4uest # Bttp7ervlet.esponse % 7ession%onte)t & 7ession%onfig %orrect answer is ' A ()planations ' 1he class Bttp7ervlet.e4uest defines the get7ession method. Questions no -*M 1o send te)t outptut in a response, +hich of the following method of Bttp7ervlet.esponse may be used to get the appropriate +riter57tream obFect

options A get7tream # get8utput7tream % get#inary7tream & get+riter %orrect answer is ' & ()planations ' 1he get8utput7tream method is used to get an output stream to send binary data. 1he get+riter method is used to get a <rint+riter obFect that can be used to send te)t data. Questions no -*N +hich of the following statements are correct about the status of the Bttp response. 7elect the one correct answer.

options A A status of *"" to *PP signifies that the re4uest was succesful. # A status of ;"" to ;PP are informational messages. % A status of $"" to $PP indicates an error in the server. & A status of !"" to !PP indicates an error in the client %orrect answer is ' A ()planations ' 1he following table specifies the specific the status code of Bttp response. 7tatus %ode <urpose 1""-1PP Informational *""-*PP .e4uest was succesful ;""-;PP .e4uest file has moved. $""-$PP %lient error !""-!PP 7erver error. Questions no -*P

1he send.edirect method defined in the Bttp7ervlet class is e4uivalent to invo,ing the set7tatus method with the following parameter and a 9ocation header in the 6.9. 7elect the one correct answer.

options A 7%_8E # 7%_08:(&_1(0<8.A.I9@ % 7%_281_3862& & 7%_I21(.2A9_7(.:(._(..8. %orrect answer is ' # ()planations ' send.edirect-7tring 6.9

is e4uivalent to sending 7%_08:(&_1(0<8.A.I9@

-;"* response code and a location header in the 6.9. Questions no -;" +hich of the following statement is true about 6.9 .ewriting ?

options A +hen a client will not accept a coo,ie, 6.9 rewriting may be used by the server as the basis for session trac,ing # 6.9 rewriting involves adding data, a session I&, to the 6.9 path that is interpreted by the container to associate the re4uest with a session % 1he session I& must be encoded as a path parameter in the 6.9 string. 1he name of the parameter must be IFsessionidI & All of the above %orrect answer is ' & ()planations ' 6.9 rewriting is the lowest common denominator of session trac,ing. +hen a client will not accept a coo,ie, 6.9 rewriting may be used by the server as the basis for session trac,ing. 6.9 rewriting involves adding data, a session I&, to the 6.9 path that is interpreted by the container to associate the re4uest with a session.

1he session I& must be encoded as a path parameter in the 6.9 string. 1he name of the parameter must be IFsessionidI -lowercase T . Bere is an e)ample of a 6.9 containing encoded path information' http'55www.Favacertifications.net5inde).htmlCFsessionid=1*;$ Questions no -;1 1he session-timeout element defines the session timeout interval for all sessions created in this web application. +hich of the below statement is true about session-timeout?

options A 1he specified timeout must be e)pressed in a whole number of 0I261(7 # If the timeout is " or less , sessions is 2(:(. to time out % If this element is not specified, the container must set its default timeout period & All of the above %orrect answer is ' & ()planations ' 1he session-timeout element defines the default session timeout interval for all sessions created in this web application. 1he specified timeout must be e)pressed in a whole number of 0I261(7. If the timeout is " or less, the container ensures the default behaviour of sessions is 2(:(. to time out. If this element is not specified, the container must set its default timeout period. Questions no -;* %an a Fsp-file element present insted of servlet-class within a servlet element?

options A Fsp-file element can be present insted of servlet-class. and Fsp file can be declared. # 2o canIt use Fsp-file insted of servlet-class. % Fsp canIt use in web.)ml & 2one of the above insted of servlet.

%orrect answer is ' A ()planations ' 1he servlet is used to declare a servlet. It contains the declarative data of a servlet. 1he Fsp-file element contains the full path to a /7< file within the web application beginning with a >5>. If a Fsp-file is specified and the load-on-startup element is present, then the /7< should be precompiled and loaded. Questions no -;; Any re4uests from the client to access the resources in +(#-I235 directory 0671 be returned with a ________ ?

options A 7%_281_3862& # 7%_I21(.2A9_7(.:(._(..8. % (7%_#A&_.(Q6(71 & #A&_.(Q6(71 %orrect answer is ' A ()planations ' Any re4uests from the client to access the resources in +(#-I235 directory 0671 be returned with a 7%_281_3862& -$"$ Questions no -;$ response.

1he e)ception-type element specifies an e)ception type and is used to handle e)ceptions generated from a servlet. +hich element of the deployment descriptor includes the e)ception-type as a sub-element?

options A error-page # error-path % e)ception-page & e)ception-page-info %orrect answer is ' A

()planations ' 1he element error-page includes the element web-app. 1his is the page e)ecute when any e)ception occurs.

Potrebbero piacerti anche