Modified Ass2
Modified Ass2
ion2of60:
JSTLI
ntr
oduct
ion
Howmanynumber
sar
epr
int
ed,
whent
hef
oll
owi
ngJSTLcodef
ragmenti
sexecut
ed?
<%@ tagl i
buri
="htt
p:/
/jav
a.sun.
com/ j
sp/
jst
l/
cor
e"pref
ix="
c"%>
<c:f
orEachv ar
="it
em"begin="0"end="
10"st
ep="
2">
${i
tem}
</c:
forEach>
1.1
2.5
3.6
4.11
Answer -3
Quest
ion3of60:
JDBCBasi
cConcept
s
Fil
lintheblank.
The_ ___
_______packagecontai
nscl
assesthathelpinconnect
ingt
oadat abase,
sendingSQLst atementstothedat
abase,andprocessi
ngthequeryresul
ts.
1.connecti
on.sql
2.db.sql
3.pkg.sql
4.java.
sql
Correct
-4
Quest
ion4of60:
JDBCBasi
cConcept
s
Whichofthefol
l
owingiscorr
ectaboutDri
ver
Manager.
regist
erDr
iver
()methodcall
?
1.Thi
smet hodi
susedtoregist
erthedat
abasedri
ver
.
2.Thi
sstati
cmethodisusedincaseyouareusi
nganon- JDKcompliantJVM,such
astheoneprovi
dedbyMicrosoft
.
3.All
oftheabove
4.Noneoftheabove
Corr
ect
-3
Quest
ion6of60:
JDBCBasi
cConcept
s
Whichofthefol
lowingmeansthatt
heResul
tSetcanonl
yber
ead?
1.Resul
tSet
.CONCUR_ READ_ONLY
2.Resul
tSet
.CONCUR_ UPDATABLE
3.Resul
tSet
.READ_ONLY
4.Resul
tSet
.UPDATABLE
SubmitAnswer
Corr
ect-
1
Questi
on7of60: JDBCBasicConcept
s
Quest
ion8of60:
JDBCBasi
cConcept
s
Fil
lintheblank.
The_ ___
_______
__methodexecut
esanSQLst
atementt
hatmayr
etur
nmul
ti
ple
result
s.
1.executeUpdate()
2.executeQuery()
3.execute()
4.noexecute()
Correct
-3
Quest
ion10of60:
UMLFundament
als
Fi
llinthebl
ank.
YoushoulduseaSequencedi agram to________
____
_______
__.
1.i
ndicatehowobjectsinteractandi nwhator deri
nagi v
ensi t
uati
on
2.descri
behowobj ectsrelatedwi t
heachot her
3.repr
esentwhatactionsext ernaluserscanper f
orm byint
eracti
ngwit
ht hesystem
anditsenvi
ronment
4.i
ndicatetheov
erallstr
uct ureofasy stem andthei
rdependenciesandinter
faces
Quest
ion11of60:
Desi
gnPat
ter
nsi
nJav
a
Fi
lli
nt heblank.
ThefunctionofAbst r
actFactoryisto_ ____
_____
.
1.Provideani nt
erf
acef orcreati
ngfami l
iesofrelat
edobj
ect
swithoutspeci
fyi
ngt
hei
r
concreteclasses
2.Declareani nt
erf
acef oroperati
onst hatcreat
eabstr
actpr
oducts
3.Declareani nt
erf
acef orat y
peofpr oductobjects
4.I
mpl ementt heAbstractPr
oductinterface
uest
ion13of60:
Ser
vlet
sBasi
cs
Whi
choft
hef
oll
owi
ngst
atement
sisFALSEf
orgener
icSer
vlet
?
1.Gener
icServ
leti
slikeAbst
ractcl
ass.
2.Gener
icServ
lethasaservi
cemet hodtopr
ocessrequest
.
3.Gener
icServ
letext
endsHttpServ
letandover
ri
desdoGet()&doPost
().
4.Al
loftheabove
Quest
ion14of60:
Ser
vlet
sBasi
cs
Whatwillbetheout put?
publi
cclassHelloServletextendsHttpServl
et{
prot
ectedvoiddoGet (HttpServl
etRequestrequest
,Ht
tpSer
vlet
Responser
esponse)
thr
owsSer vl
etException,IOExcepti
on{
doPost(r
equest,response) ;}
prot
ectedv oiddoPost(Htt
pServl
etRequestr
equest
,Ht
tpSer
vlet
Responser
esponse)
thr
owsSer vletExcept
ion,I
OExcepti
on{
doGet(r
equest ,r
esponse);}}
1.Compi l
ati
oner ror
2.Runti
meer ror
3.Inf
ini
teloop
4.Show" Hello"onwebpage
Quest
ion15of60:
Ser
vlet
sBasi
cs
Tosendbi naryoutputi
naresponse,whi
chofthefol
l
owi ngmethodof
HttpServletResponsemaybeusedt ogettheappr
opri
ateWrit
er/St
ream obj
ect
.
1.getStream
2.getOut putStr
eam
3.getBinaryStream
4.getWr i
ter
Correct-
2
Quest
ion16of60:
Ser
vlet
sBasi
cs
Howtoinit
iali
zeaservl
et?
1.Byusi
ngconstruct
or
2.Byusi
ngi ni
t
3.Al
loftheabove
4.Noneoftheabove
Cor
rect
-2
Quest
ion17of60:
Ser
vlet
sBasi
cs
I
denti
fythecorr
ectserv l
etl
ifecycle.
1.ser
vletl
oadi
ng,servleti
nstance, i
nit
,serv
ice,
anddestr
oy
2.i
nit
,serv
letl
oading,servl
etinstance,serv
ice,
anddestr
oy
3.i
nit
,serv
leti
nstance,servl
etloading,serv
ice,
anddestr
oy
4.i
nit
,serv
ice,
destroy,serv
letinstance,andservl
etl
oadi
ng
Quest
ion18of60:
Ser
vlet
sBasi
cs
Whi
choft
hef
oll
owi
ngi
susedt
oredi
rectt
her
esponsef
rom aser
vlett
oaJSPpage?
1.response.sendRedir
ect(
)
2.request.
sendRedirect
()
3.request.
forward(
)
4.response.for
ward()
Correct
-1
Quest
ion19of60:
WebAppl
i
cat
ionBasi
cs
Whichisusedt
osepar
atemult
ipleat
tri
but
esi
ngetmet
hod?
1.&
2.,
3.+
4.?
Questi
on20of60:WebAppl
i
cat i
onBasics
I
denti
fythelocati
onofcompi
l
edcl
assf
il
eswi
thi
nawarf
il
e?
1./META-INF/cl
asses
2./cl
asses
3./WEB-INF/cl
asses
4.D./
root/cl
asses
Corr
ect-
3
Quest
ion21of60:
WebAppl
i
cat
ionBasi
cs
Fi
lli
ntheblank.
Theini
tparameternameandv
aluepai
rst
hatar
edef
inedi
nweb.
xml
arehandl
edby
___
____.
1.Serv
let
Configobj
ect
2.Serv
let
Contextobj
ect
3.Serv
let
Requestobject
4.Serv
let
Responseobject
Quest
ion22of60:
JSPAct
ions
Fi
lli
nthebl ank.
Whenusi ngthe<jsp:
useBean/ >t oref
erenceaJav
aBeanf
orusewi
thi
naJSP,
thei
d
att
ri
butedef i
nes____
__ _
__ _
_____.
1.Theclassnameoft heJav aBean
2.Thepackagenameoft heJavaBean
3.Theinstancenameoft heJav aBean
4.Defi
nesnot hi
ngast hereisnoi datti
rbute
Quest
ion23of60:
JSPAct
ions
Whichoft hef ol
l
owi ngall
owssubst
it
uti
onofcodet
ooccuratt
het
ransl
ati
ont
imei
n
aJSPpage?
1.<j
sp:include>Tag
2.<@ i
ncl ude>directi
ve
3.<@ page>di r
ective
4.Declarationbl
ock
Quest
ion24of60:
Ser
vletLi
stener
s
Fil
li
ntheblank.
These_______
__ __
___arenotif
iedwhenat
tri
but
esar
eaddedt
o,r
emov
edf
rom,
or
repl
acedinanysessi on.
1.Sessi
onat t
ributel
istener
s
2.Servl
etcontextattr
ibutel
ist
eners
3.Sessi
onlist
ener s
4.Servl
etcontextli
stener
Quest
ion25of60:
Ser
vletLi
stener
s
Whichli
steneri
susedt oprocesscont
extcr
eat
ionanddest
ruct
ion?
1.Servl
etCont
extLi
stener
2.Servl
etCont
extAtt
ri
buteLi
stener
3.Htt
pConextList
ener
4.All
oftheabov e
Quest
ion26of60:
Ser
vletFi
l
ter
s
Whi
choft
hef
oll
owi
ngar
eval
i
dli
stenerel
ement
s?
1.
<servlet>
<servlet-
name>Ser vl
etIWantToListenTo</ ser vl
et-name>
<servlet-
class>com.example.My Servlet</servlet-
cl ass>
</servlet
>
2.
<l
istener>
<l
istener-class>com.example.Li
stener A</list
ener -class>
</l
istener>
3.
<l
istener>
<l
istener-class>com.example.Li
stener B</list
ener -
cl ass>
<l
istener-type>Sessi
on</l
istener-t
ype>
</l
istener>
4.
<l
istener>
<l
istener-class>com.example.Li
stener C</list
ener -class>
<descr i
ption>Asessionli
stener.</description>
</l
istener>
5.
<l
istener>
<l
istener-class>com.example.ReqListener </l
istener -cl
ass>
<servlet-
name>Ser vl
etIWantToListenTo</ ser vl
et-name>
</l
istener>
1.1and2
2.2and4
3.3and5
4.4and5
Correct-2
Quest
ion27of60:
Lear
nJav
aUni
tTest
ing
I
fwerunthetestsui
teasJUni
tTest
,whatwi
l
lbet
heor
derofexecut
ionofal
lthe
f
ourt
estclasses?
@RunWi t
h( Suite.class)
@SuiteClasses( {
Annot ati
onsTest s.class,
Asser t
Test s.class,
CalculateTest .class,
Empl oyeeTest .
class
})
1.1)Annot ationsTest s2)Cal
culateTest3)Empl oyeeTest4)Assert
Tests
2.1)Annot ati
onsTest s2)Asser t
Tests3)CalculateTest4)EmployeeTest
3.1)Annot ationsTest s2)Cal
culateTest3)Asser t
Tests4)EmployeeTest
4.1)Empl oy eeTest2)Cal cul
ateTest3)AssertTests4)Annotati
onsTests
Correct-
2
Quest
ion28of60:
Lear
nJav
aUni
tTest
ing
Whichofthefol
l
owi ngmet hodofAsser tclasschecksthatanobj
ecti
snul
l
?
1.v
oidassert
(Objectobj
ect,booleant oCheckAsNull
)
2.v
oidassert
Check(Objectobject,booleantoCheckAsNull
)
3.v
oidassert
Null
(Objectobject)
4.v
oidassert
Checks(Objectobject,booleantoCheckAsNull
)
Quest
ion29of60:
Cor
eJav
a
Whichonewi l
lal
l
owt
rav
ersi
ngaJav
acol
l
ect
ioni
neachdi
rect
ion?
1.List
It
erator
2.It
erator
3.MapIterator
4.SetI
terator
Quest
ion30of60:
Cor
eJav
a
I
nJav a,whi
chmet
hodi
susedt
oinf
ormt
heobser
veroft
hechangei
nobser
ved
object?
1.Check
2.Updat e
3.I
nf orm
4.notify
Quest
ion31of60:
Cor
eJav
a
Pickthecor r
ectJavamet
hodr
efer
enceusages.
1.object
::i
nstanceMet
hod
2.Class:
:stat
icMethod
3.Class:
:new
4.Alloftheabov e
Correct
-4
Quest
ion32of60:
Cor
eJav
a
I
nJav a,i
tisNOTpossi
blet
oov
err
idedef
aul
tser
ial
i
zat
ion.
1.True
2.False
Answer-False
Quest
ion34of60:
Cor
eJav
a
Picktheclasst
hati
sNOTpar
tofJav
acol
l
ect
ionf
ramewor
k.
1.Map
2.List
3.Queue
4.Struct
Correct
-4
Quest
ion35of60:
Cor
eJav
a
I
dentifythepartsofl
ambdaexpr
essi
oni
nJav
a.
i
.Name
i
i.Paramet erl
i
st
i
ii
.Body
i
v.Ret ur
nTy pe
1.i
2.iv
3.iandiv
4.ii
andi ii
Correct
-4
Quest
ion36of60:
Cor
eJav
a
JavaFuncti
onalI
nter
facecanbedef
inedas_
___
_.
1.Si
mpleAbstractMarkup
2.Si
mpleActiveMarkup
3.Si
ngleAmbivalueMethod
4.Si
ngleAbstr
actMethod
Corr
ect-
4
Quest
ion37of60:
Cor
eJav
a
WhichisthecorrectAPItomanager eact
ivest
reamsi
nJav
a?
1.j
ava.ut
il
.concurr
ent.
Flow
2.j
ava.ut
il
.concurr
ent.
Flow.Publi
sher
3.j
ava.ut
il
.concurr
ent.
Flow.Processor
4.All
oftheabov e
Quest
ion39of60:
Cor
eJav
a
I
nJav a,whichoft
hef
oll
owi
ngdat
ast
ruct
urecl
assesCANNOTbet
ype
parameter
ized?
1.List
2.Set
3.Array
4.Map
Cor
rect
-3
Quest
ion40of60:
Cor
eJav
a
Whichoft heseOOPSconcepti
senabl
edbymet
hodov
err
idi
ngi
nJav
a?
1.Polymor phi
sm
2.Abstraction
3.I
nheritance
4.Encapsul at
ion
Quest
ion41of60:
Cor
eJav
a
Whati
stheoutputofthef
oll
owi
ngJavacodesnippet
?
cl
assFi
rst
{
publ
i
cFirst
(){Sy
stem.
out
.pr
int
ln(
"F"
);}
}
cl
assSecondext
endsFi
rst
{
publ
i
cSecond(
){Syst
em.
out
.pr
int
ln(
"S"
);}
}
cl
assThi
rdext
endsSecond
{
publi
cThi
rd(
){System.
out
.pr
int
ln(
"T"
);}
}
publ
iccl
assTest
Class
{
publ
i
cstati
cvoi
dmain(
Str
ing[]ar
gs)
{
Thi
rdc=newThird(
);
}
}
1.TSF
2.T
3.F
4.FST
Quest
ion42of60:
Cor
eJav
a
Whichofthefol
l
owingtypesofJav
amet
hodsCANNOTbeTy
pepar
amet
eri
zed?
1.Fi
nalmethods
2.Over
ridi
ngmethods
3.Over
loadedmethods
Quest
ion44of60:
Spr
ingAOP
Whichannotat
ionrepr
esentsanadv
icetobeexecut
edaf
tert
hemet
hodexecut
ion
onl
yifmethodexit
sbyt hr
owinganexcept
ion?
1.@Before
2.@After
3.@Around
4.@After
Throwing
Corr
ect-
4
Quest
ion45of60:
Spr
ingAut
o-Wi
ri
ng
Whatattr
ibuteisaddedint
hebean.
xml
tor
educeorel
i
minat
etheneedof<pr
oper
ty>
and<constructor
-ar
g>?
1.Autodi
scov er
y
2.Autowi
re
3.Scope
4.Auto-
detect
Quest
ion46of60:
Spr
ingCor
eConcept
sandLi
fecy
cle
Quest
ion47of60:
Spr
ingDependencyCheck,
InnerbeansandScopes
WhichCol l
ect
ionselement sdoesSpringsuppor
t?
1.Li
st,hashmap, arr
ayl
ist,andset
2.Li
st,props,hashmaps, andarr
ayli
st
3.Li
st,set,map,andprops
4.Hashmaps, array
li
st,
list,andt
reemap
Quest
ion48of60:
Spr
ingDependencyCheck,
InnerbeansandScopes
Whatisthediff
erencebetweenCl assPat
hXMLAppl
i
cati
onCont
extand
Fi
lePathXMLApplicati
onContext
?
1.Fi
rstonereadsf r
om appli
cati
onclasspat
handsecondonereadsf
rom absol
ute
fi
lepath.
2.Fir
stonereadsfr
om appli
cat
ionclasspat
handsecondonereadsfr
om rel
ati
vef
il
e
path.
3.Fir
stonereadsfr
om rel
ati
veappl
icati
onclasspat
handsecondonereadsfr
om
absolut
efi
lepath.
4.Noneoftheabove
Quest
ion49of60:
Spr
ingDependencyCheck,
InnerbeansandScopes
TheDependencyLookupi samethodologywherewegettheresour
ceafterdemand.
Therecanbev ariousway
stogettheresour
ce.TypesofDependencyLookupincl
ude:
1.Factor
yMet hod
2.JNDIMet hod
3.KeyWor dMet hod
4.Alloft
heabov e
Corr
ect-
4
Quest
ion50of60:
Spr
ingDependencyCheck,
InnerbeansandScopes
Whichistheal ter
nat
ivet
ocr
eat
e,l
oad,
andmanagebeansi
naSpr
ingAppl
i
cat
ion?
1.Appli
cationFactor
y
2.ContextFactory
3.BeanFact or
y
4.Spri
ngBeanFact or
y
Corr
ect-3
Quest
ion51of60:
Spr
ingDependencyCheck,
InnerbeansandScopes
Whi
choft
hef
oll
owi
ngdecl
arat
ionsofi
nnerBeansar
ecor
rect
?
Quest
ion52of60:
Spr
ingDependencyCheck,
InnerbeansandScopes
Whendoy
ouuseDependencyI
nject
ion?
A.DIi
sv er
yusef
ulfordecoupli
ngy oursystem.
B.DIi
smostusefulwheny ouareaimingf orcoder
euse.
C.DIhel
psindesi
gningti
ghtlycoupledcode.
D.DIdoesNOThelpinunittesti
ngthecode.
1.AandC
2.BandC
3.AandB
4.AandD
Quest
ion53of60:
Spr
ingJav
aConf
igur
ati
on
Whichofthef ol
lowingisanexampleofj
ava-basedconf
igur
ati
on?
1.<context:
annotation-
confi
g/>
2.@Conf igurat
ionpubli
cclassHell
oWorl
dConfig{.
.}
3.@Autowi red
4.Appli
cat i
onContextcontext=newCl
assPathXmlAppl
i
cati
onContext
("
Beans.
xml
")
;
Quest
ion54of60:
Spr
ingJDBC
DoesSpr i
ngpr ov
ideprogrammat i
ctransact
ionmanagement
?
1.Yes,wit
ht heTransacti
onTempl at
eclass
2.Yes,wit
ht heTransacti
onServi
ceclass
3.Yes,usi
ngt he@Tr ansact
ionalbeanpostprocessor
4.No,Springdoesnotpr ovi
detransacti
onalmanagement
Quest
ion55of60:
Spr
ingJDBC
Assuming@Transact
ionalannot
ati
onsupporti
senabl
edandtransf
erMoneymethod
i
scall
edthr
oughaSpr ingAOPproxy,whati
sthebehav
ioroft
hef ol
l
owingcode
sample?
@Transacti
onal
(propagat
ion=Propagat
ion.
REQURIED)
publ
icvoidtr
ansferMoney(Accountsr
c,Accountt
arget
,doubl
eamount
){
add(
src,
-amount);
add(
src,
amount);
}
@Transact
ional
(pr
opagati
on=Propagat
ion.
REQUI
RED_
NEW)
publ
icvoi
dadd(Accountaccount,
Doubl
eamount){
//I
MPLEMENTATI ON
}
1.Theadd()met hodexecutescodeinanewt ransacti
on.
2.Theadd()met hodusesthetransact
ionofthetransfer
Money
()met
hod.
3.Whencal l
i
ngtheadd()met hod,anexcept
ionist hr
own.
4.Otherbehavi
orisexpect
ed.
Quest
ion56of60:
Spr
ingJDBC
Whatmethodshoul dbei
nvokedont
heconnect
ionobjectt
oensur
ethatt
heuser
-
managedtransact
ionhastobecommit
tedexpl
i
cit
ly?
1.set
Commi t(
fal
se)
2.set
Aut
oCommi t
(fal
se)
3.set
Rol
lBackOnly(
)
4.commit(
)
Quest
ion57of60:
Spr
ingORM andMVC
Quest
ion58of60:
Spr
ingSt
ereot
ypeAnnot
ati
ons
Spri
nghandlesobjectcreationinordert
obenon-
inv
asi
ve.Cany
oui
dent
if
ywhi
ch
defi
nit
ioncr
eatesaspr i
ng- managedobject?
1.Str
ingmyObj;
2.@Aut owi
redpri
vateStringmy Obj;
3.pri
vateSt
ringmy Obj=newSt ri
ng("
spri
ng")
;
4.@Spr i
ngStri
ngmy Obj =null;
Quest
ion60of60:
Spr
ingSt
ereot
ypeAnnot
ati
ons
Howmanyty
pesofaut
owi
ri
ngmodesar
esuppor
tedi
nSpr
ing?
1.Three
2.Fi
ve
3.Si
x
4.Four