This document contains multiple choice questions related to Java EE, J2EE, servlets, and sessions. Some key topics covered include:
- Recommended packaging for enterprise beans in J2EE applications
- Methods for attaching session IDs to URLs for redirect
- Tools that can be used to share data between servlets
- Session tracking techniques in J2EE
- The lifecycle of a servlet and how it is managed
This document contains multiple choice questions related to Java EE, J2EE, servlets, and sessions. Some key topics covered include:
- Recommended packaging for enterprise beans in J2EE applications
- Methods for attaching session IDs to URLs for redirect
- Tools that can be used to share data between servlets
- Session tracking techniques in J2EE
- The lifecycle of a servlet and how it is managed
Q. Which of these packaging options of enterprise beans are
recommended for most J2EE applications? (a) Package each enterprise bean for an application in its own EJB module (b) Package all enterprise beans for an application in one EJB module (c) Package all related enterprise beans for an application in one EJB module (d) None of These Q. You want to use UR rewriting to support client browsers! which do not use cookies. Which method will "ou use to attach the session id to a UR that is to be used for the sendRedirect#$ method of the %ttp&er'letResponse? (a) encodeUR (b) encodeRedirectUR (c) encode!essionUR (d) encode!essionRedirectUR Q. Which of the following should ()* be used to share data between ser'lets in a distributed web application? (a) "ttributes of !er#let$onte%t (b) Enterprise Ja#a Beans (c) "ttributes of &ttp!ession (d) 'atabase Q. Which enterprise bean t"pe is defined without an" client 'iew interfaces? (a) B(P Entit) bean (b) $(P Entit) bean (c) !tateful !ession bean (d) (essage 'ri#en Bean Q. Your application supports multiple client t"pes including %**+ clients. Your business la"er is implemented using Enterprise Ja'a ,eans. Which of the following is best suited for maintaining client state? (a) !tateful session beans (b) Entit) Beans (c) &ttp!ession attributes (d) $ookies J2-E Q. . Ja'a 'irtual machine/ #J0-$ supporting 121 has no support for3 (a) *loating point numbers (b) Reflection (c) JN+ (d) "ll of the abo#e Q. *he -42+ user interface .+4 is a subset of the .W*5 +ro6ect &wing libraries? (a) *alse (b) True Q. Which class would "ou use to write applications to access low7 le'el input e'ents or to issue graphics calls for drawing to the displa"? (a) ,rong (b) 'ispla) (c) $ommand (d) !creen Q. *he heart of the 8eneric 1onnection framework is? (a) -a#a%.microedition.$onnection (b) -a#a%.microedition.$onnection (c) -a#a%.microedition.!tream$onnectio (d) -a#a%.microedition.&ttp$onnection Q. Which one of the following methods of the -42let abstract class must be implemented b" a midlet? (a) init"pp/ start"pp (b) start"pp/ destro)"pp (c) init"pp/ start"pp/ pause"pp/ destro)"pp (d) start"pp/ pause"pp/ destro)"pp Q. Which of the following techni9ues can be used for wireless session tracking? (a) $ookies (b) UR Rewriting (c) &idden *ields (d) None of the abo#e Q. 4f a midlet needs to recei'e high7le'el e'ents from the implementation! which interface should it implement? (a) "ctionistener (b) $ommandistener (c) ,indows istener (d) $hoiceistener Q. .ll -42+ 8U4 classes are contained in what package? (a) -a#a%.microedition.gui (b) -a#a%.microedition.lcd (c) -a#a%.microedition.lcdui (d) -a#a%.microedition.displa) x= b b 2 4ac 2a . . midlet is a Ja'a class that e:tends the abstract class? (a) -a#a%.microedition.(+'let (b) -a#a%.microedition.midlet (c) -a#a%.microedition.midlet.(+'let (d) -a#a%.microedition.midlet.midlet Q. .ll -42+ implementations are re9uired to support what image format? (a) 0+* (b) JP0 (c) B(P (d) PN0 J&+ Q. *he ; < return= < > simpl" aborts the processing of J&+? (a) true (b) false (c) can1t sa) (d) None of the abo#e Q. *he listener is notified when the &er'let conte:t #i.e.! the Web application$ is initiali?ed and destro"ed ? (a) !er#let conte%t attribute (b) !er#let conte%t listeners (c) !ession "ttribute (d) !ession isteners Q. What is the possible wa" of communication between applet and &er'let ? (a) &TTP $ommunication (Te%t2based and ob-ect2based) (b) !ocket $ommunication (c) R(+ $ommunication (d) "ll of the abo#e Q. Which of the following statements is true about J&+ tag librar"? (a) +t defines the standard tag that works the same e#er)where (b) +t is a single librar) and we can use it in multiple -sp containers (c) +t has support for the common structural tasks like iteration and condition. (d) "ll of the abo#e Q. UR1onnection instance represents a link for accessing or communicating with the resource at the location? (a) true (b) false (c) can1t sa) (d) None of the abo#e Q. *he ma:imum length of the session 4d#length identifier$ is @@@@@@@@@@@? (a) 3k (b) 4k (c) 5k (d) 6k Q. 4f the session ob6ect is in'alidated can it be again regained or refreshed? (a) 7es (b) No (c) $an1t sa) (d) None of the abo#e Q. What tools can be used to generate the multiple 'iews in 6sp ? (a) %alan2J (b) !a%on (c) Jdk8.9 (d) None of the abo#e Q. *he 6sp3use,ean attribute is used to indicate the &eriali?ed bean? (a) true (b) false (c) can1t sa) (d) none of the abo#e Q. *he session tracking in the J&+ can be done b" (a) UR rewriting (b) $ookies (c) User2"uthori:ation (d) &idden #alue J2,1 Q. %ow man" transaction isolation le'els are defined in 6a'a.s9l.1onnection interface? (a) 3 (b) ; (c) 9 (d) 4 Q. When the message A(o &uitable 2ri'erB occurs? (a) ,hen the dri#er is not registered b) $lass.forname() method (b) ,hen the user name/ password and the database does not match (c) ,hen the J'B$ database UR passed is not constructed properl) (d) ,hen the t)pe 3 dri#er is used Q. .re prepared statements actuall" compiled? (a) 7es/ the) compiled (b) No/ the) are bound b) the J'B$ dri#er Q. Which of the following methods finds the ma:imum number of connections that a specific dri'er can obtain? (a) 'atabase.get(a%$onnections (b) $onnection.get(a%$onnections (c) 'atabase(eta'ata.get(a%$onnections (d) Result!et(eta'ata.get(a%$onnections Q. *he class 6a'a.s9l.*imestamp has its super class as (a) -a#a.s<l.Time (b) -a#a.util.'ate (c) -a#a.util.Time (d) None of the abo#e Q. .ll raw data t"pes #including binar" documents or images$ should be read and uploaded to the database as an arra" of (a) b)te (b) int (c) boolean (d) char Q. Which dri'er is efficient and alwa"s preferable for using J2,1 applications? (a) T)pe = 3 (b) T)pe = 8 (c) T)pe = ; (d) T)pe = 4 Q. *he J2,17)2,1 ,ridge supports multiple concurrent open statements per connection? (a) True (b) *alse &er'e lets Q. *he J2,17)2,1 bridge is (a) Three tiered (b) (ultithreaded (c) Best for an) platform (d) "ll of the abo#e Q. J2,1 facilitates to store the 6a'a ob6ects b" using which of the methods of +repared&tatement /. set)b6ect #$ 2. set,lob#$ C. set1lob#$ (a) 8/ 4 (b) 8/4/; (c) 8/; (d) 4/; Q. What are the mechanisms a'ailable in &er'let1onte:tistener interface? (a) conte%t+nit()/ conte%t!er#ice()/ conte%t'estro)ed() (b) conte%t+nitiali:ed(()/conte%t'estro)ed() (c) conte%t+nitiali:ed()/ conte%t!er#ice()/ conte%t'estro)ed() (d) None of the abo#e Q. %ow man" &er'let1onte:t ob6ects are a'ailable for an entire web application? (a) >ne each per ser#let (b) >ne each per re<uest (c) >ne each per response (d) >nl) one Q. *he init parameter name and 'alue pairs that are defined in web.:ml file are handled b" (a) !er#let$onfig ob-ect (b) !er#let$onte%t ob-ect (c) !er#letRe<uest ob-ect (d) !er#letResponse ob-ect Q. *he life c"cle of a ser'let is managed b" (a) ser#let conte%t (b) ser#let container (c) the supporting protocol (such as http or https) (d) all of the abo#e Q. &er'let mapping defines (a) an association between a UR pattern and a ser#let (b) an association between a UR pattern and a re<uest page (c) an association between a UR pattern and a response page (d) "ll of the abo#e Q. . ser'let maintain session in (a) !er#let container (b) !er#let conte%t (c) !er#let re<uest heap (d) !er#let response heap Q. *he method forward#re9uest!response$ will (a) return back to the same method from where the forward was in#oked (b) not return back to the same method from where the forward was in#oked and the web pages na#igation continues (c) Both " and B are correct (d) None of the abo#e Q. *he tasks D authentication7blocking of re9uests! data compression! logging and auditing D are performed b" (a) ser#let filter (b) ser#let config (c) ser#let conte%t (d) ser#let container Q. *he get&ession#$ method with EtrueF as its parameter G get&ession#true$ H it will return the appropriate session ob6ect when (a) the session is completed (b) the session ob-ect is passed to another method (c) the session does not e%ists (d) the session is e%isting Q. Which of the following are the session tracking techni9ues? (a) UR rewriting/ using session ob-ect/ using response ob-ect/ using hidden fields (b) UR rewriting/ using session ob-ect/ using cookies/ using hidden fields (c) UR rewriting/ using ser#let ob-ect/ using response ob-ect/ using cookies (d) UR rewriting/ using re<uest ob-ect/ using response ob-ect/ using session ob-ect Q. Which method is used to specif" before an" lines that uses the +intWriter? (a) setPageT)pe() (b) set$onte%tT)pe() (c) set$ontentT)pe() (d) setResponseT)pe() Q. Which method cannot be called b" a stateful session bean using bean7managed transactions? (a) getUserTransaction() (b) getRollback>nl)() (c) get!tatus() (d) None of these Q. WhatIs the difference between ser'lets and applets? (a) !er#lets e%ecutes on !er#ers/ where as "pplets e%ecutes on Browser (b) !er#lets ha#e no 0U+/ where as an "pplet has 0U+ (c) !er#lets creates static web pages/ where as "pplets creates d)namic web pages (d) !er#lets can handle onl) a single re<uest/ where as "pplet can handle multiple re<uests Q. . ser'let needs to ac9uire a data source through a J(24 naming lookup. Which of the following is the best place to do this? (a) $onstructor (b) init method (c) ser#ice method (d) do0et method Q. 4f the %**+ error JKK is generated b" "our ser'let! "ou do not want to show the L4nternal &er'er ErrorL page to the client. 4nstead! "ou want a custom error page to be displa"ed. What is the best wa" to accomplish this? (a) *orward the user to the error page using &ttp!er#letResponse.sendRedirect method. (b) *orward the user to the error page using Re<uest'ispatcher.forward method. (c) !pecif) the mapping of the error2code 9?? and the error page in the deplo)ment descriptor. (d) +t is not possible to accomplish this. &et /
Q. ME.*URE& of automatic memor" management in .(et (a) "llocating memor) (b) Releasing memor) (c) +mplementing finali:ers (d) "ll of the abo#e
(Ebook) VLSI design by Das, Debaprasad ISBN 9780198094869, 9781680158717, 0198094868, 1680158716 - Download the ebook now for instant access to all chapters
(Ebook) VLSI design by Das, Debaprasad ISBN 9780198094869, 9781680158717, 0198094868, 1680158716 - Download the ebook now for instant access to all chapters