KXC253SUPmarkingscheme.docx
《KXC253SUPmarkingscheme.docx》由会员分享,可在线阅读,更多相关《KXC253SUPmarkingscheme.docx(23页珍藏版)》请在冰豆网上搜索。
![KXC253SUPmarkingscheme.docx](https://file1.bdocx.com/fileroot1/2023-1/24/c1a3b772-dc71-41ca-8626-a4795f9acfb5/c1a3b772-dc71-41ca-8626-a4795f9acfb51.gif)
KXC253SUPmarkingscheme
Pages:
10
Questions:
15
THEUNIVERSITYOFTASMANIA
SUPPLEMENTARYANDDEFERREDORDINARY
EXAMINATIONSFORDEGREESANDDIPLOMAS
June2005
KXC253SoftwareDesign
Examiner:
MrR.P.Dazeley
TimeAllowed:
THREE(3)hours
Instructions:
Attemptallquestions.AnswerallthequestionsinsectionAandsectionB.ThereareTwo
(2)sections.QuestionsinsectionAareworth5markseach.QuestionsinsectionBareworth40markseach.Allocateyourtimeappropriatelytothesections.
Nomaterialorequipmentmaybetakenintotheexamination.
SectionA:
MultipleChoice
ThereareTwelve(12)questionsinthissection.Attemptallquestionsfromthissection.Answerallthequestionsonasinglepageinyouranswerbooklet.Eachquestionisworth5marks.
Usethefollowingsequencediagramtoanswerquestions1–4
Thisisbasedontheideaofacompanythatownssomeparklandwithanumberofattractions.Someofthoseattractionsconsistofanumberofsmalloutdoorstages,setupforpublictheatreperformances.Thesequencediagrambelow,detailstheprocessforbookingoneofthesestages.
Question1
Accordingtothesequencediagram$Use_Case_CreateNewClientisamemberofwhichpackage?
A)Client_PKG.
B)RecieveBooking_View.
C)View_PKG.
D)$Use_Case_CreateNewClient_PKG
E)$Use_Case_CreateNewClientisnotamemberofanypackage.
[5marks]
Question2
AccordingtothesequencediagramhowmanyoperationsdoestheStageclasshave?
A)1
B)3
C)5
D)6
E)7
[5marks]
Question3
AccordingtothesequencediagramhowmanyobjectsareinstantiatedbytheReceiveBooking_Viewconstructor?
A)0
B)1
C)2
D)3
E)4
[5marks]
Question4
Whichofthefollowingstatements,inrelationtothesequencediagram,iscorrect?
A)The$Use_Case_CreateNewClientrepresentsadifferentsectionofthesameapplication.
B)TheReceiveBooking_Viewisnotauserinterfacecomponent.
C)NoStageobjectsareinstantiated.
D)UserdetailsarestoredinaDatabase.
E)Amongstotherthings,aStagehasafloor.
[5marks]
Usethefollowingcodetoanswerquestions5-8
packageHealth;
abstractclassHealthWorker{
protectedinttime;
publicHealthWorker(){
time=0;
}
publicvoidcomfortPatient(){
System.out.println(“HealthWorkercomfortspatientfor”+time+“minutes.”);
}
publicvoidcomfortPatient(intt){
time=t;
}
}
classMedicextendsHealthWorker{
protectedintamount;
publicMedic(){
amount=0;
}
publicvoidadministerMedicine();
publicvoidsetAmount(inta){
amount=a;
}
}
classNurseextendsMedic{
publicvoidcomfortPatient(){
System.out.println(“Nursecomfortspatientfor”+time+“minutes.”);
}
publicvoidadministerMedicine(){
System.out.println(“Nurseadministers”+amount+“ofmedicine.”);
}
}
classDoctorextendsMedic{
publicDoctor(intt){
time=t;
}
publicDoctor(intt,inta){
time=t;
amount=a;
}
publicvoidcomfortPatient(){
System.out.println(“Doctorcomfortspatientfor”+time+“minutes.”);
}
publicvoidadministerMedicine(){
System.out.println(“Doctoradministers”+amount+“ofmedicine.”);
}
publicintdiagnose(){
System.out.println(“Doctordiagnosespatient.”);
returnamount;//Theamountofmedicinediagnosedasrequired.
}
}
classOrderlyextendsHealthWorker{
publicvoidcomfortPatient(){
System.out.println(“Orderlycomfortspatientfor”+time+“minutes.”);
}
}
Question5
Inthecodesegmentprovidedwhatoperationsareoverloaded?
A)comfortPatient()
B)diagnose()
C)comfortPatient()andadministerMedicine()
D)administerMedicine()
E)diagnose()andsetAmount()
[5marks]
Question6
Inthecodesegmentprovidedwhatoperationsareoverridden?
A)comfortPatient()
B)diagnose()
C)comfortPatient()andadministerMedicine()
D)administerMedicine()
E)diagnose()andsetAmount()
[5marks]
Question7
Ifthefollowingprogramsegmentisrun,whatwouldtheoutputbe?
publicstaticvoidmain(String[]args){
Orderlyo=newOrderly();
o=newMedic();
o.administerMedicine();
}
A)Doctoradministers5ofmedicine.
B)Doctoradministers26ofmedicine.
C)Medicadministers5ofmedicine.
D)HealthWorkeradministers5ofmedicine.
E)Noneoftheaboveasthereisasyntaxerror.
[5marks]
Question8
Ifthefollowingprogramsegmentisrun,whatwouldtheoutputbe?
publicstaticvoidmain(String[]args){
Nursen=newNurse();
fortPatient(14);
HealthWorkerh=newOrderly();
fortPatient(18);
Medicm=n;
h=m;
fortPatient();
}
A)Nursecomfortspatientfor18minutes.
B)Nursecomfortspatientfor14minutes.
C)Orderlycomfortspatientfor14minutes.
D)Orderlycomfortspatientfor18minutes.
E)Noneoftheaboveasthereisasyntaxerror.
[5marks]
Usethefollowingdatabasetablesanddatatoanswerquestions9-12
CREATETABLEcompetitor(
idsmallintprimarykey,
namevarchar(30),
dobdate,
countryvarchar(100)
);
CREATETABLEevent(
namevarchar(100)primarykey,
locationvarchar(100),
eventDatedate
);
CREATETABLEcompeteIn(
competitor_idsmallint,
event_namevarchar(100),
placesmallintDEFAULT0
);
ALTERTABLEcompeteInADDCONSTRAINTFK_competitor_competingIn
FOREIGNKEY(competitor_id)REFERENCEScompetitor(id);
ALTERTABLEcompeteInADDCONSTRAINTFK_competingIn_event
FOREIGNKEY(event_name)REFERENCESevent(name);
ALTERTABLEcompeteInADDCONSTRAINTPK_competeInPRIMARY
KEY(competitor_id,event_name);
SQL>select*fromcompetitor;
id|name|dob|country
----+-----------------+------------+-----------------
1|JohnSmith|1983-01-24|Australia
2|AndreaJones|1984-11-01|England
3|ScottCopperman|1979-03-27|USA
4|SarahWilliams|1984-09-05|Canada
SQL>select*fromevent;
name|location|eventDate
------------------------+--------------------+------------
Marathon|BeijingStreets|2008-08-26
100mRelay|AthleticsStadium|2008-08-21
Triathlon|AthleticsStadium|2008-08-23
SQL>select*fromcompeteIn;
competitor_id|event_name|place
---------------+-------------------------+-------
1|Triathlon|2
1|Marathon|0
2|100mRelay|1
3|Marathon|0
3|Triathlon|1
3|100mRelay|2
4|100mRelay|3
Question9
Whichquerywillgivealistofallthecompetitorsthatareparticipatinginthe“Triathlon”event?
A)SELECT*FROMcompetitorWHEREevent_name=‘Triathlon’;
B)SELECT*FROMcompetitorhavingid=(selectcompetitor_idFROMcompeteInWHEREevent_name=‘Triathlon’);
C)SELECT*FROMcompetitorWHEREid=(selectcompetitor_idFROMcompeteInWHEREevent_name=‘Triathlon’);
D)SELECT*FROMcompetitorwhereidin(selectcompetitor_idFROMcompeteInWHEREevent_name=‘Triathlon’);
E)SELECT*FROMcompetitorhavingidin(selectcompetitor_idFROMcompeteInWHEREevent_name=‘Triathlon’);
[5marks]
Question10
Thedevelopersforgottoputacolumntorecordtheathletes’timesineachevent.WhichofthefollowingwilladdatimecolumntothecompeteIntable?
A)ALTERTABLEcompeteInADD(raceTimeDATE_TIME);
B)ALTERTABLEcompeteInADD(raceTimeDATETIME);
C)ALTERTABLEcompeteInINCLUDE(raceTimeDATETIME);
D)ALTERTABLEcompeteInINCLUDE(raceTimeDATE_TIME);
E)Noneoftheabove.
[5marks]
Question11
WhichofthefollowingstatementswilladdSarahWilliamstothelistofcompetitorsinthe“Marathon”withathirdplace?
A)INSERTcompeteInVALUES(4,‘Marathon’,3);
B)INSERTINTOcompeteInVALUES(‘SarahWilliams’,‘Marathon’,3);
C)INSERTINTOcompeteInVALUES(4,‘Marathon’,3);
D)INSERTcompeteInVALUES(‘SarahWilliams’,‘Marathon’,3);
E)Alloftheabove,it’samatterofpersonalpreference.
[5marks]
Question12
Whatdoesthefollowingquerydo:
CREATETABLEquestion12asSELECTcompetitor.nameascp_name,event.nameasev_name,event.locationFROMcompetitor,event,competeInHAVINGcompetitor.id=competeIpetitor_idANDevent.name=competeIn.event_name;
A)Createsatableshowingwhicheventsandlocationseachcompetitorhasalreadycompetedin.
B)Createsatableshowingwhicheventsandlocationseachcompetitormustattend.
C)Createsatablelistingallthecompetitors,eventsandlocationsnumbers.
D)Createsatableidentifyingwhichcountrieshaveacompetitorcompetinginwhicheventsandwheretheseeventsarelocated.
E)Nothing-ithasasyntaxerror.
[5marks]
SectionB
ThereareThree(3)questionsinthissection.AttemptALLquestions.Writeyouranswersforeachquestioninaseparatebooklet.Eachquestionisworth40marks.
Question13
a.Answerthefollowing:
i)Identifythethree(3)typesofrelationshipusedinUMLdesign.
ii)Provideabriefdescriptionofeachofthethree(3)relationships.
iii)DrawaUMLdiagramtoillustrateeachofthethree(3)relationships.
iv)BrieflydescribehoweachrelationshipisimplementedinJava.
[15marks]
MarkingScheme:
I.1markforeachtypeofrelationshipidentified.(inheritance,uses(orassociation),aggregation)
II.1markforeachrelationshipdescription
Inheritance–needtosaysubclass‘isakindof’parentclass–orwordstothateffect.
Aggregation–needtosaythattheSuperSetclass‘ismadeupof’SubSetclasses-orwordstothateffect(iftheyonlysaySuperclassandsubclassthentheyarewrongandshouldget0marks)
Uses(association)–needtosaythereisarelationshipbetweenthetwoclasses–oneneedstheother-orwordstothateffect.
III.1markforeachcorrectlydrawnrelationship.
IV.2markforeachrelationshipdescription
Implementingaggregation,mustmentioncreatinga