1. When a JSP page is compiled, what is it turned into? A. Applet B. Servlet C. Application D. ailet Blan!

" When a JSP page is compiled, what is it turned into? Answer #B$% Compiled JSP pages are turned into Servlets. See JSP Architecture &or more in&ormation on this translation phase. '. Which o& the &ollowing is not a standard method called as part o& the JSP li&e c(cle? A. )sp*nit#$

B. )spService#$

C. +)spService#$

D. )spDestro(#$ Blan! "

Which o& the &ollowing is not a standard method called as part o& the JSP li&e c(cle? Answer #B$% ,he standard service method &or JSP has an + in its name. See JSP Architecture.

-. *& (ou want to override a JSP &ile.s initiali/ation method, within what t(pe o& tags must (ou declare the method? A. 01 12

B. 031 32

C. 03 32

D. 034 32 Blan! " *& (ou want to override a JSP &ile.s initiali/ation method, within what t(pe o& tags must (ou declare the method? Answer #D$% Declarations are placed within a set o& 034 32 tags. See Declarations.

5. Which o& the &ollowing can not 6e used as the scope when using a JavaBean with JSP?

re7uest D. . page Blan! " Which o& the &ollowing can not 6e used as the scope when using a JavaBean with JSP? Answer #D$% 9esponse is not a valid o6)ect scope &or JavaBeans #or an(thing else$.. . . A. application B. See :6)ect Scopes. response.A. and out are onl( visi6le in the +)spService#$ method. response 8.he implicit JSP o6)ects li!e re7uest. session C.

he two methods per&orm identicall(. &orward e@ecutes on the server while send9edirect#$ e@ecutes on the client. 031 page is. 9edirections are done on the client and thus don. C.. See S(nchroni/ation *ssues. and out are onl( visi6le in the +)spService#$ method. the &orwarding is done within the server.hread odel inter&ace? A.t have these limitations. the implicit JSP arguments are onl( visi6le in the )spService#$ method. which can the end user see? A. .hread odel inter&ace? Answer #A$% *& (ou &lag the JSP page as not 6eing thread sa&e. See *ncluding 9e7uests. B.rue B. .send9edirect#$? A. <alse Blan! " .hreadSa&eBCtrueC 32 Blan! " Which o& the &ollowing statements ma!es (our compiled JSP page implement the Single.he implicit JSP o6)ects li!e re7uest. &orward e@ecutes on the client while send9edirect#$ e@ecutes on the server. Which o& the &ollowing statements ma!es (our compiled JSP page implement the Single. See JSP *mplicit :6)ects. response. Answer% #A$ =nless passed in as arguments to other methods. Blan! " What is the !e( di&&erence 6etween using a 0)sp%&orward2 and ?ttpServlet9esponse. A.send9edirect#$? Answer #B$% When (ou &orward a re7uest. 031 page is. D.hreadSa&eBC&alseC 32 B. :& the &ollowing &our valid comment st(les that can 6e used within JSP pages. and limited in scope to where (ou can &orward. it will implement the inter&ace. What is the !e( di&&erence 6etween using a 0)sp%&orward2 and ?ttpServlet9esponse. >.

servlet.com EE2 C.he e@ception is passed along as an attri6ute named C)ava@.his capa6ilit( is not supported.t preserve the state in&ormation re7uiring an unnecessar( round trip to the 6rowser. 03 INN (et another comment NI JavaDoc 9ules 32 Blan! " :& the &ollowing &our valid comment st(les that can 6e used within JSP pages.)sp.he servlet needs to redirect the response to the speci&ic error page. which can the end user see? Answer #B$% :nl( the JavaScript comment can 6e seen &rom the generated page. saving the e@ception o&& in a coo!ie. C is the direct approach. When using a JavaBean to get all the parameters &rom a &orm. . D. 03 II <or Joop &or #int iB1F i0B5F iKK$ L 32 0?03Bi322?ello0I?03Bi322 03 M 32 D. it will automaticall( 6e caught 6( the calling JSP page. 04EE #c$'GGG )Huru. See Comments. . it )ust doesn. When the servlet throws the e@ception. See 8@ception ?andling and the )Huru JSP <AP. B. what must the propert( 6e . Blan! " ?ow can a servlet call a JSP error page? Answer #C$% D will get the 6rowser to displa( the appropriate page. ?ow can a servlet call a JSP error page? A. 1G.03EE ( comments 03 out. . . C. O.he other comments will 6e 6uried in the source &or the generated servlet.println#C?ello WorldC$F 32 EE32 B.)sp8@ceptionC.he servlet needs to &orward the re7uest to the speci&ic error page =9J. .

Con&igure the list o& drivers in the )d6c. 1 D.driver s(stem propert( B. 1.set to #??? in the &ollowing code$ &or automatic initiali/ation? 0)sp%useBean idBC&BeanC classBCgovi. Pass the class name to the &orQame method o& Class D. B Blan! " When using a JavaBean to get all the parameters &rom a &orm. =se JQD* to locate the Driver -. . N B. *n a nonEJQD* environment. what must the propert( 6e set to #??? in the &ollowing code$ &or automatic initiali/ation? Answer #A$% .he N character is used &or this. JDBC is not an acron(m . Call the driver. What does JDBC stand &or? EEB A.<ormBeanC scopeBCre7uestCI2 0)sp%setPropert( nameBC&BeanC propert(BC???C I2 0)sp%&orward pageBCIservletIJSP'ServletC I2 A. See =sing JavaBean Components..s constructor C. all C. Java Data6ase Connectivit( B. Which o& the &ollowing wa(s will not load a JDBC driver?EED A. through which class does one ac7uire a connection to a speci&ic data source?EEB A.

an*nteger$S. B. DataSource O. Create an instance o& the class. what happens when (ou tr( to store the Properties set to a <ile:utputStream?EEC A. Driver anager C.he code won. Connection D. Speci&( the driver or set o& drivers to use 6( setting the )d6c. Data6ase etaData 8. .put#an*nteger. . c. Connection D. through which class does one ac7uire a connection to a speci&ic data source?EE8 A. Which wa( o& loading the data6ase driver can create two instances o& the class?EC A.drivers s(stem propert(.Driver B. Driver B. Data6ase etaData 8. Driver anager C. *n a JQD* environment. *& (ou add an *nteger to a Properties o6)ect via the put method o& ?ashta6le as 6oth the !e( and value Rprops. Pass the class name as a String to the &orQame method o& Class.t compile B. 1. Conte@t A.

?ash ap D.he toString method o& *nteger is called to write 6oth the !e( and value as a String. D. ?ashta6le .. A ClassCast8@ception is thrown 6ecause the value is not a String -. Clonea6le B.ree ap and to the map each !e( reported 6( propert(Qames and its associated value. :& which o& the &ollowing is Properties not a descendent class?EEC A. Create a new . :6)ect B. C..sort on the result. Seriali/a6le . Which o& the &ollowing would sort all the elements in a Properties set. C. Dictionar( C. including the de&aults?EEEB A.ree ap. Create a new . B. Call the toArra( method o& Properties and then call Arra(s. Compara6le C. ap D. passing in the source Properties o6)ect to its constructor. A. Call the sort method o& Collections to sort the whole ap #Properties o6)ect$. Which inter&ace does ?ashta6le not implement?EEB A. A ClassCast8@ception is thrown 6ecause the !e( is not a String D.

t 6e accessed here? M M M A. What options are availa6le &or wor!ing with propert( &iles that re7uire character encoding in other than the de&ault character set?EEED A.F pu6lic void a ethod#int &$ L int g B >F II What can. c. which varia6les are inaccessi6le within the method o& the inner class?EEB class . D. d B. d C.est1 L pu6lic static int a B 1F private static int 6 B 'F pu6lic int c B -F private int d B 5F pu6lic static class *nner L int e B . B. . C. c. Pass the encoding name to the load method o& Properties. =se the native'ascii tool to convert propert( &iles to other character encoding. Pass the encoding name to the constructor call o& the Properties o6)ect. Pass the encoding name to the *nputStream9eader constructor and then pass that 9eader on to the load method o& Properties. 1G. 6. *n the &ollowing class de&inition.O.

*n the &ollowing class de&inition. 6. Qone o& them 11. c. d.t 6e accessed here? M M M A. c. d B. which varia6les are inaccessi6le within the method o& the inner class? EEE8 class . c. d .6. & D.F pu6lic void a ethod#int &$ L int g B >F II What can.est' L pu6lic static int a B 1F private static int 6 B 'F pu6lic int c B -F private int d B 5F pu6lic class *nner L int e B .

d. 6.F class *nner L int g B >F pu6lic void another ethod#int h$ L II What can?t 6e accessed here? M M M M A.est. & 8. d.L pu6lic static int a B 1F private static int 6 B 'F pu6lic int c B -F private int d B 5F pu6lic void a ethod#int e$ L int & B . c. Qone o& them 1'.C. c. d . which varia6les are inaccessi6le within the method o& the inner class? EEEB class . & D. c. *n the &ollowing class de&inition.

1-.println#CCount% C K KKcount$F M MF M M A. & D.B. & C. . e.s wrong with the &ollowing code? EEED class .println#CHot% C K &$F S(stem. e.out.out. g 8. &. d. c.est5 L pu6lic static void main#String argsRS$ L ouseJistener listener B new ouseAdapter#$ L static int countF pu6lic void mouse8ntered# ouse8vent e$ L process*t#e$F M private void process*t# ouse8vent &$ L S(stem. Qone o& them. What. e.

he code compiles &ine.' D. 1. Where were inner classes introduced into the Java programming language s(nta@?EEB A. 15.t implemented. Qothing is wrong. C. B.G B.t have static declarations. *nner classes can. .Anon(mous inner classes can onl( implement inter&aces. 1. . 8. 1. All the methods o& ouseJistener aren.t have support methods. 1.1 C. D. *nner classes can.8.

ethod customi/ation C. 1. Which mechanism does the tool use? EEEC A. An application 6uilder tool can anal(/e how JavaBeans wor!. ?ow a JavaBean is compiled and dropped into the BeanBo@ #or other tool$. Properties control what aspects o& a JavaBean? EEEB A. Drop the Bean into the BeanBo@ propert( sheet. D. B. C. Declare the instance varia6le private and let the BeanBo@ de&ine get and set methods &or the varia6le.5 1. B. 8vent delegation -. '.he tools (ou can use to customi/e a JavaBean. . A JavaBean. De&ine a get method and a set method &or the varia6le. What do (ou have to do to ma!e an instance varia6le into a JavaBean propert(? EEEB A. 1>.1.s appearance and 6ehavior. *ntrospection D. Declare the instance varia6le pu6lic and static. . C. D. . Persistence B..he communication 6etween JavaBeans.

oolBo@. Can 6e reused more rapidl( than widgets. C.a!e up less storage space that widgets. . . D. . B. 8vents B. ?owever. while the Bean that receives the event is called a EEEA A. 8vent?andler Bean >. Can 6e run 6( more tools on more plat&orms than widgets. . A. JavaBeans and widgets are 6oth considered to 6e reusa6le so&tware components. 8nterprise JavaBean D. JavaBeans di&&er &rom widgets 6ecause Beans EEEB A. . BeanBo@. and Properties windows. De&ine a designEtime inter&ace that tools can 7uer(. 9eceiver Bean C. 8vent listeners D. Jistener Bean B. JavaBean methods are all EEED A. A source Bean is a JavaBean that &ires an event. Properties C..5.s Tit.he BeanBo@ is a JavaBean testing tool that comes with the Bean Developer.he BeanBo@ has the &ollowing windows% EEEA A. *dentical to methods o& other Java classes .

Properties and . . a( 6e inherited 6( the Bean &rom its superclass. JavaBeans communicate with each other using events. =sing the BeanBo@ 8dit E2 8vents menu and resulting dialog 6o@ to hoo! up one Bean to another. Are de&ined 6( the Bean itsel&. ?aving the BeanBo@ generate the special adapter class. and Harage windows. An( o& the a6ove choices.oolBo@ windows. D. . Writing a special adapter class. O. Uou esta6lish the connection 6etween Beans 6(% EEED A. BeanBo@. . 1G.s propert(. C. and WindowsOD windows. D. D. B.oolBo@. Uou use the Propert( sheet in the BeanBo@ tool to EEEC A. B. . Add new properties to a Bean.s propert(. such as action events. Delete a Bean. All o& the a6ove.B. C. C.oolBo@. Change the value o& a Bean. C. BeanBo@.he properties o& a Bean EEED A. B. D.

Can 6e saved and retrieved at a later time. What do (ou have to do to 6e a6le to test the Bean in the BeanBo@? EEE8 A. 11. B. 8. D. D.Are analogous to instance varia6les. C. A and B onl(. 1'. Compile the Bean. Some JavaBeans are not meant to 6e visi6le and are re&erred to as invisi6le Beans. When (ou write the code &or a new JavaBean. All o& the a6ove. B. All o& the a6ove. ?ave no H=* representation. Are invisi6le in 6uilder tools. 8. Qone o& the a6ove. C. 1-. ?as a corresponding get method and set method. All o& the a6ove. B. (ou can test it in the BeanBo@. D. . A propert( de&ined in a JavaBean t(picall( EEED A. Such invisi6le Beans EEE8 A. Qone o& the a6ove. 8. *s declared as a private t(pe. Are a6le to &ire events and save persistent state.

s class &ile. . 1. B. 1>. 15. =se get &ollowed 6( the propert( name. D.. A mani&est &ile &or a JavaBean contains the &ollowing in&ormation% EEED A. C. All o& the a6ove. Which !inds o& properties can a Bean contain? EEEB A. D.he name o& the JavaBean. A. A and B. A list o& the properties declared 6( the JavaBean. D. Joad the JA9 &ile into the BeanBo@ using the JoadJar menu option. Qone o& the a6ove. or place the JA9 &ile in the de&ault director( &rom which the BeanBo@ initiali/es and loads its Beans. Comple@ properties and 8ventEhandling properties . =se onl( the propert( name &or the get method. 8. An indicator that this is a JavaBean. B. Create an e@ecuta6le JA9 &ile &or the Bean class and mani&est &ile. with the &irst letter o& the propert( name capitali/ed. and C. &orm the method name as &ollows% EEEC A. C.Create a mani&est &ile &or the Bean. C. When (ou write a get method &or a JavaBean propert(. B. =se an( name (ou want &or the get method. 8.

he addPropert(ChangeJistener method so a Bean can register an interest in noti&ication o& changes to the propert(. . 8. Constrained properties are EEEB .he &irePropert(Change method to send propert( change noti&ication to interested Beans. Bound properties C. actionPer&ormed event B. D onl( H. Simple properties. All o& the a6ove 1D. . All o& the a6ove 1A.B. mouse pressed event D. D.he addActionJistener method so a Bean can register an interest in noti&ication o& changes to the propert(. . Constrained properties. A and C <. C. B. Bound properties appear in the BeanBo@ with what !ind o& event in the 8dit E2 8vents menu? EEEB A. A JavaBean that de&ines 6ound properties t(picall( calls what methods so that other Beans can 6e noti&ied o& changes to the 6ound propert(? EEE8 A. mouse moved event 1O. propert(Change event C. .he reportChange method to send propert( change noti&ication to interested Beans.

C. . *dentical to 6ound properties e@cept that the( are onl( used on certain plat&orms. D. *dentical to 6ound properties e@cept that the listener Bean can veto the propert( change. B. Qone o& the a6ove.A. *dentical to 6ound properties e@cept that the( are inde@ed.