2015 HC Software Design and Development

Preview:

Citation preview

2015 HIGHER SCHOOL CERTIFICATE EXAMINATION

1110

Software Design and Development

General Instructions

•Readingtime–5minutes

•Workingtime–3hours

•Writeusingblackpen

•Drawdiagramsusingpencil

•WriteyourCentreNumberandStudentNumberatthetopofeitherpages29and31orpages35and39

Total marks – 100

Section I Pages2–9

20 marks

•AttemptQuestions1–20

•Allowabout35minutesforthissection

Section II Pages13–28

60 marks

•AttemptQuestions21–32

•Allowabout1hourand50minutesforthissection

Section III Pages29–40

20 marks

•AttempteitherQuestion33orQuestion34

•Allowabout35minutesforthissection

–2–

Section I

20 marksAttempt Questions 1–20Allow about 35 minutes for this section

Usethemultiple-choiceanswersheetforQuestions1–20.

1 Ateamhasbeencontractedtocreateasoftwarepackage.

Whichofthefollowingistheteam’smostappropriatefirststep?

(A) UseaGanttcharttoplanthedevelopment

(B) Lookforusefulmodulesinasoftwarelibrary

(C) Interviewtheclientforthesystemrequirements

(D) Createaprototypetoshowdifferentinterfacestyles

2 Acouncilwebsiteisbeingdevelopedtoallowresidentstonominateonedayoftheweekforgarbagecollection,andtoselectabinfromoneofthreesizes.

Whichcombinationofscreenelementswouldbebestforcapturingtheresidents’choicesofcollectiondayandbinsize?

Collection day Bin size

(A) Drop-downlist Radiobuttons

(B) Drop-downlist Checkboxes

(C) Textbox Radiobuttons

(D) Textbox Checkboxes

3 Whichofthefollowingisrepresentedinadataflowdiagram?

(A) Theorderinwhichprocessesoccur

(B) Wheredataoriginatesandwhereitisstored

(C) Thesequenceoftasksinvolvedincompletingaproject

(D) Thedecisionsthataremadewhensub-modulesarecalled

–3–

4 Itislegaltocopysoftwareandsellthecopiesif

(A) copyrightisacknowledged.

(B) thesoftwareisopensource.

(C) thesoftwarehasbeenpaidfor.

(D) thelicencespecifiesthatthisisallowed.

5 Someofthevariablesinaprogramaretobegivennewnames.

Whichdocumentationmustalsobemodified?

(A) Storyboard

(B) Datadictionary

(C) Systemflowchart

(D) Requirementsdefinition

6 Considerthisalgorithm.

BEGIN

N = 20

CASEWHERE N is

less than 10 : N = N + 5

less than 30 : N = N + 10

less than 50 : N = N + 30

OTHERWISE : N = N + 50

ENDCASE

Display N

END

Whatistheoutputofthealgorithm?

(A) 70

(B) 60

(C) 30

(D) 25

–4–

7 Howcantheinclusivityofacomputerprogrambeenhanced?

(A) Byreplacingpasswordcharacterswithasterisks

(B) Byprovidingarangeofmethodsforinputtingdata

(C) ByprovidingallthenecessarylibraryroutinesinasingleDLL

(D) Byensuringthatallsourceshavebeenincludedintheacknowledgements

8 Whichofthefollowingisusuallyabenefitofusingthepilotmethodofinstallation?

(A) Thedevelopmenttimeisreduced.

(B) Abackupofdataiscreatedforeachnewtransaction.

(C) Thepersonnelinvolvedcanbeavailabletotrainothers.

(D) CASEtoolscanbemoreeffectivelyused.

9 Whichrowofthetablebestmatchesthedataitemwithasuitabledatatype?

Data Item Data Type

(A) Atelephonenumber Boolean

(B) Onestudent’spersonaldetails Real

(C) Thestatusofaradiobutton Boolean

(D) Alistofwinninglotterynumbers Real

10 Whichrowofthetablecorrectlymatchesdocumentationwithitspurpose?

Documentation Purpose

(A) Logbook Recordingprogressandproblemsencounteredduringsoftwaredevelopment

(B) Storyboard Showingthelinksbetweenhardwaredevicesandthedatabeingprocessed

(C) IPOchart Testingthesystemforlogicerrors

(D) Benchmarkreport Showingtheorderofexecutionofprogrammodules

–5–

UsethefollowingalgorithmtoanswerQuestions11and12.

BEGIN

low = 1

END

high = n

n = number of elements in the array list

list(low) = list(high)

list(high) = list(low)

low = low + 1

high = high – 1

islow < n?

No

Yes

11 Whichofthefollowingcontrolstructuresisusedintheflowchart?

(A) Binaryselection

(B) Pre-testrepetition

(C) Post-testrepetition

(D) Multiwayselection

12 Originallythearraycalledlistcontainsfivenumbers.

1 3 5 7 9

Whatwilllistcontainafterthealgorithmisexecuted?

(A) 1 3 5 3 1

(B) 1 3 5 7 9

(C) 9 7 5 3 1

(D) 9 7 5 7 9

–6–

13 Whatistheroleoftheprogramcounter?

(A) Itstorestheaddressofthenextinstruction.

(B) Itcountsthenumberoftimesaloopisexecutedinaprogram.

(C) Itkeepstrackofthelinenumberinthesourcecodeasitisbeingtranslated.

(D) Itstoresthenumberofuserspermittedtosimultaneouslyaccessaprogram.

14 MoveMeisdefinedbythefollowingrailroaddiagram.

MoveMe

AngleLength

Move

WhichofthefollowingEBNFstatementsisacorrectrepresentationofMoveMe?

(A) MoveMe = Move { <Angle> <Length> }

(B) MoveMe = Move [ <Angle> <Length> ]

(C) MoveMe = Move { <Length> <Angle> }

(D) MoveMe = Move [ <Length> <Angle> ]

15 Adeveloperappliesreverseengineeringtoapieceofsoftware.

Whatisthedevelopertryingtoachieve?

(A) Toreverttoapreviousversion

(B) Toretrievetheoriginalsourcecode

(C) Tounderstandhowthesoftwareworks

(D) Toensurecompatibilitywitholderversions

–7–

16 The following algorithm is designed to allow theuser up to three attempts to enter acorrectpassword.

1 BEGIN

2 Count = 1

3 Flag = False

4 WHILE . . . . . . . . . . . . . . . . . .

5 GetPassword(PasswordAttempt)

6 IF PasswordAttempt is correct THEN

7 Flag = True

8 Display “Enter”

9 ELSE

10 Display “Incorrect”

11 Count = Count + 1

12 ENDIF

13 ENDWHILE

14 END

Whichofthefollowingcorrectlycompletesline4?

(A) Count < 3 OR Flag = True

(B) Count < 4 OR Flag = True

(C) Count < 3 AND Flag = False

(D) Count < 4 AND Flag = False

17 Anarraywasoriginally

4 5 10 7 7 .

Afteronepassofasort,thearraybecame

4 5 7 7 10 .

InwhichofthefollowingareALLthesortingmethodslistedcapableofproducingthisresult?

(A) Bubble,insertion

(B) Bubble,selection

(C) Insertion,selection

(D) Bubble,insertion,selection

–8–

18 Considerthefollowingalgorithm.

BEGIN

number = 5

WHILE number < 200

Display number

Increment number by 2

ENDWHILE

END

Whichofthefollowingalgorithmswillproducethesameoutput?

(A) BEGIN

REPEAT

Display number

number = number + 2

UNTIL number > 200

END

(B) BEGIN

FOR number = 2 to 100

Display number * 2 + 1

NEXT number

END

(C) BEGIN

number = 5

REPEAT

Display number

Increment number by 2

UNTIL number = 200

END

(D) BEGIN

FOR number = 5 TO 200 STEP 2

Display number

NEXT number

END

19 Afteranarrayissorted,itselementsappearinthefollowingorder.

–10 100.78 7.8 71

Whattype(s)ofdatadoesthearraycontain?

(A) Real

(B) String

(C) Realandinteger

(D) Stringandinteger

–9–

20 Diff(a, b, result)isasubroutinethatacceptstwonumbersasinput.Itreturns“yes”inresultifthedifferencebetweenthenumbersislessthan10.Otherwiseitreturns“no”.

Whichofthefollowingcodefragmentswouldbemostusefulfortestingthesubroutinewitharangeofvalues?

(A)

REPEAT

input a

input b

Diff(a, b, result)

UNTIL result = “yes”

(B)

result = “no”

input a

input b

IF b – a < 10 OR a – b < 10 THEN

result = “yes”

ENDIF

Display result

(C)

FOR x = 1 TO 100

input a

input b

Diff(a, b, result)

NEXT x

Display result

(D)

input again

WHILE again ≠ “no”

input a

input b

Diff(a, b, result)

Display result

input again

ENDWHILE

BLANK PAGE

–10–

BLANK PAGE

–11–

BLANK PAGE

© 2015 Board of Studies, Teaching and Educational Standards NSW©2015BoardofStudies,TeachingandEducationalStandardsNSW

–12–

Do

NO

T w

rite

in

this

are

a.

Office Use Only – Do NOT write anything, or make any marks below this line.

Centre Number

Student Number

–13–

43933103511111 15360

2015 HIGHER SCHOOL CERTIFICATE EXAMINATION

Software Design and Development

Section II

60 marksAttempt Questions 21–32Allow about 1 hour and 50 minutes for this section

Answer the questions in the spacesprovided. These spaces provideguidance for the expected length ofresponse.

If you include diagrams in youranswer, ensure that they are clearlylabelled.

Extra writing space is provided onpages27and28.Ifyouusethisspace,clearly indicate which question youareanswering.

Write your Centre Number andStudent Number at the top of thispage.

Please turn over

DoN

OT

writeinthisarea.

OfficeUseOnly–DoNOTwriteanything,ormakeanymarksbelowthisline.

–14–

2381310356

Question 21 (2marks)

OutlineTWOreasonsformaintainingsoftware. 2

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

Question 22(4marks)

Describehowacompletedprogramcouldbetestedbeforeitisreleased. 4

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

Do

NO

T w

rite

in

this

are

a.

Office Use Only – Do NOT write anything, or make any marks below this line.

–15–

1159310358

Question 23(7marks)

(a) Whatinformationaboutalibraryroutineshouldbedocumentedtoenableitsusebyotherprogrammers?

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

3

(b) The subroutine CharTally(String, Char, Count) counts the number of times acharacter(Char)appearsinStringandreturnstheresultinCount.

Aone-dimensionalarraycalledStudentscontains20names.

Writeanalgorithmtocountthetotalnumberoftimesthatthelower-caseletter‘ f ’appearsinthearrayStudents.UsethesubroutineCharTallyinyouralgorithm.

4

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

DoN

OT

writeinthisarea.

OfficeUseOnly–DoNOTwriteanything,ormakeanymarksbelowthisline.

–16–

4873310354

Question 24(3marks)

Usingexamples,distinguishbetweentheeffectsofruntimeerrorsandlogicerrors. 3

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

Question 25(3marks)

Explainwhysoftwaredevelopersmayprovidefreeupdatesforpurchasedsoftware. 3

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

Do

NO

T w

rite

in

this

are

a.

Office Use Only – Do NOT write anything, or make any marks below this line.

–17–

7471310351

Question 26(4marks)

Aclubhas200members.

Each member’s information is contained in an unsorted array of records calledMembers.TheIDforeachmemberisunique.

The following algorithm displays the name of a member after the member’s ID isentered.

BEGIN

Get MemberID

FOR Counter = 1 to 200

IF MemberID = Members(Counter).ID THEN

Display Members(Counter).Name

ENDIF

NEXT Counter

END

Rewritethealgorithmsothat:

• itdisplays‘Invalid ID’iftheIDenteredisnotfound

• thelinearsearchterminatesassoonasamember’snamehasbeendisplayed.

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

4

DoN

OT

writeinthisarea.

OfficeUseOnly–DoNOTwriteanything,ormakeanymarksbelowthisline.

–18–

9964310350

Question 27(3marks)

Softwareapplicationsarenowcreatedtorunonarangeofportabledevices,suchas 3smartphonesandtablets,aswellasarangeofdesktopcomputers.

Outlinehowthisaffectssoftwaredevelopment.

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

Question 28(7marks)

AchainofvideostoresisintroducinganATM-stylekioskthatwillenablecustomerstocopymoviestotheirownUSBdevices.

Thekioskwillprovidemovieinformation,enablepaymentandallowdownloadtoaUSBdevice.

(a) Discussthesuitabilityofboththeprototypingandrapidapplicationdevelopmentapproachesfordevelopingthissystem.

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

4

Question 28 continues on page 19

Do

NO

T w

rite

in

this

are

a.

Office Use Only – Do NOT write anything, or make any marks below this line.

–19–

5638310354

Question28(continued)

(b) Thekioskinterfacewillincludethefollowingfeatures:

• asearchoption

• alistofmoviesresultingfromasearch

• abilitytochoosetoseedetailsofaselectedmovie

• paymentanddownloadinstructions.

Astoryboardisbeingproducedtorepresenthowthekioskinterfacewilloperate.Thefirstscreenofthestoryboardisshownbelow.

Completethestoryboard.Notethatwithineachscreenthereneedonlybeatitleandnecessarybuttons.

Search movies

SEARCH screen

End of Question 28

3

DoN

OT

writeinthisarea.

OfficeUseOnly–DoNOTwriteanything,ormakeanymarksbelowthisline.

–20–

9657310359

Question 29(9marks)

A program is required to operate an online shopping service. The following algorithm waswrittenbyadeveloperatanearlystageofdevelopment.

BEGIN Main VegPrice = 0 MeatPrice = 0 Display menu Input MenuChoice WHILE MenuChoice is not “Finish” CASEWHERE MenuChoice is “Vegies” : Veg (VegPrice) “Meat” : Meat (MeatPrice) ENDCASE Display menu Input MenuChoice ENDWHILE ShowTotal (VegPrice, MeatPrice, Total)END Main

BEGIN Veg (VegPrice) Display “Veg module called” VegPrice = 10END

BEGIN Meat (MeatPrice) Display “Meat module called” MeatPrice = 20END

BEGIN ShowTotal (VegPrice, MeatPrice, Total) Total = VegPrice + MeatPrice Display VegPrice, MeatPrice, Total get confirmation IF confirmation = True THEN Pay (Total) ELSE Clear ENDIFEND

BEGIN Pay (Total) Display “Pay module called” Display TotalEND

BEGIN Clear Display “Clear module called”END

Question 29 continues on page 21

Do

NO

T w

rite

in

this

are

a.

Office Use Only – Do NOT write anything, or make any marks below this line.

–21–

6157310351

Question29(continued)

(a) WhatpurposedoestheMainmodulehavefortheuser?

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

2

(b) ThealgorithmcontainsthestubsVeg,Meat,PayandClear.

Explainthepurposeofthesestubsindevelopingthisprogram.

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

3

(c) Drawastructurechartcorrespondingtothealgorithmshown. 4

End of Question 29

DoN

OT

writeinthisarea.

OfficeUseOnly–DoNOTwriteanything,ormakeanymarksbelowthisline.

–22–

BLANK PAGE

1086310357

Do

NO

T w

rite

in

this

are

a.

Office Use Only – Do NOT write anything, or make any marks below this line.

–23–

6784310357

Question 30(5marks)

A car dealership maintains information about all the cars that it has for sale. Theinformationabouteachcarincludes:

• ID

• Make

• Model

• Manual/Auto

• Price

• Yearofmanufacture.

Adeveloperisrequiredtowriteaprogramwhich:

• maintainsrecordsofcarsboughtandsold

• enablesdealerstosearchforcarsthatmeetdifferentspecifications.

(a) Whyisanarrayofrecordsappropriateformanipulatingthisdata?

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

2

(b) Discusswhetherthedatainthearrayofrecordsshouldbesorted. 3

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

DoN

OT

writeinthisarea.

OfficeUseOnly–DoNOTwriteanything,ormakeanymarksbelowthisline.

–24–

7927310357

Question 31(9marks)

Validserialnumbersforadevicemustbe:

• 5charactersinlength

• startwitha#symbol

• contain3digits

• endwitha#symbol.

Forexample,#123#isavalidserialnumber.

Thefollowingalgorithmwasdesignedtocheckifagivenserialnumberisvalid.

1 BEGIN

2 Input SerialNumber and store the characters in the array of characters called Serial

3 Valid = False

4 IF (Length of SerialNumber = 5) AND (Serial(1) is “#”) THEN

5 FOR Counter = 2 to 5

6 IF Serial(Counter) is a digit THEN

7 Valid = True

8 ELSE

9 Valid = False

10 ENDIF

11 NEXT Counter

12 ENDIF

13 IF Serial(5) is not “#” THEN

14 Valid = False

15 ENDIF

16 Display Valid

17 END

(a) Deskcheckthealgorithmusingtheserialnumber#1k3#asinput. 3

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

Question 31 continues on page 25

Do

NO

T w

rite

in

this

are

a.

Office Use Only – Do NOT write anything, or make any marks below this line.

–25–

9403310358

Question31(continued)

(b) Thealgorithmcontainserrors.Showhowthealgorithmshouldbemodifiedtocorrecttheerrors.

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

3

(c) List testdatanecessarytotest thelogicof thealgorithm.Justifyeachiteminyourlist.

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

End of Question 31

3

DoN

OT

writeinthisarea.

OfficeUseOnly–DoNOTwriteanything,ormakeanymarksbelowthisline.

–26–

8246310352

Question 32(4marks)

A computer game based on cards numbered from 1 to 28 is to be developed. The28cardsarestoredrandomlyinanarraycalledCards.Anexampleisshown.

4

Cards

8 1 7 5 11 … … … 12 26 13 19 14 22

Therearefourplayersandeachplayerisdealtsevencards.Anarrayisassignedtoeachplayerforstoringtheircards.TheplayersaregivencardsfromthearrayCardsonecardatatimestartingwithPlayer 1,thenPlayer 2,Player 3,Player 4,andthenbacktoPlayer 1,Player 2,Player 3,Player 4andsoon.

Examplesoftheplayers’arraysareshown.

Player 1

8 11 4 3 17 27 13

Player 2

1 9 2 10 20 28 19

Player 3

7 21 16 15 25 12 14

Player 4

5 18 23 6 24 26 22

WriteasubroutinecalledDealCardstodistributethecardsfromthearrayCardstoeachofthefourplayers.Inyouralgorithm,includeappropriatecontrolanddatastructures.

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

.........................................................................................................................................

Do

NO

T w

rite

in

this

are

a.

Office Use Only – Do NOT write anything, or make any marks below this line.

–27–

9248310355

Section II extra writing space

If you use this space, clearly indicate which question you are answering.

DoN

OT

writeinthisarea.

OfficeUseOnly–DoNOTwriteanything,ormakeanymarksbelowthisline.

–28–

8455310354

Section II extra writing space

If you use this space, clearly indicate which question you are answering.

©2015BoardofStudies,TeachingandEducationalStandardsNSW

–29–

Centre Number

Student Number

83293100401112 15360

2015 HIGHER SCHOOL CERTIFICATE EXAMINATION

Software Design and Development

Section III

20 marksAttempt either Question 33 or Question 34Allow about 35 minutes for this section

Answerthequestioninthespacesprovided.Thesespacesprovideguidancefortheexpectedlengthofresponse.

Ifyouincludediagramsinyouranswer,ensurethattheyareclearlylabelled.

Question 33 — Programming Paradigms (20marks)

(a) An e-learning application, composed of various types of activities, is to bedeveloped.

Eachtypeofactivitywillhave:

• auserinterfacespecification

• prerequisiteconditionsthatstudentsmustmeetbeforetheycanuseit.

Whenanactivityiscompleted,theapplicationsuggestsfurtheractivitiesbasedonthestudent’sinterestsandhowwellthestudentcompletedtheactivity.

Discussthesuitabilityofthelogicparadigmandtheobjectorientedparadigmfordevelopingthisapplication.

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

4

Question 33 continues on page 30

–30–

3146310042

Question33(continued)

(b) Usinganexample,outlinewhyheuristicsareusedinsomesoftwaresolutions.

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

2

(c) Thisisafragmentoflogicparadigmcode,with

• salary(P,S) definedas‘thesalaryofpersonPisamountS’

• employer(P,E) definedas‘theemployerofpersonPisemployerE’.

salary(kim,56000).

salary(chris,23000).

salary(jay,46000).

salary(al,51000).

salary(jo,61000).

employer(chris,kim).

employer(kim,jay).

employer(al,jay).

employer(sam,jay).

valuable_employee(X):- employer(X,_) , salary(X,S) , S > 50000.

(i) Extendthefragmentofcode,usingfactsonly,sothatLingisavaluableemployee.

...................................................................................................................

...................................................................................................................

2

(ii) Evaluatevaluable_employee(E)?.Showreasoning.

...................................................................................................................

...................................................................................................................

...................................................................................................................

...................................................................................................................

2

Question 33 continues on page 31

©2015BoardofStudies,TeachingandEducationalStandardsNSW

–31–

CentreNumber

StudentNumber

2015 HIGHER SCHOOL CERTIFICATE EXAMINATION

Software Design and Development

Section III (continued)

5499310056153601113

Question33(continued)

Please turn over

–32–

Question33(continued)

(d) Acustomcarmanufacturermakescarstoorderbasedoncustomers’selectionsofcomponents.Eachcomponentmaybestandardorspecialised.

The cost of a car is calculated by totalling the costs of all components. Thecostofeachstandardcomponentisfixed.Thecostofaspecialisedcomponentiscalculatedbyaddingthecostofthespecialisationtothecostofthestandardcomponent.

Thesoftwaretomanagecustomers’selectionsisbeingdeveloped.Thisfragmentofcodehasbeendesignedtobepartofthesoftware.

class Car {

private –

components: array of Component

public –

cost():

sum = 0

FOR i = 1 TO number of components

sum = sum + components[i].cost()

NEXT i

return sum

}

class Component {

public –

cost(): REM returns the cost of the component

}

(i) Explain how polymorphism AND inheritance can be used in thedevelopmentofthissoftware.

...................................................................................................................

...................................................................................................................

...................................................................................................................

...................................................................................................................

...................................................................................................................

...................................................................................................................

...................................................................................................................

...................................................................................................................

...................................................................................................................

4

Question 33 continues on page 33

–33–

8287310054

Question33(continued)

(ii) Astandardenginecosts$2000,butaV8enginecostsanextra$800.

Writethecost()methodtocalculatethecostofinstancesofthefollowingsubclassesofComponent.

class Engine {

is a Component

}

class V8Engine {

is a Engine

}

...................................................................................................................

...................................................................................................................

...................................................................................................................

...................................................................................................................

...................................................................................................................

...................................................................................................................

...................................................................................................................

...................................................................................................................

...................................................................................................................

...................................................................................................................

3

Question 33 continues on page 34

–34–

Question33(continued)

(e) The following fragment of code from the object oriented paradigm wasdeveloped to declare an array that alwayskeeps all its items in sortedorder,whennumbersareaddedorremoved.

Themethodsadd()andremove()alwayscallthemethodsort().Themethodsort()callsthemethodswap().

class SortedArray {

private –

items: array of integer

size: integer

public –

sort():

swap(index1, index2):

tmp = items(index1)

items(index1) = items(index2)

items(index2) = tmp

add(number):

remove(index):

}

Thecodecontainsanerror.

Explaintheconsequencesoftheerrorandshowhowitcanbecorrected.

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

3

End of Question 33

©2015BoardofStudies,TeachingandEducationalStandardsNSW

–35–

CentreNumber

StudentNumber

85433101161114 15360

2015 HIGHER SCHOOL CERTIFICATE EXAMINATION

Software Design and Development

Section III (continued)

Do NOT attempt Question 34 if you have already attempted Question 33.

Question 34 — The Interrelationship between Software and Hardware (20marks)

(a) Perform the calculation of 10111 × 111 using binary arithmetic, showing allnecessaryworking.

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

2

(b) What are the benefits of using 2’s complement to represent integers incomputers?

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

2

Question 34 continues on page 36

–36–

Question34(continued)

(c) Acomputer-controlledcuttingtoolcutsstraightlines.

Datastreamssentfromthecomputertothetoolaremadeupof16-bitpacketswiththefollowingstructure.

1

A BT X

1 0

Y

A: start bits, always 1 1

T: tool setting bit

0 = Tool up (not cutting)

1 = Tool down (cutting)

X: 6 bits specifying the X-coordinate to which the cutter moves

Y: 6 bits specifying the Y-coordinate to which the cutter moves

B: stop bit, always 0

(i) Thefollowingdatastream, inhexadecimalform, issent to thecuttingtool

3

D 6 A 0.

Eachhexadecimaldigitrepresents4bitsofthedatastream.

Describewhatthisdatastreamachieves.

...................................................................................................................

...................................................................................................................

...................................................................................................................

...................................................................................................................

...................................................................................................................

...................................................................................................................

...................................................................................................................

...................................................................................................................

Question 34 continues on page 37

–37–

5123310117

Question34(continued)

(ii) ThecuttingtooliscurrentlyatX = 0, Y = 0.

Writethedatastreamneededtocutthepatternshownbelow.

3

0 15 30 450

15

Y

X

30

45

...................................................................................................................

...................................................................................................................

...................................................................................................................

...................................................................................................................

...................................................................................................................

...................................................................................................................

Question 34 continues on page 39

–38–

BLANK PAGE

© 2015 Board of Studies, Teaching and Educational Standards NSW

–39–

Centre Number

Student Number

2015 HIGHER SCHOOL CERTIFICATE EXAMINATION

Software Design and Development

Section III (continued)

Question34(continued)

(d) Inbinary,thedecimalfraction7.5is111.1.

InIEEE754singleprecisionfloatingpointrepresentation,thedecimalfraction–7.5is:

4

1 10000001 11100000000000000000000

Identify the THREE components of the single precision floating pointrepresentationandoutlinehowtorepresent–7.5inthisnotation.

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

...............................................................................................................................

Question 34 continues on page 40

8432310089153601115

–40–

5391310080

Question34(continued)

(e) Acarhasanalarmsystemwhichworksasfollows:

• Analarmwillsoundifthekeyisintheignitionandthedriver’sdoorisopen.

• The alarmwill also sound if thekey is not in the ignitionwhile the lights areon.

Inyouranswerstothequestionsbelow,usethefollowing:

Component 1 0

Key In ignition Not in ignition

Door Open Closed

Lights On Off

Alarm On Off

(i) Drawatruthtableforthisalarmsystem. 3

...................................................................................................................

...................................................................................................................

...................................................................................................................

...................................................................................................................

...................................................................................................................

...................................................................................................................

...................................................................................................................

...................................................................................................................

...................................................................................................................

...................................................................................................................

(ii) Drawalogiccircuittorepresentthissystem. 3

End of paper

©2015BoardofStudies,TeachingandEducationalStandardsNSW

Recommended