Vous êtes sur la page 1sur 29

3

More NextBlog

CreateBlog SignIn

TCSAspireQuizand
assignments
AlltheanswersforthequizandassignmentsneededforaspireILP

Saturday,21July2012

BlogArchive

TCSaspirecommunicationquizsolutions:TCSaspire
communicationquizsolutions:Question1...

2012(13)

TCSaspirecommunicationquizsolutions:TCSaspirecommunicationquizsolutions:
Question1...:TCSaspirecommunicationquizsolutions:Question1of2010.0PointsWhatdoes
thisBod...:Question1of2010.0PointsWhatdoes...

July(11)
TCSaspirecommunicationquiz
solutions:TCSaspir...
WebtechnologyQuiz1
UNIXASSIGNMENT1Answers
UNIXQUIZANSWERS

PostedbyRitzonblogsat08:13

Nocomments:

+1 Recommend this on Google

UnixAssignment2Answers
softwareengineeringquizanswers
IntroductiontoJavabasicsAssignment
2

WebtechnologyQuiz1
WebtechnologyQuiz1
1.WhatisthecorrectsyntaxofthedeclarationwhichdefinestheXMLversion?
Option:a.<?xmlversion="1.0"?>
b.<xmlversion="1.0"/>
c.<xmlversion="1.0"?/>
d.Noneoftheabove
e.<?xmlversion="1.0"?/>
Ans:a

IntroductiontoJavabasicsAssignment
1
IntroductiontoJavabasicsQuiz1You
wantsu...
DatabaseconceptsAssignment1
solutions
BasicsofProgrammingAssignment1
solutions
June(2)

AboutMe

2.Whatisthecorrectsyntaxforreferringtoanexternalscriptcalled"xxx.js"?
option:a.None
b.<scripttype="text/javascript"name="xxx.js">
c.<scripttype="text/javascript"href="xxx.js">
d.<scripttype="text/javascript"src="xxx.js">
ans:d

3.WhatisthecorrectHTMLforreferringtoanexternalstylesheet?
option:a.<stylesheet>mystyle.css
b.Noneoftheabove
c.<stylesrc="mystyle.css"/>
d.<link="stylesheet"type=text/css/scripthref="mystyle.css">
e.<linkrel="stylesheet"type="text/css"href="mystyle.css"/>
Ans:e

4.WhatcanyouusetoreplacelikewithhateinIlikeEminem?
Option:a.preg_replace("/like/","/hate/","IlikeEminem")
b.preg_replace("hate","like","IlikeEminem")
c.preg_replace("/like/","hate","IlikeEminem")
d.Noneoftheabove
e.preg_replace("like","hate","IlikeEminem")
ans:e

5.Whatarethegenralsyntaxforinlineimage?
Option:a.Noneoftheabove
b.img=file

Ritzonblogs
Follow

Viewmycompleteprofile

c.imgsrc=file
d.src=image
e.imagesrc=file
Ans:c

1.Whatarethegeneralsyntaxforinlineimage?
Ans:imgsrc=file
2.Whatisthecorrectsyntaxforreferringtoanexternalscriptcalled"xxx.js"?
Ans:<scripttype="text/javascript"src="xxx.js">
3.WhatisthecorrectsyntaxofthedeclarationwhichdefinestheXMLversion?
Ans:<?xmlversion="1.0"?>
4.Whatcanyouusetoreplacelikewithhateinilikeeminem?
Ans:preg_replace("like","hate","ilikeeminem")
5.WhatisthecorrectHTMLforreferringtoanexternalstylesheet?
Ans:<linkrel="stylesheet"type=text/css"href="mystyle.css"/>

HowdoesJavaScriptstoredateinadateobject?

A.ThenumberofsecondssinceNetscape'spublicstockoffering.

B.Noneoftheoptions

C.ThenumberofmillisecondssinceJanuary1st,1970

D.ThenumberofdayssinceJanuary1st,1900
ansc

WhatdoesCSSdefineinHTML?

A.HowtosendHTMLelements

B.HowtosaveHTMLelements

C.HowtomadeHTMLelements

D.HowtodisplayHTMLelements
ANSD

Amongthefollowingoptions,selectthecommandthatyoucanusetolinkapagewithanHTML
page?

A.<alink=\"page.htm\"></a>

B.<aconnect=\"page.htm\"></a>

C.<ahref=\"page.htm\"?
phpMyAdmin=70ac9566533a2665b6597346aab7f985&phpMyAdmin=f43d4e0b88acea2d2a393515f
6bf38f2></a>

D.<aattach=\"page.htm\"></a>
ansc

QSTN__JavaScriptisalsocalledserversideJavaScript.A.MicrosoftB.NavigatorC.LiveWire

D.Native
Ansc

QSTNThe<BR>Tag
ANSResetmargins

QSTNYouusedCSSclassintoyourhtml,butdividedyourpagewithoutbreakline.Whichof
followingwouldyouhavetouse?
AnsThe<div>tag

QSTNHowwouldyousetaCSScomment?
ANS"/*","*/",

QSTNHowwouldyoudefineCSSpadding?'
ANSp{padding:2%border:1pxsolidblack}
h5{padding:0pxborder:1pxsolidred}

QSTNWhichofthefollowingpopupboxeswouldyouusetogetsomeinformationfromtheuser?
ANSprompt

PostedbyRitzonblogsat08:06

Nocomments:

+1 Recommend this on Google

UNIXASSIGNMENT1Answers
UNIXASSIGNMENT1Answers
Question1:Writeacommandtolistallthefilesinsideafolderi.e.ifthereisafolderinside
a folder then it should list all files inside the subfolder which is inside the folder to be
listed.
Answer1:lsR
Question2:Searchallthefileswhichcontainsaparticularstring,sayincludewithina
folder.
Answer2:foriin*.*dogreplinclude$idone
Question3:RenameallthefileswithinafolderwithsuffixUnix_i.e.supposeafolder
hastwofilesa.txtandb.pdfthantheybothshouldberenamedfromasinglecommandto
Unix_a.txtandUnix_b.pdf

Answer3:foriin*.*domv$iUnix_$idone
Question4:Renameallfileswithinafolderwiththefirstwordoftheircontent(remember
allthefilesshouldbetextfiles.Forexampleifa.txtcontainsUnixisanOSinitsfirst
linethena.txtshouldberenamedtoUnix.txt
Answer4:foriin*.txtdoj="$(head1$i|cutf1d"").txt"mv"$i""$j"done
Question5:SupposeyouhaveaCprojectinafoldercalledproject,itcontains.cand
.hfiles,italsocontainssomeother.txtfilesand.pdffiles.WriteaLinuxcommandthatwill
count the number of lines of your text files. That means total line count of every file.
(rememberyouhavetocountthelinesin.txtfilesonly)
Answer5:wcl*.txt
Question 6 : Rename all files which contain the substring 'foo', replacing it with 'bar'
withinagivenfolder.
Answer6:foriin./*foo*domv"$i""${i//foo/bar}"done
Question 7 : Show the most commonly used commands from history. [hint: remember
thehistorycommand,usecut,andsortit.
Answer7:history|cutf6d""|sort

PostedbyRitzonblogsat08:05

Nocomments:

+1 Recommend this on Google

UNIXQUIZANSWERS
UNIXQUIZANSWERS
lscommandinUNIX
A.Liststhefilesinadirectory
B.Comparethesizeoftwofiles
C.Givesthecurrentlyloggedsessiondetails
D.Comparestwonumeralsandprintsthelowervalue
AnswerKey:A
[Tips:lscommandinUNIXlistsallthecontentsinadirectory.Lscanbeusedwithmany
optionstodisplayadditionaldetails]
#Question2of1010.0Points
WhichamongthefollowingisnotapartofUNIXoperatingsystem
A.Programs
B.Libraries
C.Kernel
D.Shell
AnswerKey:B
[Tips:Libraries.TheUNIXoperatingsystemismadeupofthreepartsthekernel,theshelland
theprograms.]
#Question3of1010.0Points
InUNIX,theshellactasaninterfacebetweenuserand
A.Kernel
B.OperatingSystem
C.Hardware
D.Programs
AnswerKey:A
[Tips:Theshellactsasaninterfacebetweentheuserandthekernel.Whenauserlogsin,the
loginprogramcheckstheusernameandpassword,andthenstartsanotherprogramcalledthe
shell.Theshellisacommandlineinterpreter(CLI).Itinterpretsthecommandstheusertypesin
andarrangesforthemtobecarriedout.]
#Question4of1010.0Points
EverythinginUNIXis
A.None
B.aProcess
C.afileoraprocess
D.aFile
AnswerKey:C
[Tips:EverythinginUNIXiseitherafileoraprocess.Aprocessisanexecutingprogram
identifiedbyauniquePID(processidentifier).Afileisacollectionofdata.Theyarecreatedby
usersusingtexteditors,runningcompilersetc.]
#Question5of1010.0Points
WhichcommandisusedforchangingdirectoryinUNIX?
A.mkdir

B.cd
C.chgdir
D.cddir
AnswerKey:B
[Tips:Thecommandcddirectorymeanschangethecurrentworkingdirectorytodirectory.The
currentworkingdirectorymaybethoughtofasthedirectoryyouarein,i.e.your
currentpositioninthefilesystemtree.]
#Question6of1010.0Points
InUNIX,filepermissionsarenotsetfor
A.User
B.Otherusers
C.Devices
D.UserGroups
AnswerKey:C
[Tips:Everydirectoryandfileonthesystemhasanowner,andalsoanassociatedgroup.Italso
hasasetofpermissionflagswhichspecifyseparateread,writeandexecutepermissionsforthe
user(owner),group,andother(everyoneelsewithanaccountonthecomputer)]
#Question7of1010.0Points
InUnix,howcanyoureadthemanualhelppagesaboutacommand
A.Typehelpandthecommand
B.Typeoptionsandthecommand
C.Typedetailsandthecommand
D.Typemanandthecommand

AnswerKey:D
[Tips:ToseewhatallaLinuxcommandcando,typeman.Thiswillshowyouthemanual
ofthespecifiedcommand.]
#Question8of1010.0Points
WhichisthemostcommontexteditorinUNIX?
A.Visualeditor
B.notepad
C.Word
D.Openoffice

AnswerKey:A
[Tips:ThedefaulteditorthatcomeswiththeUNIXoperatingsystemiscalledvi(visualeditor).
AlternateeditorsforUNIXenvironmentsincludepicoandemacs,aproductofGNU.]
#Question9of1010.0Points
Youhavecreatedashellscriptandwantstorunthescript.Whatshouldyoudobeforetryingto
runthescript?
A.Noactionrequired
B.Compilethescripttocreatetheexecutable
C.Updatetheexecutepermissionofthescript
D.Giveownershipofthefiletosystemadmin

AnswerKey:C
[Tips:Youhavetoupdatetheexecutepermissionofthescriptusingthecommandchmod]
#Question10of1010.0Points
Whichisvalidmodeofoperationinvieditor?
A.TypingmodelscommandinUNIX

B.CommandMode
C.Appendmode
D.Openmode
AnswerKey:B

PostedbyRitzonblogsat08:04

Nocomments:

+1 Recommend this on Google

UnixAssignment2Answers
UnixAssignment2Answers
1.Create a tree structure named training in which there are 3 subdirectories

level1,level2andcep.Eachoneisagainfurtherdividedinto3.Thelevel1
isdividedintosdp,reandse.Fromthesubdirectorysehowcanonereach
thehomedirectoryinonestepandalsohowtonavigatetothesubdirectorysdp
inonestep?Givethecommands,whichdotheaboveactions?
Ans:Tonavigatefromsetohome,thecommandiscd
Tonavigatetosdpfromsecd/home/training/level1/sdp

2.Howwillyoucopyadirectorystructuredir1todir2?(withallthesubdirectories)

Ans:cpRdir1dir2

3.Howcanyoufindoutifyouhavethepermissiontosendamessage?

Ans:lsl

4.Find

the space occupied ( in Bytes) by the /home directory including all its
subdirectories.

Ans:dusb

5.Whatisthecommandforprintingthecurrenttimein24hourformat?

Ans:date+%Rordate+%H:%M:%S

6.Whatisthecommandforprintingtheyear,month,anddatewithahorizontaltab

betweenthefields?
Ans:date+%Y%t%m%t%d

7.Create the following files: chapa, chapb, chapc, chapd, chape, chapA, chapB,

chapC,chapD,chapE,chap01,chap02,chap03,chap04,chap05,chap11,chap12,
chap13,chap14,andchap15.

Ans:cat>chapa
typeContentsoffile
Ctrl+D
cat>chapb
typeContentsoffile
Ctrl+D
cat>chapc
typeContentsoffile
...
cat>chap14
typeContentsoffile
Ctrl+D
cat>chap15
Contentsoffile
Ctrl+D

8.Withreference to question 7, What is the command for listing all files ending in

smallletters?

Ans:find.name*[az]

9.Withreference to question 7, What is the command for listing all files ending in

capitals?
Ans:find.name*[AZ]

10.Withreferencetoquestion7,Whatisthecommandforlistingallfileswhoselast

butonecharacteris0?
Ans:find.name*0?

11.Withreferencetoquestion7,Whatisthecommandforlistingallfileswhichendin

smalllettersbutnotaandc?
Ans:find.name*[^ac]orfind.name*[bdz].*or

12.In an organisation one wants to know how many programmers are there. The

employeedataisstoredinafilecalledpersonnelwithonerecordperemployee.
Everyrecordhasfieldfordesignation.Howcangrepbeusedforthispurpose?
Ans:grepcprogrammerpersonnel

13.Intheorganisationmentionedinquestion12howcansedbeusedtoprintonlythe

recordsofallemployeeswhoareprogrammers.
Ans:sedn/programmer/ppersonnel

14.Intheorganisationmentionedinquestion12howcansedbeusedtochangethe

designation programmer to software professional every where in the


personnelfile
Ans:sedes/programmer/softwareprofessional/gpersonnel

15.Findoutaboutthesleepcommandandstartfivejobsinthebackground,eachone

sleepingfor10minutes.
Ans:sleep600&sleep600&sleep600&sleep600&sleep600&

16.Howdoyougetthestatusofalltheprocessesrunningonthesystem?i.e.using

whatoption?
Ans:ps
PostedbyRitzonblogsat08:04

Nocomments:

+1 Recommend this on Google

softwareengineeringquizanswers
softwareengineeringquiz

Question1of1010.0Points
Requirementscanbeclassifiedintotwotypes,namely,functionalrequirementsandnon
functionalrequirements

True

False

AnswerKeyTrue

Question2of1010.0Points
Someexamplesofnonfunctionalrequirementsare.

1.Numberofsignificantdigitstowhichaccuracyshouldbemaintainedinallnumerical
calculationsis10
2.Theresponsetimeofthesystemshouldalwaysbelessthan5seconds
3.ThesoftwareshouldbedevelopedusingClanguageonaUNIXbasedsystem
4.Thematrixdiagonalisationroutineshouldzerooutalloffdiagonalelements,whichareequalto
orlessthan103
5.Experiencedofficersshouldbeabletouseallthesystemfunctionsafteratotaltrainingoftwo
hours.Afterthistraining,theaveragenumberoferrorsmadebyexperiencedofficersshouldnot
exceedtwoperday.

True

False
AnswerKeyTrue

Question3of1010.0Points
Everysoftwaresystemhasthefollowingessentialcharacteristics

A.Ithasprocesseswhichcollaboratewitheachothertogeneratetheoutputs.

B.Alltheabove

C.Ithasaboundary.Theboundaryseparateswhatiswithinsystemscopeandwhatis
outside.

D.Thesystemmayalsousedatastorestostoredatawhichhasalifebeyondthesystem.

E.Theseprocessesoperateondatabycreating,modifying,destroying,andqueryingit.

F.Ittakesinputsfromexternalagentsandgeneratesoutputs.
AnswerKeyB

Question4of1010.0Points
ERDcomplementsDFD.WhileDFDfocusesondataandtherelationshipsbetweenthem,ERD
focusesonprocessesanddataflowbetweenthem
True

False

AnswerKeyFalse

Question5of1010.0Points
PolymorphismItisthemeansbywhichanoperationbehavesdifferentlyindifferentcontexts.
True

False

AnswerKeyTrue

Question6of1010.0Points
EncapsulationThishelpsincontrollingthevisibilityofinternaldetailsoftheobjects.Itimproves
securityandintegrityofdata
True

False
AnswerKeyTrue

Question7of1010.0Points
Thereare4typesofAbstraction,namelyEntity,Action,Virtualmachine&Coincidental.
True

False

AnswerKeyTrue

Question8of1010.0Points
Therecanbemorethanonehashfieldsonafile.

True

False

AnswerKeyFalse

Question9of1010.0Points
Concurrencyreferstomultipletransactionsaccessingthesamedatabaseatthesametime.Ina
systemwhichallowsconcurrency,somekindofcontrolmechanismhastobeinplacetoensure
thatconcurrenttransactionsdonotinterferewitheachother.

True

False

AnswerKeyTrue

Question10of1010.0Points
Softwaregeneticdevelopmentprocesscontainsthreegeneticphrasesnamely
A.Softwareengineering,Definition,Coding

B.Definition,development,maintenance

C.Coding,design,Softwareengineering

D.Design,Coding,Development

E.Development,Definition,Testing

AnswerKeyB
1.WhichofthefollowingConstructinformalmodelinsoftwareengineeringexecuteeach
statementinsuccession.
Chooseoneanswer.
a.IterationConstruct.
b.StatementConstruct.
c.SelectionConstruct.
d.BusinessConstruct.
e.SequenceConstruct.

Anse

2.Whatissoftwareengineering
Chooseoneanswer.
a.Softwareengineeringimplementasingleindependentfunction
b.Setofcomputerprograms,proceduresandpossiblyassociateddocumentconcernedwiththe
operationofdataprocessing.
c.Noneoftheabove
d.Softwareengineeringistheestablishmentanduseofsoundengineeringpracticeinorderto
produceeconomicalandreliablesoftwarethatwillperformefficientlyonrealmachine
e.SoftwareengineeringisDesign,Coding,Development

ansd

3.Whatisasoftware

Chooseoneanswer.

a.Amathematicalformulae
b.Asetofcompilerinstructions.
c.Noneoftheabove
d.Setofcomputerprograms,proceduresandpossiblyassociateddocumentconcernedwiththe
operationofdataprocessing.
e.Alloftheabove

ansd

4.Whichofthefollowingtranslatorsconverthighlevellanguageonstatementbystatementbasis
Chooseoneanswer.
a.Interpreter.
b.Assembler
c.Machinelevellanguageconverter
d.Compiler

ansa

5.WhichofthefollowingisnotanexampleofPrototypeinengineeringparadigm
Chooseoneanswer.
a.Paperprototype.
b.Softwareprototype.
c.Existingprototype.
d.Engineeringprototype.
e.Workingprototype.

ansa

Question1of1010.0Points
Requirementscanbeclassifiedintotwotypes,namely,functionalrequirementsandnon
functionalrequirements
True
False
AnswerKeyTrue

#Question2of1010.0Points
Someexamplesofnonfunctionalrequirementsare.
1.Numberofsignificantdigitstowhichaccuracyshouldbemaintainedinallnumerical
calculationsis102.Theresponsetimeofthesystemshouldalwaysbelessthan5seconds
3.ThesoftwareshouldbedevelopedusingClanguageonaUNIXbasedsystem
4.Thematrixdiagonalisationroutineshouldzerooutalloffdiagonalelements,whichareequalto
orlessthan103
5.Experiencedofficersshouldbeabletouseallthesystemfunctionsafteratotaltrainingoftwo
hours.Afterthistraining,theaveragenumberoferrorsmadebyexperiencedofficersshouldnot
exceedtwoperday.
True
False

AnswerKeyTrue

#Question3of1010.0Points
Everysoftwaresystemhasthefollowingessentialcharacteristics
A.Ithasprocesseswhichcollaboratewitheachothertogeneratetheoutputs.
B.Alltheabove
C.Ithasaboundary.Theboundaryseparateswhatiswithinsystemscopeandwhatisoutside.
D.Thesystemmayalsousedatastorestostoredatawhichhasalifebeyondthesystem.
E.Theseprocessesoperateondatabycreating,modifying,destroying,andqueryingit.
F.Ittakesinputsfromexternalagentsandgeneratesoutputs.

AnswerKeyB

#Question4of1010.0Points
ERDcomplementsDFD.WhileDFDfocusesondataandtherelationshipsbetweenthem,ERD
focusesonprocessesanddataflowbetweenthem
True
False

AnswerKeyFalse

#Question5of1010.0Points
PolymorphismItisthemeansbywhichanoperationbehavesdifferentlyindifferentcontexts.
True
False

AnswerKeyTrue

#Question6of1010.0Points
EncapsulationThishelpsincontrollingthevisibilityofinternaldetailsoftheobjects.Itimproves
securityandintegrityofdata
True
False

AnswerKeyTrue

#Question7of1010.0Points
Thereare4typesofAbstraction,namelyEntity,Action,Virtualmachine&Coincidental.
True
False

AnswerKeyTrue

#Question8of1010.0Points
Therecanbemorethanonehashfieldsonafile.
True
False

AnswerKeyFalse

#Question9of1010.0Points
Concurrencyreferstomultipletransactionsaccessingthesamedatabaseatthesametime.Ina
systemwhichallowsconcurrency,somekindofcontrolmechanismhastobeinplacetoensure
thatconcurrenttransactionsdonotinterferewitheachother.
True
False

AnswerKeyTrue

#Question10of1010.0Points
Softwaregeneticdevelopmentprocesscontainsthreegeneticphrasesnamely
A.Softwareengineering,Definition,Coding
B.Definition,development,maintenance
C.Coding,design,Softwareengineering
D.Design,Coding,Development
E.Development,Definition,Testing

AnswerKeyB
PostedbyRitzonblogsat08:02

Nocomments:

+1 Recommend this on Google

IntroductiontoJavabasicsAssignment2
Introduction to Java basicsAssignment 2
1.CreateawashingmachineclasswithmethodsasswitchOn,acceptClothes,
acceptDetergent,switchOff.acceptClothesacceptsthenoofClothesasargument&returnstheno
ofClothes.
/*washingmachine*/
importjava.util.*
classWashingMachine
{
Scannerinput=newScanner(System.in)
publicvoidswitchOn()
{
System.out.println("Thelidisopen.")
}
publicvoidstart()
{
System.out.println("Startwashing...")
}
publicvoidacceptDetergent()
{
System.out.println("AddingDetergent..")
start()
}
publicintacceptClothes()
{
System.out.println("Enternoofclothes:")
intno=input.nextInt()
returnno
}
publicvoidswitchOff()
{
System.out.println("Thelidisclosed.")
}
publicstaticvoidmain(String[]args)
{
WashingMachinewm=newWashingMachine()
wm.switchOn()
intnumOFClothes=wm.acceptClothes()
wm.acceptDetergent()
wm.switchOff()
System.out.println(numOFClothes+"clothesgetwashed")
}
}

2.Createacalculatorclasswhichwillhavemethodsadd,multiply,divide&subtract
/*calculator*/
importjava.util.*
classCalculation
{
publicintadd(inta,intb)
{
returna+b
}
publicintsubtract(inta,intb)
{
if(a>b)
{
returnab
}
else
{
returnba
}
}
publicintmultiply(inta,intb)
{
returna*b
}

publicintdivide(inta,intb)
{
if(a>b)
{
returna/b
}
else
{
returnb/a
}
}
}
publicclassCalculator
{
publicstaticvoidmain(String[]args)
{
Calculationcal=newCalculation()
intadd=cal.add(5,10)
intsub=cal.subtract(5,10)
intmul=cal.multiply(5,10)
intdiv=cal.divide(5,10)
System.out.println(add)
System.out.println(sub)
System.out.println(mul)
System.out.println(div)
}
}

3.CreateaclasscalledStudentwhichhasthefollowingmethods:
i.Average:whichwouldacceptmarksof3examinations&returnwhetherthestudenthas
passedorfaileddependingonwhetherhehasscoredanaverageabove50ornot.
ii.Inputname:whichwouldacceptthenameofthestudent&returnsthename?

/*Studentresults*/
importjava.util.*
publicclassStudent
{
Scannerinput=newScanner(System.in)
publicStringaverage()
{
System.out.print("EnterMarks1:")
doublem1=input.nextDouble()
System.out.print("EnterMarks2:")
doublem2=input.nextDouble()
System.out.print("EnterMarks3:")
doublem3=input.nextDouble()
doubletm=m1+m2+m3
doubleavg=tm/3
if(avg<50)
{
return"Failed"
}
if(avg>50)
{
return"Passed"
}
return""
}
publicStringgetName()
{
System.out.println("EnterName:")
Stringname=input.nextLine()
Stringresult=average()
returnname+"get"+result
}
publicstaticvoidmain(String[]args)
{
Studentdata=newStudent()
StringnameAndResut=data.getName()
System.out.println(nameAndResut)
}

4.CreateaBankclasswithmethodsdeposit&withdraw.Thedepositmethodwould
acceptattributesamount&balance&returnsthenewbalancewhichisthesumofamount
&balance.Similarly,thewithdrawmethodwouldaccepttheattributesamount&balance&returns
thenewbalance?balance?amount?ifbalance>=amountorreturn0otherwise.
/*bankcalculations*/
importjavax.swing.*
classCustomer
{
intbal
Customer(intbal)
{
this.bal=bal
}
intdeposit(intamt)
{
if(amt<0)
{
System.out.println("InvalidAmount")
return1
}
bal=bal+amt
return0
}
intwithdraw(intamt)
{
if(bal<amt)
{
System.out.println("Notsufficientbalance.")
return1
}
if(amt<0)
{
System.out.println("InvalidAmount")
return1
}
bal=balamt
return0
}
voidcheck()
{
JOptionPane.showMessageDialog(null,"Balance:"+Integer.toString(bal))
}
}
publicclassBank
{
publicstaticvoidmain(String[]args)
{
CustomerCust=newCustomer(1500)
Stringst1=JOptionPane.showInputDialog(null,"Entertheamounttodeposit:")
intdep=Integer.parseInt(st1)
intbal1=Cust.deposit(dep)
Cust.check()
Stringst2=JOptionPane.showInputDialog(null,"Entertheamounttowithdraw:")
intwith=Integer.parseInt(st2)
intbal2=Cust.withdraw(with)
Cust.check()
}
}
5.CreateanEmployeeclasswhichhasmethodsnetSalarywhichwouldacceptsalary&tax
asarguments&returnsthenetSalarywhichistaxdeductedfromthesalary.Alsoithasa
methodgradewhichwouldacceptthegradeoftheemployee&returngrade.
/*employeesal&tax*/
importjava.util.*
classEmployee
{
staticScannerinput=newScanner(System.in)
publicdoublenetSalary(doublesalary,doubletaxrate)
{
doubletax=salary*taxrate
doublenetpay=salary=tax
returnnetpay

}
publicstaticStringgrade()
{
System.out.print("EnterGrade:")
Stringgrade=input.next()
returngrade
}
publicstaticvoidmain(String[]args)
{
Employeeemp=newEmployee()
System.out.print("EnterSalary:")
doublesal=input.nextDouble()
System.out.print("EnterTaxin%:")
doubletaxrate=input.nextDouble()/100
Stringg=emp.grade()
doublenet=emp.netSalary(sal,taxrate)
System.out.println("NetSalaryis:"+net)
System.out.println("Gradeis:"+g)
}
}

6.CreateProducthavingfollowingattributes:ProductID,Name,CategoryIDandUnitPrice.
CreateElectricalProducthavingthefollowingadditionalattributes:VoltageRangeandWattage.
AddabehaviortochangetheWattageandpriceoftheelectricalproduct.Displaythe
updatedElectricalProductdetails.
/*electricalproduct*/
importjava.util.*
classProduct
{
intproductID
Stringname
intcategoryID
doubleprice
Product(intproductID,Stringname,intcategoryID,doubleprice)
{
this.productID=productID
this.name=name
this.categoryID=categoryID
this.price=price
}
}
publicclassElectricalProductextendsProduct
{
intvoltageRange
intwattage
ElectricalProduct(intproductID,Stringname,intcategoryID,doubleprice,intvoltageRange,
intwattage)
{
super(productID,name,categoryID,price)
this.voltageRange=voltageRange
this.wattage=wattage
}
publicvoiddisplay()
{
System.out.println("ProductID:"+productID)
System.out.println("Name:"+name)
System.out.println("CategoryID:"+categoryID)
System.out.println("Price:"+price)
System.out.println("VoltageRange:"+voltageRange)
System.out.println("Wattage:"+wattage)
}
publicstaticvoidmain(String[]args)
{
Scannerinput=newScanner(System.in)
System.out.println("EnterProductID:")
intpid=input.nextInt()
System.out.println("EnterName:")
Stringname=input.next()
System.out.println("EnterCatagoryID:")
intcid=input.nextInt()
System.out.println("EnterPrice:")
doubleprice=input.nextDouble()
System.out.println("EnterVoltageRange:")

intvrange=input.nextInt()
System.out.println("EnterWattage:")
intwattage=input.nextInt()
System.out.println("****DetailsofElectricalProduct****")
System.out.println()
ElectricalProductp=newElectricalProduct(pid,name,cid,price,vrange,wattage)
p.display()
}
}

7.CreateBookhavingfollowingattributes:BookID,Title,AuthorandPrice.CreatePeriodical
whichhasthefollowingadditionalattributes:Period(weekly,monthlyetc...).Addabehaviorto
modifythePriceandthePeriodoftheperiodical.Displaytheupdatedperiodicaldetails.
/*Bookdetails*/
importjava.util.*
classBook
{
intid
Stringtitle
Stringauthor
doubleprice
publicvoidsetId(intid)
{
this.id=id
}
publicintgetId()
{
returnid
}
publicvoidsetTitle(Stringtitle)
{
this.title=title
}
publicStringgetTitle()
{
returntitle
}
publicvoidsetAuthor(Stringauthor)
{
this.author=author
}
publicStringgetAuthor()
{
returnauthor
}
publicvoidsetPrice(doubleprice)
{
this.price=price
}
publicdoublegetPrice()
{
returnprice
}
}
classPeriodical
{
Stringtimeperiod
publicvoidsetTimeperiod(Stringtimeperiod)
{
this.timeperiod=timeperiod
}
publicStringgetTimeperiod()
{
returntimeperiod
}
}
publicclassBookInformation
{
publicstaticvoidmain(String[]args)
{
Bookb=newBook()
Periodicalp=newPeriodical()
Scannerinput=newScanner(System.in)
System.out.print("BookID:")

intid=input.nextInt()
b.setId(id)
System.out.print("Title:")
Stringtitle=input.next()
b.setTitle(title)
System.out.print("Author:")
Stringauthor=input.next()
b.setAuthor(author)
System.out.print("Price:")
doubleprice=input.nextDouble()
b.setPrice(price)
System.out.print("Period:")
Stringpp=input.next()
p.setTimeperiod(pp)
System.out.println()
System.out.println("BookInformation")
System.out.println()
System.out.println("BookID:"+b.getId())
System.out.println("Title:"+b.getTitle())
System.out.println("Author:"+b.getAuthor())
System.out.println("Price:"+b.getPrice())
System.out.println("Period:"+p.getTimeperiod())
}
}

8.CreateVehiclehavingfollowingattributes:VehicleNo.,Model,ManufacturerandColor.
Createtruckwhichhasthefollowingadditionalattributes:loadingcapacity(100tons).Adda
behaviortochangethecolorandloadingcapacity.Displaytheupdatedtruckdetails.
/*vehicle*/
importjava.util.*
classVehicle
{
intno
Stringmodel
Stringmanufacturer
Stringcolor
Vehicle(intno,Stringmodel,Stringmanufacturer,Stringcolor)
{
this.no=no
this.model=model
this.manufacturer=manufacturer
this.color=color
}
}
publicclassTruckextendsVehicle
{
intcapacity
Truck(intno,Stringmodel,Stringmanufacturer,Stringcolor,intcapacity)
{
super(no,model,manufacturer,color)
this.capacity=capacity
}
voidshow()
{
System.out.println("No="+no)
System.out.println("Model="+model)
System.out.println("manufacturer="+manufacturer)
System.out.println("Color="+color)
System.out.println("Capacity="+capacity)
}
publicstaticvoidmain(String[]args)
{
Scannerinput=newScanner(System.in)
System.out.println("TruckNo:")
intno=input.nextInt()
System.out.println("Model:")
Stringmodel=input.next()
System.out.println("Manufacturer:")
Stringmanufacturer=input.next()
System.out.println("Color:")
Stringcolor=input.next()
System.out.println("LoadingCapacity:")
intcap=input.nextInt()

Truckt=newTruck(no,model,manufacturer,color,cap)
System.out.println("****TruckDetails****")
System.out.println()t.show()
}
}

9.Writeaprogramwhichperformstoraiseanumbertoapowerandreturnsthevalue.Providea
behaviortotheprogramsoastoacceptanytypeofnumericvaluesandreturnstheresults.
/*powerofgivennumber*/
importjava.util.*
importjava.text.*
classNumberProgram
{
publicstaticvoidmain(String[]args)
{
DecimalFormatdf=newDecimalFormat("##.##")
Scannerinput=newScanner(System.in)
System.out.print("EnterNumber:")
doublenum=input.nextDouble()
System.out.print("RaiseNumber'spower:")
doublepow=input.nextDouble()
doublevalue=Math.pow(num,pow)
System.out.println("Resultis:"+df.format(value))
}
}

10.WriteafunctionModelofCategoryforaTatamotordealers,whichacceptscategoryof
carcustomerislookingforandreturnsthecarModelavailableinthatcategory.thefunction
shouldacceptthefollowingcategories"SUV","SEDAN","ECONOMY",and"MINI"whichinturn
returns"TATASAFARI","TATAINDIGO","TATAINDICA"and"TATANANO"respectively.
/*carproblem*/
importjava.util.*
classTataMotors
{
Stringcategory
Stringmodel
TataMotors(Stringcategory,Stringmodel)
{
this.category=category
this.model=model
}
publicStringgetCategory()
{
returncategory
}
publicStringgetModel()
{
returnmodel
}
publicstaticvoidModelOfCategory(ArrayList<TataMotors>list)
{
Scannerinput=newScanner(System.in)
System.out.print("EnterCategory:")
Stringcategory=input.nextLine()
System.out.println()
System.out.print("Modelis:")
for(TataMotorstm:list)
{
if(tm.getCategory().equals(category))
{
System.out.print(tm.getModel())
}
}
}
publicstaticvoidmain(String[]args)
{
ArrayList<TataMotors>list=newArrayList<TataMotors>()
list.add(newTataMotors("SUV","TATASAFARI"))
list.add(newTataMotors("SEDAN","TATAINDIGO"))
list.add(newTataMotors("ECONOMY","TATAINDICA"))
list.add(newTataMotors("MINI","TATANANO"))

ModelOfCategory(list)
}

}
PostedbyRitzonblogsat08:01

Nocomments:

+1 Recommend this on Google

IntroductiontoJavabasicsAssignment1
IntroductiontoJavabasicsAssignment1
1.Writeaprogramtofindthedifferencebetweensumofthesquaresandthesquareofthesums
ofnnumbers?
Solution:
importjava.io.*
importjava.util.Scanner
classDifference
{
publicstaticvoidmain(Stringargs[])throwsIOException
{
Scanners=newScanner(System.in)
System.out.println("Enterthevalueofn:")
intn=s.nextInt()
inta[]=newint[n]
inti,sqr,diff,sum=0,add=0
System.out.print("The"+n)
System.out.println("numbersare:")
for(i=0i<ni++)
{
a[i]=s.nextInt()
sum+=(a[i]*a[i])
add+=a[i]
}
sqr=add*add
diff=sqrsum
System.out.println("")
System.out.print("SumofSquaresofgiven"+n)
System.out.println("numbersis:"+sum)
System.out.print("SquaresofSumofgiven"+n)
System.out.println("numbersis:"+sqr)
System.out.println("")
System.out.println("Differencebetweensumofthesquaresandthesquareofthesumofgiven
"+n)
System.out.print("numbersis:"+diff)
System.out.println("")
}
}
Output:
Enterthevalueofn:4
The4numbersare:
2
3
4
5
SumofSquaresofgiven4numbersis:54
SquaresofSumofgiven4numbersis:196
Differencebetweensumofthesquaresandthesquareofthesumofgiven4
numbersis:142

2.Developaprogramthatacceptstheareaofasquareandwillcalculateitsperimeter.
Solution:
importjava.util.Scanner
publicclassCalculateSquarePeri
{
/**
*@paramargs
*/
publicstaticvoidmain(String[]args)
{

Scanners=newScanner(System.in)
System.out.println("AreaofSquare:")
doublea=s.nextDouble()
doublep=4*Math.sqrt(a)
System.out.println("")
System.out.print("PerimeteroftheSquare:"+p)
System.out.println("")
}
}
Output:
Enterthearea:
23
Perimeterofthesquareis:19.183326093250876

3.DeveloptheprogramcalculateCylinderVolume.,whichacceptsradiusofacylinder'sbase
diskanditsheightandcomputesthevolumeofthecylinder.
Solution:
importjava.io.*
importjava.util.Scanner
classcalculateCylinderVolume
{
publicstaticvoidmain(Stringargs[])throwsIOException
{
Scanners=newScanner(System.in)
System.out.println("Entertheradius:")
doublerad=s.nextDouble()
System.out.println("Entertheheight:")
doubleht=s.nextDouble()
doublevol=Math.PI*rad*rad*ht
System.out.println("")
System.out.println("Volumeofthecylinderis:"+vol)
}
}
Output:
Entertheradius:
12
Entertheheight:
13
Volumeofthecylinderis:5881.061447520093

4.Utopiastaxaccountantsalwaysuseprogramsthatcomputeincometaxeseventhoughthetax
rateisasolid,neverchanging15%.DefinetheprogramcalculateTaxwhichdeterminesthetaxon
thegrosspay.DefinecalculateNetPaythatdeterminesthenetpayofanemployeefromthe
numberofhoursworked.Assumeanhourlyrateof$12.
Solution:
importjava.util.Scanner
publicclasscalculateTax{
/**
*@paramargs
*/
publicstaticvoidmain(String[]args)
{
Scanners=newScanner(System.in)
System.out.println("Entertheno.ofworkingdaysintheyear:")
intd=s.nextInt()
System.out.println("Entertheno.ofworkinghoursinaday:")
inth=s.nextInt()
System.out.println("Entertheno.ofhoursworkedinovertime:")
intot=s.nextInt()
System.out.println("Entertheno.ofhourstookleave:")
intl=s.nextInt()
doublegross=((d*h)+otl)*12
doubletax=gross*0.15
doublenet=grosstax
System.out.println("")
System.out.println("GrossPay(in$):"+gross)
System.out.println("Tax(in$):"+tax)
System.out.println("NetPay(in$):"+net)
}
}
Output:

Daysworkedbyemployerinayear:
300
Entertheno.ofworkinghoursinaday:
6
Entertheno.ofhoursworkedinovertime:
1
Entertheno.ofhourstookleave:
1560
GrossPay(in$):2892.0
Tax(in$):433.8
NetPay(in$):2458.2

5.Anoldstylemovietheaterhasasimpleprofitprogram.Eachcustomerpays$5perticket.
Everyperformancecoststhetheater$20,plus$.50perattendee.Developtheprogram
calculateTotalProfitthatconsumesthenumberofattendees(ofashow)andcalculateshowmuch
incometheshowearns.
Solution:
importjava.util.Scanner
publicclasscalculateTotalProfit
{
/**
*@paramargs
*/
publicstaticvoidmain(String[]args)
{
Scanners=newScanner(System.in)
System.out.println("Entertheno.ofattendeesofashow:")
intn=s.nextInt()
doubleprofit=(n*5)(20+(n*0.5))
System.out.println("")
System.out.println("TotalProfitofthetheaterpershow(in$)is:"+profit)
}
}
Output:
Entertheno.ofattendeespershow:
50
TotalProfitofthetheaterpershow(in$)is:205.0

6.DeveloptheprogramcalculateCylinderArea,whichacceptsradiusofthecylinder'sbasedisk
and
itsheightandcomputessurfaceareaofthecylinder.

Program:
importjava.util.Scanner

publicclasscalculateCylinderArea
{
/**
*@paramargs
*/
publicstaticvoidmain(String[]args)
{
Scanners=newScanner(System.in)
System.out.println("Enterthebaseradius:")
doublerad=s.nextDouble()
System.out.println("Entertheheight:")
doubleht=s.nextDouble()
doublearea=2*Math.PI*rad*(rad+ht)
System.out.println("")
System.out.println("SurfaceAreaofthecylinderis:"+area)
}
}

Output:
Enterthebaseradius:
12
Entertheheight:
13
SurfaceAreaofthecylinderis:1884.9555921538758

7.DeveloptheprogramcalculatePipeArea.Itcomputesthesurfaceareaofapipe,whichisan
opencylinder.Theprogramaccpetsthreevalues:thepipesinnerradius,itslength,andthe
thicknessofitswall.
Solution:
importjava.util.Scanner
publicclasscalculatePipeArea
{
/**
*@paramargs
*/
publicstaticvoidmain(String[]args)
{
Scanners=newScanner(System.in)
System.out.println("Entertheinnerradius:")
doublerad=s.nextDouble()
System.out.println("Enterthelength:")
doublelen=s.nextDouble()
System.out.println("Enterthethickness:")
doublethick=s.nextDouble()
doublearea=2*Math.PI*(rad+thick)*len
System.out.println("")
System.out.println("SurfaceAreaofthepipeis:"+area)
}
}
Output:
Entertheinnerradius:
13
Enterthelength:
20
Enterthethickness:
5
SurfaceAreaofthepipeis:2261.946710584651

8.DeveloptheprogramcalculateHeight,whichcomputestheheightthatarocketreachesina
givenamountoftime.Iftherocketacceleratesataconstantrateg,itreachesaspeedofgtint
timeunitsandaheightof1/2*v*twherevisthespeedatt.
Solution:
importjava.util.Scanner
publicclasscalculateHeight
{
/**
*@paramargs
*/
publicstaticvoidmain(String[]args)
{
Scanners=newScanner(System.in)
System.out.println("Enterthetime(inseconds):")
doublet=s.nextDouble()
doublev=9.8*t
doubleheight=0.5*v*t
System.out.println("")
System.out.println("Heightreached(inmeters)is:"+height)
}
}
Output:
Enterthetime(inseconds):
300
Heightreached(inmeters)is:441000.0

9.Developaprogramthatcomputesthedistanceaboattravelsacrossariver,giventhewidthof
theriver,theboat'sspeedperpendiculartotheriver,andtheriver'sspeed.Speedis
distance/time,andthePythagoreanTheoremisc2=a2+b2.
Solution:
importjava.util.Scanner
publicclassBoatDistance
{
/**
*@paramargs
*/
publicstaticvoidmain(String[]args)
{
Scanners=newScanner(System.in)
System.out.println("Enterthewidthoftheriver(inmeters):")
doublerw=s.nextDouble()
System.out.println("Entertheriver'sspeed(inmeter/sec):")
doublers=s.nextDouble()
System.out.println("Entertheboat'sspeed(inmeter/sec):")
doublebs=s.nextDouble()
doubletime=rw/bs//timetakestotravelfromshoretoshorestraightbytheboat
doublew2=time*rs//distanceduetodownstream
doublebd=Math.sqrt((rw*rw)+(w2*w2))
System.out.println("")
System.out.println("Thedistancetravelledbyboat(inmeters)is:"+bd)
}
}
Output:
Enterthewidthoftheriver(inmeters):
15
Entertheriver'sspeed(inmeter/sec):
200
Entertheboat'sspeed(inmeter/sec):
250
Thedistancetravelledbyboat(inmeters)is:19.209372712298546

10.Developaprogramthatacceptsaninitialamountofmoney(calledtheprincipal),a
simpleannualinterestrate,andanumberofmonthswillcomputethebalanceattheendofthat
time.Assumethatnoadditionaldepositsorwithdrawalsaremadeandthatamonthis1/12ofa
year.Totalinterestistheproductoftheprincipal,theannualinterestrateexpressedasadecimal,
andthenumberofyears.
Solution:
importjava.util.Scanner
publicclasscalculateBalance{
/**
*@paramargs
*/
publicstaticvoidmain(String[]args)
{
Scanners=newScanner(System.in)
System.out.println("Entertheprincipalamount:")
doublep=s.nextDouble()
System.out.println("Entertheannualinterestrate:")
doubler=s.nextDouble()
System.out.println("Entertheno.ofmonths:")
doublem=s.nextDouble()
doublesi=(p*(m/12)*r)/100
doublebal=p+si
System.out.println("")
System.out.print("Balanceafter"+(int)m)
System.out.println("month(s)is:"+bal)
}
}
Output:
Entertheprincipalamount:
15000
Entertheannualinterestrate:
12
Entertheno.ofmonths:
24
Balanceafter24month(s)is:18600.0


PostedbyRitzonblogsat07:59

Nocomments:

+2 Recommend this on Google

IntroductiontoJavabasicsQuiz1

Youwantsubclassesinanypackagetohaveaccesstomembersofasuperclass.Whichisthe
mostrestrictiveaccessthataccomplishesthisobjective?

A.publicB.private
C.protectedD.transient
Answer&Explanation
Answer:OptionC

QstnpublicclassOuter
{
publicvoidsomeOuterMethod()
{
//Line5
}
publicclassInner{}

publicstaticvoidmain(String[]argv)
{
Outerot=newOuter()
//Line10
}
}
Whichofthefollowingcodefragmentsinserted,willallowtocompile?

A.newInner()//Atline5
B.newInner()//Atline10
C.newot.Inner()//Atline10
D.newOuter.Inner()//Atline10
Answer:OptionA

QstninterfaceBase
{
booleanm1()
bytem2(shorts)
}
whichtwocodefragmentswillcompile?
interfaceBase2implementsBase{}
abstractclassClass2extendsBase
{publicbooleanm1(){returntrue}}
abstractclassClass2implementsBase{}
abstractclassClass2implementsBase
{publicbooleanm1(){return(7>4)}}
abstractclassClass2implementsBase
{protectedbooleanm1(){return(5>7)}}
A.1and2B.2and3
C.3and4D.1and5
Answer&Explanation
Answer:OptionC

QSTNWhichthreeformpartofcorrectarraydeclarations?

publicinta[]

staticint[]a
public[]inta
privateinta[3]
privateint[3]a[]
publicfinalint[]a
A.1,3,4B.2,4,5
C.1,2,6D.2,5,6
Answer&Explanation
Answer:OptionC

Explanation:

qstnpublicclassTest{}
Whatistheprototypeofthedefaultconstructor?
A.Test()B.Test(void)
C.publicTest()D.publicTest(void)
Answer&Explanation
Answer:OptionC

QStNWhatisthemostrestrictiveaccessmodifierthatwillallowmembersofoneclasstohave
accesstomembersofanotherclassinthesamepackage?

A.publicB.abstract
C.protectedD.synchronized
E.defaultaccess
Answer&Explanation
Answer:OptionE

QSTNWhichofthefollowingis/arelegalmethoddeclarations?

protectedabstractvoidm1()
staticfinalvoidm1(){}
synchronizedpublicfinalvoidm1(){}
privatenativevoidm1()
A.1and3
B.2and4
C.1only
D.Allofthemarelegaldeclarations.
Answer&Explanation
Answer:OptionD

QSTNWhichcauseacompilererror?

A.int[]scores={3,5,7}
B.int[][]scores={2,7,6},{9,3,45}
C.Stringcats[]={"Fluffy","Spot","Zeus"}
D.booleanresults[]=newboolean[]{true,false,true}
E.Integerresults[]={newInteger(3),newInteger(5),newInteger(8)}
Answer&Explanation
Answer:OptionB

QSTNYouwantaclasstohaveaccesstomembersofanotherclassinthesamepackage.
Whichisthemostrestrictiveaccessthataccomplishesthisobjective?

A.publicB.private
C.protectedD.defaultaccess
Answer&Explanation
Answer:OptionD

QSTNWhichthreearevalidmethodsignaturesinaninterface?

privateintgetArea()
publicfloatgetVol(floatx)
publicvoidmain(String[]args)
publicstaticvoidmain(String[]args)
booleansetFlag(Boolean[]test)
A.1and2B.2,3and5
C.3,4,and5D.2and4
Answer&Explanation
Answer:OptionB

QSTNWhatisthenarrowestvalidreturnTypeformethodAinline3?

publicclassReturnIt
{
returnTypemethodA(bytex,doubley)/*Line3*/
{
return(long)x/y*2
}
}
A.intB.byte
C.longD.double
Answer&Explanation
Answer:OptionD

QSTNclassA
{
protectedintmethod1(inta,intb)
{
return0
}
}
WhichisvalidinaclassthatextendsclassA?
A.publicintmethod1(inta,intb){return0}
B.privateintmethod1(inta,intb){return0}
C.publicshortmethod1(inta,intb){return0}
D.staticprotectedintmethod1(inta,intb){return0}
Answer&Explanation
Answer:OptionA

QSTNWhichonecreatesaninstanceofanarray?

A.int[]ia=newint[15]
B.floatfa=newfloat[20]
C.char[]ca="SomeString"

D.intia[][]={4,5,6},{1,2,3}
Answer&Explanation
Answer:OptionA

QSTNWhichtwoofthefollowingarelegaldeclarationsfornonnestedclassesandinterfaces?

finalabstractclassTest{}
publicstaticinterfaceTest{}
finalpublicclassTest{}
protectedabstractclassTest{}
protectedinterfaceTest{}
abstractpublicclassTest{}
A.1and4B.2and5
C.3and6D.4and6
Answer&Explanation
Answer:OptionC

QSTNWhichofthefollowingclasslevel(nonlocal)variabledeclarationswillnotcompile?

A.protectedinta
B.transientintb=3
C.privatesynchronizedinte
D.volatileintd
Answer&Explanation
Answer:OptionC

QSTN
Whichtwocauseacompilererror?

float[]f=newfloat(3)
floatf2[]=newfloat[]
float[]f1=newfloat[3]
floatf3[]=newfloat[3]
floatf5[]={1.0f,2.0f,2.0f}
A.2,4B.3,5
C.4,5D.1,2
Answer&Explanation
Answer:OptionD

QSTNGivenamethodinaprotectedclass,whataccessmodifierdoyouusetorestrictaccess
tothatmethodtoonlytheothermembersofthesameclass?

A.finalB.static
C.privateD.protected
E.volatile
Answer&Explanation
Answer:OptionC

QSTNWhichisavaliddeclarationwithinaninterface?

A.publicstaticshortstop=23
B.protectedshortstop=23
C.transientshortstop=23
D.finalvoidmadness(shortstop)
Answer&Explanation
Answer:OptionA

PostedbyRitzonblogsat07:58

Nocomments:

+1 Recommend this on Google

Home

OlderPosts

Subscribeto:Posts(Atom)

Simpletemplate.PoweredbyBlogger.