• 992.80 KB
  • 2022-04-22 11:18:23 发布

计算机科学概论课后答案.pdf

  • 174页
  • 当前文档由用户上传发布,收益归属用户
  1. 1、本文档共5页,可阅读全部内容。
  2. 2、本文档内容版权归属内容提供方,所产生的收益全部归内容提供方所有。如果您对本文有版权争议,可选择认领,认领后既往收益都归您。
  3. 3、本文档由用户上传,本站不保证质量和数量令人满意,可能有诸多瑕疵,付费之前,请仔细先通过免费阅读内容等途径辨别内容交易风险。如存在严重挂羊头卖狗肉之情形,可联系本站下载客服投诉处理。
  4. 文档侵权举报电话:19940600175。
'Lewis_complete_ans5/26/044:54PMPage567AnswerstoExercisesChapter1ExercisesForExercises1–10,matchthefollowingpeoplewiththeiraccomplish-ments.A.LeibnizB.PascalC.BabbageD.LovelaceE.HollerithF.ByronG.TuringH.Jacquard1.WhatFrenchmathematicianbuiltandsoldthefirstgear-drivenmechanicalmachinethatdidadditionandsubtraction?B2.Whobuiltthefirstmechanicalmachinethatdidaddition,subtraction,multiplication,anddivision?A3.Whodesignedthefirstmechanicalmachinethatincludedmemory?C4.Whowasconsideredthefirstprogrammer?D5.Whoproposedthatapunchedcardbeusedforcountingthecensus?E6.WhoeditedBabbage’swork?D7.WhowasAdaLovelace’sfather?F8.WhowouldhavebeenmentionedinthebooktheCodeBreakers?G9.Whodevelopedtheconceptofpunchedholesusedinweavingcloth?H10.WhoisassociatedwithIBM?E567 Lewis_complete_ans5/26/044:54PMPage568568AnswerstoExercisesForExercises11–23,matchthehardwarelistedtotheappropriategenera-tion.A.FirstB.SecondC.ThirdD.FourthE.Fifth11.CircuitboardsC12.TransistorB13.MagneticcorememoryB14.Cardinput/outputA15.ParallelcomputingD16.MagneticdrumA17.MagnetictapedrivesA18.IntegratedcircuitsC19.PersonalcomputerD20.VacuumtubeA21.LargescaleintegrationD22.MagneticdiscB23.NetworkingDForExercises24–38,matchthesoftwareorsoftwareconceptslistedtotheappropriategeneration. Lewis_complete_ans5/26/044:54PMPage569Chapter1Exercises569A.FirstB.SecondC.ThirdD.FourthE.Fifth24.AssemblersA25.FORTRANB26.OperatingsystemsC27.StructuredprogrammingD28.TimesharingC29.HTML(forWeb)E30.LoadersB31.SpreadsheetsD32.WordprocessorsD33.LispB34.PC-DOSD35.Loaders/linkersbundledintoOperatingSystemC36.JavaE37.SPSSC38.C++D Lewis_complete_ans5/26/044:54PMPage570570AnswerstoExercisesExercises39–55areshortanswer.39.Whatdowemeanbythestatementthatthe1980sand1990smustbecharacterizedbythechangingprofileoftheuser?Theoriginaluserwastheprogrammerwhohadaproblemtosolve.Bythe1970s,applicationprogramswerebeingwrittensuchthatnon-programmerscouldusethemtosolveproblems.Withtheadventofthepersonalcomputer,manypeoplebeganusingthecomputerforpersonalcorrespondence,personalaccounts,andgames.40.Distinguishbetweencomputingasatoolandcomputingasadisci-pline.Computingasatoolreferstotheuseofcomputingbypeopletosolveproblemsintheirprofessionalorpersonallife.Computingasadisci-plinereferstothestudyofthebodyofknowledgethatmakesupcomputerscienceand/orcomputerengineering.41.Iscomputingamathematicaldiscipline,ascientificdiscipline,oranengineeringdiscipline?Explain.Computingisneitheramathematicaldisciplinenorascientificdisci-plinenoranengineeringdiscipline;ithasrootsinallthreedisciplines.Booleanalgebra,logic,andnumericalanalysiscontributegreatlytothefoundationsofcomputing.Simulationandmodelbuildingfromthescientificdisciplinecontributetothefoundationsofcomputing.Thetechniquesfromengineeringofbuildinglargesystemscontributetothefoundationsofcomputing.42.Distinguishbetweensystemsareasandapplicationsareasincomputingasadiscipline.Thesystemsareasofcomputingasadisciplinerelatetotheunder-standingandbuildingofcomputertools:algorithmsanddatastruc-tures,programminglanguages,(computer)architecture,operatingsystems,softwaremethodologyandengineering,andhuman-computercommunication.Theapplicationsareasincomputingrelatetothecomputer’suseasatool:numericalcomputation,databasesandinfor-mationalretrieval,artificialintelligenceandrobotics,graphics,organi-zationalinformatics,andbioinformatics.43.DefinethewordabstractionandrelateittothedrawinginFigure1.2.Anabstractionisamentalmodelthatremovescomplexdetails.Anabstractionletstheviewerseeonlythosedetailsthatarerelevanttotheuser’sview.Anengineisamentalmodelofacarfromthebuilderormechanic’sview.Thecockpitisthementalmodelforanordinarydriver,whodoesnothavetoknowthedetailsoftheengineinordertodrivethecar. Lewis_complete_ans5/26/044:54PMPage571Chapter1Exercises57144.Namethesixsubjectsubareasofcomputerscience,calledsystemsareas,thatrelatetounderstandingandbuildingcomputingtoolsingeneral.algorithmsanddatastructures,programminglanguages,architecture,operatingsystems,softwaremethodologyandengineering,andhuman-computercommunication.45.Namethesixsubjectsubareasofcomputerscience,calledapplicationsareas,thatrelatetothecomputer’suseasatool.numericalandsymboliccomputation,databasesandinformationalretrieval,artificialintelligenceandrobotics,graphics,organizationalinformatics,andbioinformatics.46.Definethewordprotocolandexplainhowitisusedincomputing.Aprotocolisacodeprescribingstrictadherencetocorrectetiquetteandprocedure(asinadiplomaticexchange).Computingterminologyhasborrowedthewordtodescribethecorrectetiquetteforcomputerstousewhencommunicatingwithoneanother.47.Distinguishbetweenmachinelanguageandassemblylanguage.Machinelanguageisthelanguagethatisbuiltintotheelectricalcircuitryofacomputer.Assemblylanguageisalanguagemadeupofmnemoniccodesthatrepresentmachine-languageinstructions.Programswritteninassemblylanguagearetranslatedintomachinelanguageprogramsbyacomputerprogramcalledanassembler.48.Distinguishbetweenassemblylanguageandhigh-levellanguages.Whereasassemblylanguageisalanguagemadeupofmnemoniccodesthatrepresentmachine-languageinstructions,high-levellanguagesuseEnglish-likestatementstorepresentagroupsofassembly-languagestatementsormachine-languagestatements.Thereisaone-to-onecorrespondencebetweenstatementsinanassemblylanguageandthestatementstheyrepresentinmachinelanguage.Thereisaone-to-manycorrespondencebetweenhigh-levelstatementsandthecorrespondingmachine-languagestatements.49.FORTRANandCOBOLweretwohigh-levellanguagesdefinedduringthesecondgenerationofcomputersoftware.Compareandcontrasttheselanguagesintermsoftheirhistoryandtheirpurpose.FORTRANwaswrittenatIBMforuseinsolvingscienceandengi-neeringproblems.Itwasnotformallydesignedandhasgrowngreatlyovertheyears.COBOLwasdesignbyateamforbusinessapplicationsandhasbeenrelativelystable. Lewis_complete_ans5/26/044:54PMPage572572AnswerstoExercises50.Distinguishbetweenanassemblerandacompiler.Anassemblertranslatesassembly-languageprogramsintomachinecode.Acompilertranslatesprogramsinahigh-levellanguageintoeitherassembly-languageprogramsormachine-languageprograms.51.Distinguishbetweenasystemsprogrammerandanapplicationsprogrammer.Asystemsprogrammerwritesprogramsthataretoolstohelpotherswriteprograms.Anapplicationsprogrammerwritesprogramstosolvespecificproblems.52.Whatwastherationalebehindthedevelopmentofoperatingsystems?Thehumanoperatorwastooslow.Computerswereidlewhilethehumanpreparedthenextprogramtoberun.Thecomputerhasthespeedtoorganizeitself.53.Whatconstitutessystemssoftware?Utilityprogramssuchasloadersandlinkers,operatingsystems,andlanguagetranslatorsaresystemssoftware.54.Whatdothefollowingpiecesofsoftwaredo?a.LoaderAloaderputsaprogram’sinstructionsintomemorywheretheycanbeexecuted.b.LinkerAlinkerisaprogramthatputspiecesofalargeprogramtogethersothatitcanbeputintomemorywhereitcanbeexecuted.c.EditorAeditorisawordprocessingprogramthatallowstheusertoenterandedittext.55.HowwastheprogramSPSSdifferentfromtheprogramsthatcamebeforeit?SPSSwasthefirstapplicationprogramwrittensothatthenon-programmerusercouldenterdataandspecifytheprocessingofthedata.Chapter2ExercisesForExercises1–5,matchthefollowingnumberswiththeirdefinition.A.NumberB.NaturalnumberC.IntegernumberD.NegativenumberE.Rationalnumber Lewis_complete_ans5/26/044:54PMPage573Chapter2Exercises5731.Aunitofanabstractmathematicalsystemsubjecttothelawsofarith-metic.A2.Anaturalnumber,anegativeofanaturalnumber,orzero.C3.Thenumberzeroandanynumberobtainedbyrepeatedlyaddingonetoit.B4.Anintegerorthequotientoftwointegers(divisionbyzeroexcluded).E5.Avaluelessthanzero,withasignoppositetoitspositivecounterpart.DForExercises6–11,matchthesolutionwiththeproblem.A.10001100B.10011110C.1101010D.1100000E.1010001F.11110006.1110011+11001(binaryaddition)A7.1010101+10101(binaryaddition)C8.1111111+11111(binaryaddition)B9.1111111–111(binarysubtraction)F10.1100111–111(binarysubtraction)D11.1010110–101(binarysubtraction)EForExercises12–17,marktheanswerstrueandfalseasfollows:A.TrueB.False Lewis_complete_ans5/26/044:54PMPage574574AnswerstoExercises12.Binarynumbersareimportantincomputingbecauseabinarynumbercanbeconvertedintoeveryotherbase.B13.Binarynumberscanbereadoffinhexadecimalbutnotinoctal.B14.Startingfromlefttoright,everygroupingoffourbinarydigitscanbereadasonehexadecimaldigit.B15.Abyteismadeupofsixbinarydigits.B16.Twohexadecimaldigitscanbestoredinonebyte.A17.Readingoctaldigitsoffasbinaryproducesthesameresultwhetherreadfromrighttoleftorlefttoright.AExercises18–45areproblemsorshortanswerquestions.18.Distinguishbetweenanaturalnumberandanegativenumber.Anaturalnumberis0andanynumberthatcanbeobtainedbyrepeat-edlyadding1toit.Anegativenumberislessthan0,andoppositeinsigntoanaturalnumber,althoughweusuallydonotconsidernega-tive0.19.Distinguishbetweenanaturalnumberandarationalnumber.Arationalnumberisanintegerorthequotientofintegernumbers.(Divisionby0isexcluded.)Anaturalnumberis0andthepositiveintegers.(SeealsodefinitioninanswertoExercise18.)20.Labelthefollowingnumbersnatural,negative,orrational.a.1.333333rationalb.–1/3negative,rationalc.1066naturald.2/5rationale.6.2rational Lewis_complete_ans5/26/044:54PMPage575Chapter2Exercises575f.π(pi)notanylisted21.If891isanumberineachofthefollowingbases,howmany1sarethere?a.base10891b.base8Can’tbeanumberinbase8c.base121261d.base131470e.base16219322.Express891asapolynomialineachofthebasesinExercise21.8*102+9*10+1Can’tbeshownasapolynomialinbase8.8*122+9*12+18*132+9*13+18*162+9*16+123.Convertthefollowingnumbersfromthebaseshowntobase10.a.111(base2)7b.777(base8)511c.FEC(base16)4076d.777(base16)1911e.111(base8)7324.Explainhowbase2andbase8arerelated.Because8isapowerof2,base-8digitscanbereadoffinbinaryand3base-2digitscanbereadoffinoctal.25.Explainhowbase8andbase16arerelated.8and16arebothpowersoftwo. Lewis_complete_ans5/26/044:54PMPage576576AnswerstoExercises26.Expandthetableonpage40toincludethenumbersfrom11through16.binaryoctaldecimal00000001110102201133100441015511066111771000108100111910101210101113111100141211011513111016141111171510000201627.ExpandthetableinExercise26toincludehexadecimalnumbers.binaryoctaldecimalhexadecimal000000001111010222011333100444101555110666111777100010881001119910101210A10111311B11001412C11011513D11101614E11111715F10000201620 Lewis_complete_ans5/26/044:54PMPage577Chapter2Exercises57728.Convertthefollowingbinarynumberstooctal.a.111110110766b.1000001101c.10000010202d.110001014229.Convertthefollowingbinarynumberstohexadecimal.a.10101001A9b.11100111E7c.011011106Ed.01121111Thisisnotabinarynumber30.Convertthefollowinghexadecimalnumberstooctal.a.A9251b.E7347C.6E15631.Convertthefollowingoctalnumberstohexadecimal.a.7771FFb.605185c.443123d.521151e.11 Lewis_complete_ans5/26/044:54PMPage578578AnswerstoExercises32.Convertthefollowingdecimalnumberstooctal.a.9011605b.321501c.14922724d.10662052e.2001372133.Convertthefollowingdecimalnumberstobinary.a.45101101b.691000101c.106610000101010d.991100011e.1134.Convertthefollowingdecimalnumberstohexadecimal.a.106642Ab.1939793c.11d.9983E6e.432B35.Ifyouweregoingtorepresentnumbersinbase18,whatsymbolsmightyouusetorepresentthedecimalnumbers10through17otherthanletters?Anyspecialcharacterswouldwork,aswellascharactersfromanotheralphabet.Let’suse#for16and@for17. Lewis_complete_ans5/26/044:54PMPage579Chapter2Exercises57936.Convertthefollowingdecimalnumberstobase18usingthesymbolsyousuggestedinExercise15.a.1066354b.99099#@F9c.1137.Performthefollowingoctaladditions.a.770+6651655b.101+7071010c.202+667107138.Performthefollowinghexadecimaladditions.a.19AB6+4319AF9b.AE9+FAF8c.1066+ABCDBC3339.Performthefollowingoctalsubtractions.a.1066–77670b.1234–765247c.7766–5544222240.Performthefollowinghexadecimalsubtractions.a.ABC–1119ABb.9988–AB98DDc.A9F8–14929566 Lewis_complete_ans5/26/044:54PMPage580580AnswerstoExercises41.Whyarebinarynumbersimportantincomputing?Dataandinstructionsarerepresentedinbinaryinsidethecomputer.42.Abytecontainshowmanybits?843.Howmanybytesarethereina64-bitmachine?844.Whydomicroprocessorssuchaspagershaveonly8-bitmachines?Pagersarenotgeneralpurposecomputers.Theprogramsinpagerscanberepresentedin8-bitmachines.45.Whyisimportanttostudyhowtomanipulatefixed-sizednumbers?Itisimportanttounderstandhowtomanipulatefixed-sizednumbersbecausenumbersarerepresentedinacomputerinfixed-sizedformat.Chapter3ExercisesForExercises1–20,marktheanswerstrueandfalseasfollows:A.TrueB.False1.Losslesscompressionmeansthedatacanberetrievedwithoutlosinganyoftheoriginalinformation.A2.Acomputerrepresentsinformationinananalogform.B3.Acomputermustusethebinarynumbersystemtorepresentinforma-tion.B4.Adigitalsignalrepresentsoneoftwovaluesatanypointintime.A5.Fourbitscanbeusedtorepresent32uniquethings.B6.Thesigned-magnituderepresentationofnumbershastworepresenta-tionsforzero.A7.Overflowoccurswhenthevaluethatwecomputecannotfitintothenumberofbitswehaveallocatedfortheresult.A Lewis_complete_ans5/26/044:54PMPage581Chapter3Exercises5818.IntheASCIIcharacterset,thereisnodistinctionmadebetweenupper-caseandlowercaseletters.B9.TheUnicodecharactersetincludesallofthecharactersintheASCIIcharacterset.T10.Keywordencodingreplacesfrequentlyusedwordswithasinglechar-acter.T11.Run-lengthencodingisverygoodatcompressingEnglishtext.B12.Huffmanencodingusesvariable-lengthbinarystringstorepresentcharacters.A13.Anaudiosignalisdigitizedbysamplingitatregularintervals.A14.ACDstoresaudioinformationinabinaryformat.A15.TheMP3audioformatdiscardsinformationthatcan’tbeheardbyhumans.A16.AnRGBvaluerepresentsacolorusingthreenumericvalues.A17.Indexedcolorincreasesthenumberofcolorsthatcanbeusedinanimage,andthusincreasesthefilesize.B18.Bitmap,GIF,andJPEGareallexamplesofraster-graphicsformats.A19.Vectorgraphicsrepresentimagesintermsoflinesandgeometricshapes.A20.Akeyframeisusedintemporalcompressiontorepresentthechangesfromoneframetoanother.B Lewis_complete_ans5/26/044:54PMPage582582AnswerstoExercisesForExercises21–26,choosethecorrectwordfromthefollowinglist.A.Signed-magnituderepresentationB.RadixC.FrequencyofuseD.SamplingE.AnalogF.Digital21.______dataisacontinuousrepresentationofinformation.E22.Therepresentationfornumbersyou’veusedsincegradeschooliscalled______.A23.Ifthenumberbaseisotherthanbaseten,wecallthedecimalpointthe______point.B24.______dataisadiscreterepresentationofinformation.F25.Huffmancodesarecreatedbasedonthe_____________ofthechar-acter.C26.Anaudiosignalisdigitizedby____itsvalueatregularintervals.DForExercises27–30,choosethecorrectwordfromthefollowinglist.A.ColordepthB.FlashC.ResolutionD.TemporalcompressionE.AnalogF.Codec27.The____istheamountofdatausedtorepresentacolor.A28.The____ofanimageisdeterminedbythenumberofpixelsusedtorepresentit.C29.ThemostpopularvectorgraphicsformatusedontheWebtodayis_____.B Lewis_complete_ans5/26/044:54PMPage583Chapter3Exercises58330.____isavideocompressiontechniquethatlooksfordifferencesbetweenconsecutiveframesofamovie.DExercises31–83areproblemsorshortanswerquestions.31.Whatisdatacompressionandwhyisitanimportanttopictoday?Datacompressionreferstoreducingtheamountofspaceneededtostoreapieceofdata.Althoughcomputerstorageisrelativelycheap,astheamountofdatatostorekeepsincreasing,thecostofstorageisafactor.However,themostimportantreasonforcompressingdataisthatwesharedatamoreandmore.TheWebanditsunderlyingnetworkshavelimitationsonbandwidththatdefinethemaximumnumberofbitsorbytesthatcanbetransmittedfromoneplacetoanotherinafixedamountoftime.32.Whatisthedifferencebetweenlosslessandlossydatacompression?Alosslessdatacompressionisatechniqueinwhichnoinformationislost.Alossydatacompressionisatechniqueinwhichsomeinforma-tionmaybelost.33.Whydocomputershavedifficultywithanaloginformation?Computersarediscrete,finitemachines.Analoginformationiscontin-uousandinfinite.Thus,computerscannotrepresentanaloginforma-tiondirectly;theanaloginformationmustbeconvertedintoadigitalform.34.Isaclockwithasweepingsecondhandananalogoradigitaldevice?Explain.Asweepingsecondhandisananalogdevice.Themotionofthehandiscontinuous.35.Whatdoesitmeantodigitizesomething?Digitizingistheactofbreakingcontinuousinformationintodiscretepiecessothatwecanrepresenteachpieceseparately.36.Whatispulsecodemodulation?Pulsecodemodulationisasignalthatjumpssharplybetweentwoextremes.37.Howmanythingscanberepresentedwith:a.fourbits16b.fivebits32 Lewis_complete_ans5/26/044:54PMPage584584AnswerstoExercisesc.sixbits64d.sevenbits12838.Althoughyouhavebeencomputingsimplearithmeticoperationssincethesecondgrade,takethefollowingsmalltesttoconfirmthatyouthoroughlyunderstandoperationsonsignedintegers.EvaluatethefollowingexpressionswhereWis17,Xis28,Yis–29,andZis–13.a.X+Yb.X+Wc.Z+Wd.Y+Z–1454–42e.W–Zf.X–Wg.Y–Wh.Z–Y3011–461639.Usethebasetennumberlinetoprovethesolutionstothefollowingoperations,whereAis5andBis–7.a.A+Bb.A–Bc.B+Ad.B–A–8–7–6–5–4–3–2–1012345678910111213a.5+(–7)=–2:Aisplus5.Toadda–7,youmove7unitstotheleftfromthepointofA,landingon–2.b.5–(–7)=12:Aisplus5.Tosubtract–7,youchangethesignofB(7)andmoveBunitstotherightfromthepointofA,landingon12.c.–7+5=–2:Bisminus7.Toadd5,youmove5unitstotherightfromthepointofB,landingon–2.d.–7–(5)=–12:Bisminus7.Tosubtract5,youchangethesignandmove5unitstotheleft,landingon–12.40.Givenafixed-sizednumberschemewherekintheformulafortheten’scomplementis6(seepage59),answerthefollowingquestions.a.Howmanypositiveintegerscanberepresented?499,999b.Howmanynegativeintegerscanberepresented?500,000c.Drawthenumberlineshowingthethreesmallestandlargestposi-tivenumbers,thethreesmallestandlargestnegativenumbers,andzero. Lewis_complete_ans5/26/044:54PMPage585Chapter3Exercises585499999499999499998499998499997499997......33221100999999–1999998–2999997–3......500002–499998500001–499999500000–50000041.UsethenumberlineinExercise40tocalculatethefollowingexpres-sions,whereAis–499999andBis3.a.A+Bb.A–Bc.B+Ad.B–Aa.–499999is500001;movethreeunitstotheright,landingon500004,whichis–499996.b.–499999is500001;movethreeunitstotheleft,landingoutsidetherangeofnumbersthatcanberepresented.c.+3is3ontheline.–499999is500001;move500001unitstotheleft,landingon500004,whichis–499996.d.+3is3ontheline.–499999is500001;move500001unitstotheright,whichisoutsidetherangeofnumbersthatcanberepre-sented.42.Usetheformulafortheten’scomplementtocalculatethefollowingnumbersintheschemedescribedonpage59.a.35768b.–35768c.–444455d.–123456a.35768b.964232c.555545d.87654443.Incalculatingtheten’scomplementinExercise42,didyouhavetroubleborrowingfromsomanyzeros?Suchcalculationsareerrorprone.Thereisatrickthatyoucanusethatmakesthecalculationeasierandthuslesspronetoerrors:Subtractfromall9’sandthen Lewis_complete_ans5/26/044:54PMPage586586AnswerstoExercisesadd1.Anumbersubtractedfromall9’siscalledthenine’scomple-mentofthenumber.a.Provethatthenine’scomplementofanumberplusoneisequaltotheten’scomplementofthesamenumber.Negative(I)=10k–Iin10’scomplimentNegative(I)=(99..99–I)+1in9’scompliment.(99..99)=(10k–1)Negative(I)=(10k–1)–I+1=10k–Ib.Usethenine’scomplementplusonetocalculatethevaluesinExer-cise12b,c,andd.b.964232c.555545d.876544c.Whichdidyoufindeasiertouse,thedirectcalculationoftheten’scomplementorthenine’scomplementplusone?Justifyyouranswer.Thisisanindividualanswer.44.EvaluatethefollowingexpressionswhereAis11111110andBis00000010usingtwo’scomplement.a.A+Bb.A–Bc.B–Ad.–Be.–(–A)a.00000000b.11111100c.00000100d.11111110e.1111111045.Isthetwo’scomplementofanumberalwaysanegativenumber?Explain.Thetwo’scomplementisawayofrepresentingfixed-sizednumbersinmemory.Thetwo’scomplementofanumberXisjust–Xintwo’scomplementrepresentation.IfXisapositivenumber,thetwo’scomplementofXisnegative,butifXisnegative,thetwo’scomple-mentisapositivenumber.46.Howisarealvaluestoredinthecomputer?Anyrealvaluecanbedescribedbythreeproperties:thesign(positiveornegative),thedigitsinthevaluewiththeradixpointassumedtobetotheright,andtheexponent,whichdetermineshowtheradixpointisshiftedrelativetothemantissa.Arealnumberisrepresentedinthecomputerbystoringitasanintegeralongwithinformationshowingwheretheradixpointis. Lewis_complete_ans5/26/044:54PMPage587Chapter3Exercises58747.Converttherulesforsubtractioninasign-magnitudesystemtothealgorithmformat.FindthefirstnumberonthenumberlineIfadditionMoveinthesigndirectionofsecondnumberthespecifiedunitsElseMoveintheoppositesigndirectionofthesecondnumberthespeci-fiedunits48.Convertthefollowingrealnumberstobinary(5binaryplaces).a.0.500.10000b.0.250.01000c.0.100.0001149.Convertthefollowingrealnumberstooctal(5octalplaces).a.0.500.40000b.0.260.20000c.0.100.0631450.Canfractionalvaluesbevisuallyconvertedbetweenoctalandbinaryandback?Explain.Wholenumbersexpressedinbinaryandoctalcanbeconvertedvisu-ally,movingfromtheradixpointtotheleft.Fractionalvaluescanbereadbyvisuallymovingfromtheradixpointtotheright.51.Howmanybitswouldbeneededtorepresentacharactersetcontaining45characters?Why?6bits.63distinctthingscanberepresentedin6bits;31distinctthingscanberepresentedin5bits.Therefore6bitsmustbeused. Lewis_complete_ans5/26/044:54PMPage588588AnswerstoExercises52.Howcanthedecimalnumber175.23berepresentedasasign,mantissa,andexponent?175.23=17523*10–253.WhatisthemaindifferencebetweentheASCIIandUnicodecharactersets?TheASCIIcharactersetuses8bitstorepresentacharacter;theUnicodecharactersetuses16bitstorepresentacharacter.Thus,whileASCIIcanrepresent256characters,Unicodecanrepresentover65,000characters.ASCIIisfineforrepresentingEnglish,butthedesignersofUnicodewantedittobeabletorepresentalltheworld’scharacters.ASCIIisasubsetofUnicode.54.Createakeywordencodingtablethatcontainsafewsimplewords.Rewriteaparagraphofyourchoosingusingthisencodingscheme.Computethecompressionratioyouachieve.Originaltext:Computersaremultimediadevicesthatmanipulatedatavaryinginformfromnumberstographicstovideo.Becauseacomputercanonlymanipulatebinaryvalues,allformsofdatamustberepre-sentedinbinaryform.Dataisclassifiedasbeingcontinuous(analog)ordiscrete(digital).Decimalvaluesarerepresentedbytheirbinaryequivalent,usingoneofseveraltechniquesforrepresentingnegativenumbers,suchasasignmagnitudeortwo’scomplement.Realnumbersarerepre-sentedbyatriplemadeupofthesign,thedigitsinthenumber,andanexponentthatspecifiestheradixpoint.Acharactersetisalistofalphanumericcharactersandthecodesthatrepresenteachone.ThemostcommoncharactersetisUnicode(16bitsforeachcharacter),whichhasASCIIasasubset.The8-bitASCIIsetissufficientforEnglishbutnotforother(ormultiple)languages.Therearevariouswaysforcompressingtextsothatittakeslessspacetostoreitorlesstimetotransmititfromonemachinetoanother.Audioinformationisrepresentedasdigitizedsoundwaves.Colorisrepresentedbythreevaluesthateachrepresentthecontributionofred,blue,andgreen.Therearetwobasictechniquesforrepre-sentingpictures,bitmaps,andvectorgraphics.Videoisbrokenupintoaseriesofstillimages,eachofwhichisrepresentedasapicture. Lewis_complete_ans5/26/044:54PMPage589Chapter3Exercises589Substitutions:and:&to:>the:~an:!it:graphics>video.Becauseacomputercanonlymanipulatebinaryvalues,allformsofdatamustbe@inbinaryform.Data=classifiedasbeingcontinuous(analog)ordiscrete(digital).Decimalvaluesare@bytheirbinaryequivalent,usingoneofseveraltechniquesforrepresentingnegativenumbers,suchasasignmagnitudeorone’scomplement.Realnumbersare@byatriplemadeupof~sign,~digitsin~number,&!exponent$specifies~radixpoint.A#set=alistofalphanumeric#s&~codes$representeachone.~mostcommon#set=Unicode(16bitsforeach#),whichhas%asasubset.~8-bit%set<=sufficientforEnglishbutnotforother(ormultiple)languages.Therearevariouswaysforcompressingtextso$storetransmitanother.Audioinformation=@asdigitizedsoundwaves.Color=@bythreevalues$eachrepresent~contributionofred,blue,&green.Therearetwobasictechniquesforrepresentingpictures,bitmaps&vectorgraphics.Video=brokenupintoaseriesofstillimages,eachofwhich=@asapicture.Compressionratio:.886455.Howwouldthefollowingstringofcharactersberepresentedusingrunlengthencoding?Whatisthecompressionratio?AAAABBBCCCCCCCCDDDDhithereEEEEEEEEEFF*A4BBB*C8*D4hithere*E9FFCompressionratiois.65856.Whatdoescode*X5*A9representusingrun-lengthencoding?XXXXXAAAAAAAAA Lewis_complete_ans5/26/044:54PMPage590590AnswerstoExercises57.GiventhefollowingHuffmanencodingtable,decipherthebitstringsbelow.HuffmanCodeCharacter00A11E010T0110C0111L1000S1011R10010O10011I101000N101001F101010H101011Da.1101110001011a.ELATEb.0110101010100101011111000b.CHORESc.10100100101000010001000010100110110c.FANTASTICd.10100010010101000100011101000100011d.NONSENSE58.Howdohumansperceivesound?Weperceivesoundwhenaseriesofaircompressionsvibrateamembraneinourear,whichsendssignalstoourbrain.59.Isastereospeakerananalogoradigitaldevice?Explain.Astereospeakerisananalogdevicebecauseitreceivesananalogrepresentationofthesoundwavefromthestereo.Thespeakerreceivesthesignalandcausesamembranetovibrate,whichinturnvibratestheair(creatingasoundwave),whichinturnvibratesyoureardrum.60.WhatisanRGBvalue?RGBstandsforRed,Green,andBlue.TheRGBvalueisactuallythreenumbersthatindicatetherelativecontributionofeachofthesethreecolors. Lewis_complete_ans5/26/044:54PMPage591Chapter3Exercises59161.Whatdoescolordepthindicate?Colordepthistheamountofdatausedtorepresentacolor;thatis,thenumberofbitsusedtorepresenteachofthecolorsintheRGBvalue.62.Howdoespixelresolutionaffectthevisualimpactofanimage?Ifenoughpixelsareused(highresolution)andpresentedintheproperordersidebyside,thehumaneyecanbefooledintothinkingit’sviewingacontinuouspicture.63.Explaintemporalvideocompression.Temporalvideocompressionusesthedifferencesbetweenframesasthebasisforcompression.Akeyframeisstoredinitsentirety,andthenchangestothatkeyframearestored.64.Describeasituationinwhichspatialvideocompressionwouldbeeffective.Spatialvideocompressionremovesredundantinformationwithinaframe.Thistypeofcompressionisgoodforlandscapesinwhichtherearelargeblocksofcolorthatarethesame,suchasabluesky.65.Definesamplingasitrelatestodigitizingsoundwaves.Todigitizethesignal,weperiodicallymeasurethevoltageofthesignalandrecordtheappropriatenumericvalue.Insteadofacontinuoussignal,wehaveaseriesofnumbersrepresentingdistinctvoltagevalues.Thus,wehaveasampleoftheoriginalcontinuoussignal.66.Whichproducesbettersoundquality,highersamplingratesorlowersamplingrates?Highersamplingratesproducebettersoundquality.67.Whatisthesamplingratepersecondthatisenoughtocreatereason-ablesoundreproduction?40,00068.Dovinylrecordalbumsandcompactdiscsrecordsoundthesameway?No.Vinylrecordalbumsuseananalogrepresentation,butcompactdiscsstoreaudioinformationdigitally.69.WhatdoesanRGBvalueof(130,0,255)mean?Thereisamediumcontributionofred,nocontributionofgreen,andafullcontributionofblue.70.WhatcolordoesanRGBvalueof(255,255,255)represent?White Lewis_complete_ans5/26/044:54PMPage592592AnswerstoExercises71.Whatisresolution?Resolutionreferstothenumberofpixelsusedtorepresentapicture.72.TheGIFformatuseswhattechnique?GIFusesindexedcolor.73.WhatareGIFfilesbestfor?GIFfilesarebestforgraphicsandimageswithfewcolors.74.Howarethevariousvideocodecsalike?Mostvideocodecsareblock-oriented;eachframeofavideoisdividedintorectangularblocks.75.Howaretheydifferent?Thecodecsdifferinhowtheblocksusedareencoded.76.Nametwotypesofvideocompression.Temporalcompressionandspatialcompression77.Whatdowecalltheperceptionofthevariousfrequenciesoflightthatreachtheretinasofoureyes?Color78.Whatisthebestformatforphotographiccolorimages?JPEG79.Whatarethetechniquescalledthatshrinkthesizesofmovies?Videocodecs80.Whatisthetechniqueinwhichanapplicationsupportsonlyacertainnumberofspecificcolors,creatingapalettefromwhichtochoose?Indexedcolor81.Whatistheformatthatdescribesanimageintermsoflinesandgeometricshapes?Vectorgraphics82.Whatformatstoresinformationonapixel-by-pixelbasis?Raster-graphicsformat83.WhatisthedifferencebetweenHiColorandTrueColor?HiColoruses16bits;TrueColoruses24bits. Lewis_complete_ans5/26/044:54PMPage593Chapter4Exercises593Chapter4ExercisesForExercises1–17,marktheanswerstrueandfalseasfollows:A.TrueB.False1.Logicdiagramsandtruthtablesareequallypowerfulinexpressingtheprocessingofgatesandcircuits.A2.Booleanexpressionsaremorepowerfulthanlogicdiagramsinexpressingtheprocessingofgatesandcircuits.B3.ANOTgateacceptstwoinputs.B4.TheoutputvalueofanANDgatewhenbothinputsare1is1.A5.TheANDandORgatesproduceoppositeresultsforthesameinput.B6.TheoutputvalueofanORgatewhenbothinputsare1is1.A7.TheoutputofanORgatewhenoneinputis0andoneinputis1is0.B8.TheoutputvalueofanXORgateis0unlessbothinputsare1.B9.TheNORgateproducestheoppositeresultsoftheXORgate.B10.Agatecanbedesignedtoacceptmorethantwoinputs.A11.Atransistorismadeofsemiconductormaterial.A12.InvertingtheoutputofanANDgateisequivalenttoinvertingtheindividualsignalsfirst,thenpassingthemthroughanORgate.A(DeMorgan’slaw)13.Thesumoftwobinarydigits(ignoringthecarry)isexpressedbyanANDgate.B Lewis_complete_ans5/26/044:54PMPage594594AnswerstoExercises14.Afulladdertakesthecarry-invalueintoaccount.A15.Amultiplexeraddsallofthebitsonitsinputlinestoproduceitsoutput.B16.Integratedcircuitsareclassifiedbythenumberofgatescontainedinthem.A17.ACPUisanintegratedcircuit.AForExercises18–29,matchthegatewiththedescriptionoftheoperation.A.ANDB.NANDC.XORD.ORE.NORF.NOT18.Invertsitsinput.F19.Producesa1onlyifallitsinputsare1anda0otherwise.A20.Producesa0onlyifallitsinputsare0anda1otherwise.D21.Producesa0onlyifallitsinputsarethesameanda1otherwise.C22.Producesa0ifallitsinputsare1anda1otherwise.B23.Producesa1ifallitsinputsare0anda0otherwise.E24.AXF25.AXBA Lewis_complete_ans5/26/044:54PMPage595Chapter4Exercises59526.AXBD27.AXBC28.AXBB29.AXBEExercises30–73areshortanswerordesignquestions.30.Howisvoltagelevelusedtodistinguishbetweenbinarydigits?Avoltagelevelintherangeof0to2voltsisinterpretedasabinary0.Avoltagelevelintherangeof2+to5voltsisinterpretedasabinary1.31.Distinguishbetweenagateandacircuit.Agateacceptsoneormoreinputsignalsandproducesanoutputsignal.Eachtypeofgateperformsonelogicalfunction.Acircuitisacombinationofgatesdesignedtoaccomplishamorecomplexlogicalfunction.32.Whatarethethreenotationalmethodsfordescribingthebehaviorofgatesandcircuits?Booleanexpressions,logicdiagrams,andtruthtables33.CharacterizethenotationsaskedforinExercise32.BooleanexpressionsusetheoperationsofBooleanalgebratodescribethebehaviorofgatesandcircuits.Logicdiagramsuseagraphicalrepresentationtodescribethebehaviorofgatesandcircuits.Truthtablesdefinethebehaviorofgatesandcircuitsbyshowingallpossibleinputandoutputcombinationsofthegatesandcircuits. Lewis_complete_ans5/26/044:54PMPage596596AnswerstoExercises34.Howmanyinputsignalscanagatereceiveandhowmanyoutputsignalscanagateproduce?Agatecanacceptoneormoreinputsignals,butcanproduceonlyasingleoutputvalue.35.Namesixtypesofgates.NOT,AND,OR,XOR,NAN,NOR36.GivethethreerepresentationsofaNOTgateandsayinwordswhatNOTmeans.AistheinputsignalandXistheoutputsignal.Booleanexpression:X=A’LogicDiagramSymbolTruthTableAXAX0100NOTtakesabinaryinputvalueandinvertsit.37.GivethethreerepresentationsofanANDgateandsayinwordswhatANDmeans.AandBaretheinputsignalsandXistheoutputsignal.Booleanexpression:A⋅B(AANDB)LogicDiagramSymbolTruthTableAABXX000B010100111Ifbothinputvaluesare1,ANDreturns1;otherwiseANDreturns0.38.GivethethreerepresentationsofanORgateandsayinwordswhatORmeans.AandBaretheinputsignalsandXistheoutputsignal.Booleanexpression:A+B(AORB) Lewis_complete_ans5/26/044:54PMPage597Chapter4Exercises597LogicDiagramSymbolTruthTableAABXX000B011101111Ifbothinputvaluesare0,ORreturns0;otherwiseORreturns1.39.GivethethreerepresentationsofanXORgateandsayinwordswhatXORmeans.AandBaretheinputsignalsandXistheoutputsignal.Booleanexpression:A⊕B(AXORB)LogicDiagramSymbolTruthTableAABXX000B011101110Ifbothinputsarethesamevalue,XORreturnsa0;otherwiseXORreturns1.40.GivethethreerepresentationsofaNANDgateandsayinwordswhatNANDmeans.AandBaretheinputsignalsandXistheoutputsignal.Booleanexpression:(A⋅B)’(NOT(AANDB))LogicDiagramSymbolTruthTableAABXX001B011101110Iftheinputsaredifferentorboth0,NANDreturns1;ifbothare1,itreturns0.41.GivethethreerepresentationsofaNORgateandsayinwordswhatNORmeans.AandBaretheinputsignalsandXistheoutputsignal. Lewis_complete_ans5/26/044:54PMPage598598AnswerstoExercisesBooleanexpression:(A+B)’(NOT(AANDB))LogicDiagramSymbolTruthTableAABXX001B010100110Iftheinputsareboth0,NORreturns1;otherwiseNORreturns0.42.WhyaretherenologicdiagramsymbolsfortheNANDandNORgates?BecauseNANDmeansnotANDandNORmeansnotOR,therearenosymbolsforNANDandNOR.TheANDandORsymbolsareusedwiththeinversionbubble.43.DrawandlabelthesymbolforathreeinputANDgate,thenshowitsbehaviorwithatruthtable.LogicDiagramSymbolTruthTableAABCXXB0000C001001000110100010101100111144.Drawandlabelthesymbolforathree-inputORgate,thenshowitsbehaviorwithatruthtable. Lewis_complete_ans5/26/044:54PMPage599Chapter4Exercises599LogicDiagramSymbolTruthTableAABCXXB0000C001101010111100110111101111145.Whatisusedinagatetoestablishhowtheinputvaluesmaptotheoutputvalue?Atransistor46.Howdoesatransistorbehave?Dependingonthevoltageofaninputsignal,atransistoreitheractsasawirethatconductselectricityorasaresisterthatblockstheflowofelectricity.47.Ofwhatisatransistormade?Transistorsaremadeofsemiconductormaterial,whichisneitheragoodconductorofelectricitynoraparticularlygoodinsulator.Tran-sistorsareusuallymadefromsilicon.48.Whathappenswhenanelectricsignalisgrounded?Ifanelectricsignalisgrounded,thesignalflowsthroughanalterna-tiveroutetothegroundwhereitcandonoharm.Whenasignalisgrounded,itispulleddownto0volts.49.Whatarethethreeterminalsinatransistorandhowdotheyoperate?Thesourceisanelectricsignal.Thebasevalueregulatesagatethatdetermineswhethertheconnectionbetweenthesourceandtheground(emitter)ismade.Anoutputlineisusuallyconnectedtothesource.Ifthebasevalueishigh,thesourceisgroundedandtheoutputislow(representing0).Ifthebasevalueislow,thegateisclosed,thesourceisnotgrounded,andtheoutputishigh(representing1).50.Howmanytransistorsdoesittakeforeachofthesegates?a.NOT1b.AND2 Lewis_complete_ans5/26/044:54PMPage600600AnswerstoExercisesc.NOR2d.OR2e.XOR251.DrawatransistordiagramforanANDgate.Explaintheprocessing.SourceSourceVoutV1GroundV2GroundTheNANDgateistheinverseoftheANDgate,andtheinverseoftheinverseistheoriginal.Thus,theoutputfromtheNANDgateisinputtoaNOTgate,givingustheAND.52.DrawatransistordiagramforanORgate.Explaintheprocessing.SourceSourceVoutV1V2GroundGroundGround Lewis_complete_ans5/26/044:54PMPage601Chapter4Exercises601TheNORgateistheinverseoftheORgate,andtheinverseoftheinverseistheoriginal.Thus,theoutputfromtheNORgateisinputtoaNOTgate,givingustheOR.53.Howcangatesbecombinedintocircuits?Gatesarecombinedintocircuitsbyusingtheoutputofonegateastheinputforanother.Also,thesameinputvaluecanbeusedasinputtotwodifferentgates.54.Whatarethetwogeneralcategoriesofcircuitsandhowdotheydiffer?Combinationalcircuitsarecircuitsinwhichtheinputvaluesexplicitlydeterminetheoutput.Sequentialcircuitsarecircuitsinwhichtheoutputisafunctionofinputvaluesandthecurrentstateofthecircuit.55.DrawacircuitdiagramcorrespondingtothefollowingBooleanexpression:(A+B)(B+C)ABC56.DrawacircuitdiagramcorrespondingtothefollowingBooleanexpression:(AB+C)DABCD Lewis_complete_ans5/26/044:54PMPage602602AnswerstoExercises57.DrawacircuitdiagramcorrespondingtothefollowingBooleanexpression:A’B+(B+C)’ABC58.DrawacircuitdiagramcorrespondingtothefollowingBooleanexpression:(AB)’+(CD)’ABCD59.Showthebehaviorofthefollowingcircuitwithatruthtable:ABABABA+BAB+(A+B)00000010111001111111 Lewis_complete_ans5/26/044:54PMPage603Chapter4Exercises60360.Showthebehaviorofthefollowingcircuitwithatruthtable:ABABA"ABA"(B⊕C)0010101101100001101161.Showthebehaviorofthefollowingcircuitwithatruthtable:ABCABCA"B⊕CA"(B⊕C)000100001111010111011100100000101010110010111000 Lewis_complete_ans5/26/044:54PMPage604604AnswerstoExercises62.Showthebehaviorofthefollowingcircuitwithatruthtable:ABCABCAB(BC)"C"(AB+C)"(BC)"+(AB+C)"000011010010101101001101011000111000110110101011110111011111000063.Whatiscircuitequivalence?Circuitequivalenceiswhentwocircuitsproducethesameoutputfromthesameinputvaluecombination.64.NamesixpropertiesofBooleanalgebraandexplainwhateachmeans.Commutative:ThecommutativepropertysaysthatbinaryoperationsANDandORmaybeappliedlefttorightorrighttoleft.(AANDBisthesameasBANDA;AORBisthesameasBORA.)Associative:TheassociativepropertysaysthatgiventhreeBooleanvariables,theymaybeANDedorORedrighttoleftorlefttoright.((AANDB)ANDCisthesameasAAND(BANDC);(AORB)ORCisthesameasAOR(BORC).)Distributive:ThedistributivepropertysaysthatgiventhreeBooleanvariables,thefirstANDtheresultofthesecondORthethirdisthesameasthefirstANDthesecondORthefirstANDthethird.(AAND(BORC)=(AANDB)OR(AANDC).Also,thefirstORtheresultofsecondANDthethirdisthesameasthefirstORthesecondANDtheresultofthefirstORthethird.(AOR(BANDC)=(AORB)AND(AORC).)Identity:TheidentitypropertysaysthatanyvalueAANDtheORidentityalwaysreturnsAandthatanyvalueAORtheANDidentityalwaysreturnsA.(AAND1=A;AOR0=A.) Lewis_complete_ans5/26/044:54PMPage605Chapter4Exercises605Complement:ThecomplementpropertysaysthatanyvalueANDthecomplimentofthatvalueequalstheORidentityandthatanyvalueORthecomplimentofthatvalueequalstheORidentity.(AAND(A’)=0;AOR(A’)=1.)DeMorgan’sLaw:DeMorgan’sLawsaysthatthecomplementofAANDBisthesameasthecomplementofAORthecomplementofB,andthecomplementofAORBisthesameasthecomplementofBANDthecomplementofA.((AANDB)’=A’ORB’;(AORB)’=A’ANDB’).)65.Differentiatebetweenahalfadderandafulladder.Ahalfadderisacircuitthatcomputesthesumoftwobitsandproducestheappropriatecarrybit.Afulladderisacircuitthatcomputesthesumoftwobits,takingintoaccountthecarrybit.66.WhatistheBooleanexpressionforafulladder?Cisthecarryin.Sumis(A⊕B)⊕C)Carryoutis(AANDB)OR((A⊕B)ANDC)67.Whatisamultiplexer?Amultiplexerisacircuitthatusesinputcontrolsignalstodeterminewhichofseveraldatainputlinesistoberoutedtotheoutput.68.a.Circuitsusedformemoryarewhattypeofcircuits?Memorycircuitsaresequentialcircuitsbecausetheyaredependentontheexistingstateofthecircuitaswellasinputtothecircuit.b.HowmanydigitsdoesanS-Rlatchstore?Onebinarydigitc.ThedesignforanS-RlatchshowninFigure4.12guaranteeswhatabouttheoutputsXandY?ThevaluesofXandYarealwayscomplements.69.Whatisanintegratedcircuitorchip?Anintegratedcircuitorchipisapieceofsiliconintowhichmanygateshavebeenembedded.70.DefinetheabbreviationsSSI,MSI,LSI,andVLSI.Eachoftheseabbreviationsreferstothenumberofgatescontainedinanintegratedcircuit.SSI(Smallscaleintegration):contains1to10gates.MSI(Mediumscaleintegration):contains10to100gates. Lewis_complete_ans5/26/044:54PMPage606606AnswerstoExercisesLSI(Largescaleintegration):contains100to100,000gatesVLSI(Verylargescaleintegration):containsmorethan100,000gates71.InthechipshowninFigure4.13,whatarethepinsusedfor?Eightareusedforinputstogates,fourforoutputsfromthegates,oneforground,andoneforpower.72.Drawacircuitusingtwofulladdersthataddstwotwo-bitbinaryvalues.Showitscorrespondingtruthtable.Acircuitusingtwofulladdersthataddstwotwo-bitbinarynumbersoftheform:AB+CD-------XYZCarryin(assume0)BZDCarryAYCX73.HowcantheXORoperationbeexpressedusingotheroperators?(AORB)AND(NOT(AANDB)) Lewis_complete_ans5/26/044:54PMPage607Chapter5Exercises607Chapter5ExercisesForexercises1–16,matchthepoweroftentoitsnameoruse.A.10–12B.10–9C.10–6D.10–3E.103F.106G.109H.1012I.10151.NanoB2.PicoA3.MicroC4.MilliD5.TeraH6.GigaG7.KiloE8.MegaF9.Oftenusedtodescribeprocessorspeed.G10.Oftenusedtodescribesizeofmemory.F11.UsedinrelationtoInternetspeeds.E12.Latinforthousand.D Lewis_complete_ans5/26/044:54PMPage608608AnswerstoExercises13.Spanishforlittle.A14.PetaI15.Roughlyequivalentto210.E16.Roughlyequivalentto250.IForexercises17–23,matchtheacronymwithitsmostaccuratedefinition.A.CD-ROMB.CD-DAC.CD-WORMD.DVDE.CD-RWF.CD17.Genericcompactdiskthatisrecordedduringmanufacturing.F18.Dataisstoredinthesectorsreservedfortiminginformationinanothervariant.A19.Canbereadmanytimes,butwrittenafteritsmanufactureonlyonce.C20.Canbebothreadfromandwrittentoanynumberoftimes.E21.Formatusedinaudiorecordings.B22.Thereisonetractthatspiralsfromtheinsideout.F23.Anewertechnologythatcanstorelargeamountsofmultimediadata.DExercises24–64areproblemsorshortanswerexercises.24.Definethefollowingtermsa.PentiumIVprocessorThePentiumIVisapopularcentralprocessingunitmadebyIntel. Lewis_complete_ans5/26/044:54PMPage609Chapter5Exercises609b.hertzAhertzisaunitoffrequencyequaltoonecyclepersecond.c.randomaccessmemoryRandomaccessmemoryismemoryinwhicheachwordhasanaddressbywhichthewordcanbedirectlyaccessed.25.WhatisthewordlengthinthePentiumIVprocessor?ThewordlengthofthePentiumIVprocessoris32bitsor4bytes.26.Whatdoesitmeantosaythataprocessoris1.4GHz?Thespeedoftheprocessoris1,400,000,00cyclespersecond.27.Whatdoesitmeantosaythatmemoryis133MHz?Sayingamemoryis133MHzmeansthatthememorycanbeaccessedat133,000,000cyclespersecond.28.Howmanybytesofmemoryarethereinthefollowingmachines?a.128MBmachine128*220b.256MBmachine256*22029.DefineRPManddiscusswhatitmeansintermsofspeedofaccesstoadisk.RPMstandsforrevolutionsperminute.Thisisameasureofhowfastadiskrevolves.Datacanonlybeaccessedwhenthereadingheadisoverthedata.ThereforetheRPMindicateshowfasteachpieceofdatacanbeaccessed.30.Whatisthestored-programconceptandwhyisitimportant?Thestoredprogramconceptmeansthatdataandinstructionsarebothlogicallythesameandcanbothbestoredinmemory.ThevonNeumannarchitectureisbuiltaroundthisprinciple.Itisimportantbecausethehumandoesnothavetoexecuteinstructionfromwithoutthemachine.Instructionscanbestoredinmemoryandexecutedinsequencereferencingthedatavaluesitneedstooperateon.31.Whatdoes“unitsthatprocessinformationareseparatefromtheunitsthatstoreinformation”meanintermsofacomputerarchitecture?Thisexpressionmeansthatmemoryisseparatefromthecentralprocessingunit.32.NamethecomponentsofavonNeumannmachine.memory,arithmetic/logicunit,input/outputunits,thecontrolunit Lewis_complete_ans5/26/044:54PMPage610610AnswerstoExercises33.Whatistheaddressabilityofan8-bitmachine?834.WhatisthefunctionoftheALU?TheALUperformsbasicarithmeticoperations(addition,subtraction,multiplication,anddividion)andlogicaloperations(AND,OR,NOT).35.WhichcomponentinthevonNeumannarchitectureactsasthestagemanager.Explain.Thecomputercomponentthatactsasthestatemanageristhecontrolunit.Itcontrolstheactionsoftheothercomponentsinordertoexecuteinstructionsinsequence.36.Punchedcardsandpapertapewereearlyinput/outputmediums.Discusstheiradvantagesanddisadvantages.Punchedcardsandpapertapeusedforinputwerepreparedonsepa-ratemachinesandthenreadintothecomputer.Inputfromcardsandpapertapeisslow,buttheyprovidedapermanentrecordoftheinput.Whenusedforoutput,cardsandpapertapehadtobetransferredtoanotherdevicetogetahuman-readablecopyoftheinformation;however,theoutputcouldbestoredpermanentlyoncardsandpapertape.37.Whatisaninstructionregister,andwhatisitsfunction?Theinstructionregisterisaspecialregisterinthecontrolunit.Itholdstheinstructionbeingexecuted.38.Whatisaprogramcounter,andwhatisitsfunction?Theprogramcounterisaspecialregisterinthecontrolunit.Itholdstheaddressofthenextinstructiontobeexecuted.39.Listthestepsinthefetch-executecycle.Fetchthenextinstructionfromtheaddressintheprogramcounter.Decodetheinstruction.Executetheinstruction.40.Explainwhatismeantby“fetchaninstruction.”Thecontrolunitgoestotheaddressnamedintheprogramcounter,makesacopyofthecontentsofthataddress,putsthecopyintotheinstructionregister,andincrementstheprogramcounter.41.Explainwhatismeantby“decodeandinstruction.”Thecontrolunitdetermineswhattheinstructionisandaccessesanymemorylocationsthatcontainoperandsfortheinstruction. Lewis_complete_ans5/26/044:54PMPage611Chapter5Exercises61142.Explainwhatismeantby“executeaninstruction.”Signalsaresenttothearithmetic/logicunittocarryouttheprocessing.43.CompareandcontrastRAMandROMmemory.RAMisanacronymforRandomAccessMemory;ROMisanacronymforReadOnlyMemory.BothRAMandROMarerandomaccess;thatis,eachcellinmemoryisdirectlyaccessible.ThecellsinRAMcanbebothreadfromandwrittento.ThecellsinROMcanonlybereadfrom.ThebitpatterninROMisdeterminedatthetimeofmanufactureorburnedwhenthecomputerisassembled.OnceaROMhasbeenburned(written),itcannotbechanged.AnothermajordifferenceisthatRAMisvolatileandROMisnot.ThismeansthatRAMdoesnotmaintainitsbitpatternswhenthepoweristurnedoff,butROMdoes.44.Whatisasecondarystoragedevice,andwhyaresuchdevicesimpor-tant?BecauseRAMisvolatileandROMcannotbechanged,theremustbeplacestostoredataandprogramsoutsideofthecomputer’smainmemory.Suchplacesarecalledsecondarystoragedevices.45.Discusstheprosandconsofusingmagnetictapeasastoragemedium.Magnetictapeisacheapmediumforstoringgreatquantitiesofdata.However,dataitemscannotbedirectlyaddressedontape.Toreachadataobject,allinformationrecordedbeforetheoneyouwantmustbereadanddiscarded.46.Drawonesurfaceofadiskshowingthetracksandsectors.Yourpictureshouldhaveconcentriccircles,gettingsmallerastheymovetowardsthemiddle.Thereshouldbeaseriesofdiametersthatcutthecirclesintosectors.47.Definewhatismeantbyablockofdata.Ablockofdataisthedatastoredinasectorofadisk.48.Whatisacylinder?Acylinderisasetofconcentrictracks;thatis,tracksthatlineupunderoneanother.49.Definethestepsthataharddiskdrivegoesthroughtotransferablockofdatafromthedisktomemory.Toaccessablockofdata,theread/writeheadmovestothepropertrack,waitsuntilthepropersectorrotatesbeneathit,andthenaccessesthedata. Lewis_complete_ans5/26/044:54PMPage612612AnswerstoExercises50.Distinguishbetweenacompactdiskandamagneticdisk.Dataisstoredopticallyonacompactdiskandmagneticallyonamagneticdisk.Ratherthanhavingaseriesofconcentrictracks,acompactdiskhasonetrackthatspiralsfrominsideout.Bothdiskshavethetrackbrokenintosectors.Thedensityatwhichthedataispackedvariesinamagneticdisk,butdoesnotinacompactdisk.Therotationspeedofamagneticdiskreaderisconstant,buttherotationspeedofacompactdiskvariesdependingonthepositionofthelaserbeam.51.Describeaparallelarchitecturethatusessynchronousprocessing.Therearemultipleprocessorsapplyingthesameprogramtomultipledatasets.52.Describeaparallelarchitecturethatusespipelineprocessing.Multipleprocessorsarearrangedintandem.Eachprocessorcontributesonepartoftheoverallprocessing.53.Howdoesasharedmemoryparallelconfigurationwork?Multipleprocessorsdodifferentprocessingwithdifferentdatabutcommunicatethroughtheuseofsharedglobalmemory.54.Howmanydifferentmemorylocationscana16-bitprocessoraccess?216differentmemorylocations55.Indiscussingthecomputerad,weusedtheexpression“Fasterisbetter”threetimes.Explainwhatitmeansineachcase.Thefasterthespeedoftheprocessor,themorepowerfulthemachineis.Thefasterdatacanbeaccessedfrommemory,thefasterthemachineoperates.Thefasterdatacanbeaccessedfromaharddrive,thefasterthemachineoperates.56.Indiscussingthecomputerad,weusedtheexpression“Smallerisbetter”inrelationtothemonitor.Explain.Thedotpitchreferstothedistancebetweendotsonthescreen.Thesmallerthedistance,theclearerthepictureonthescreen.57.Indiscussingthecomputerad,weusedtheexpression“Biggerisbetter”inrelationtothecompactdisc.Explain.Thebiggertheexternalstoragedevice,themoreinformationthatcanbestored. Lewis_complete_ans5/26/044:54PMPage613Chapter6Exercises61358.Keepadiaryofhowmanytimesduringoneweekthetermshardwareandsoftwareappearintelevisioncommercials.Noanswerexpected.59.Takeacurrentadforadesktopcomputerandcomparethatadwiththeoneshownatthebeginningofthischapter.Answervarieswitheachstudent.60.Whatisthecommonnameforthediskthatisasecondarystoragedevice?Althoughthereareavarietyofdisksthataresecondarystoragedevices,theharddiskdriveistheonethatcomeswiththemachine.61.Towhatdoestheexpressiondotpitchrefer?Thedistancebetweenthedotsonthescreen.62.Whatisamodem?AmodemisatypeofdevicethatallowsyoutoconnecttotheInternet.63.Whicharefaster,downloadspeedsoruploadspeeds?Download64.Whatisthedifferencebetween1Kofmemoryand1Ktransferrate.1Kofmemoryis1024bytesofmemory;1Ktransferrateis1000/bitspersometimemeasure.Chapter6ExercisesForExercises1–10,matchtheactivitywiththephaseoftheobject-orientedmethodology.A.BrainstormingB.FilteringC.ScenariosD.Responsibilityalgorithms1.Reviewinglistofpossibleclasses,lookingforduplicatesormissingclasses.B2.Asking“whatif”questions.C3.Assigningresponsibilitiestoclasses.C Lewis_complete_ans5/26/044:54PMPage614614AnswerstoExercises4.Generatingfirstapproximationtothelistofclassesinaproblem.A5.Assigningcollaboratorstoaresponsibility.C6.DevelopingalgorithmsfortheresponsibilitieslistedonaCRCcard.D7.OutputfromthisphaseisafullydevelopedCRCcardforallclasses.C8.Outputfromthisphaseisthedesignreadytobetranslatedintoaprogram.D9.Duringthisphase,inheritancerelationshipsareexplored.B10.Phaseinwhichfunctionalprogrammingtechniquesareappropriate.DForExercises11–16,matchthewordwithitsdefinition.A.InformationhidingB.AbstractionC.DataabstractionD.ProceduralabstractionE.ControlabstractionF.Encapsulation11.Whatisthebundlingofdataandactionssothatthelogicalpropertiesofdataandactionsareseparatedfromtheirimplementation?F12.Whatisthepracticeofhidingthedetailsofamodulewiththegoalofcontrollingaccesstothedetailsofthemodule?A13.Whatisamodelofacomplexsystemthatincludesonlythedetailsessentialtotheviewer?B14.Whatistheseparationofthelogicalviewofanactionfromitsimple-mentation?D15.Whatistheseparationofthelogicalviewofacontrolstructurefromitsimplementation?E Lewis_complete_ans5/26/044:54PMPage615Chapter6Exercises61516.Whatistheseparationofthelogicalviewdatafromitsimplementa-tion?CExercises17–57areshortanswerordesigns.17.ListthefourstepsinPolya’sHowToSolveItList.UnderstandingtheproblemDevisingaplanCarryingouttheplanLookingback18.DescribethefourstepslistedinExercise1inyourownwords.Eachstudent’sanswerisunique.19.Listtheproblem-solvingstrategiesdiscussedinthischapter.AskquestionsLookforfamiliarthingsDivideandconquer20.Applytheproblem-solvingstrategiestothefollowingsituations.Solutionsarenotunique.a.Buyingatoyforyourfour-year-oldcousin.Askquestions:Whatdofour-yearoldslike?Isheorsheintosports?Whatstoresselltoys?Whereisaparticularstorelocated?Whattoysdoesthecousinalreadyhave?Lookforthingsthatarefamiliar:IlikedLincolnLogs;wouldmycousin?Ilikedmyredwagon;wouldmycousin?Mycousinislikehis(orher)mother;whatdidsheplaywithasachild?Divideandconquer:Gotostore.Gototoyaisle.Findgirl’s(orboy’s)toys.Chooseone. Lewis_complete_ans5/26/044:54PMPage616616AnswerstoExercisesb.Organizinganawardsbanquetforyoursoccerteam.Askquestions:Wherewillitbe?Whenwillitbe?Howmanypeoplewillbethere?Howmanytrophieswillbeawarded?Lookforthingsthatarefamiliar:Iorganizedonelastyear.Iorganizedafundraiser.Iwasascoutleader.Iplaysoccer.Divideandconquer:HaveJanedecideondayandtime.HaveJimchoosemenu.HaveMarybuytrophies.HaveJeremycallpeople.c.Buyingadressorsuitforanawardsbanquetatwhichyouarebeinghonored.AskQuestions:Whattimeofdayisthebanquet?Whereisthebanquetbeingheld?Whatwillothersbewearing?Whatismybestcolor?Lookforthingsthatarefamiliar:Lastyeartheawardwinnerworeabluedress(suit).LastyearIworeagreensuit.IworeasuitwhenIwashonoredlastyear.Divideandconquer:Choosethestore.Gotothestore.Choosepossiblesfromracks.Chooseone. Lewis_complete_ans5/26/044:54PMPage617Chapter6Exercises61721.ExaminethesolutionsinExercise4anddeterminethreethingstheyhaveincommon.Eachsolutionincludesdataobjects:toy,food,dress,suit.Eachsolutioninvolveschoicesordecisions.Eachsolutioninvolvesacontainerforobjects:toystore,restaurant,clothingstore.22.Whatisanalgorithm?Analgorithmisasetofinstructionsforsolvingaprobleminafiniteamountoftimeusingafiniteamountofdata.23.Writeanalgorithmforthefollowingtasks.Solutionsarenotunique.a.Makingapeanutbutterandjellysandwich.GetbreadGetpeanutbutterGetjellyGetknifeSpreadpeanutbutterononesliceofbreadSpreadjellyononesliceofbreadCombineslicesofbread,peanutbutterfacingjellyb.Gettingupinthemorning.AlarmgoesoffHitsleepbuttonAlarmgoesoffHitsleepbuttonAlarmgoesoffTurnoffalarmMovedogThrowbackcoversPutfeetoversideofthebedStandup Lewis_complete_ans5/26/044:54PMPage618618AnswerstoExercisesc.DoingyourhomeworkTurnoffTVTurnoffCDGetbackpackSitatdeskOpenbackpackPetcatOpenbookOpenassignmentWhile(moretodo)SolveproblemPetcatd.DrivinghomeintheafternoonFindcarOpencardoorGetintocarFastenseatbeltStartengineTurnonradioWhile(notyethome)KeepgoingTurnoffengineOpencardoorGetoutofcarClosecardoor24.Listthethreephasesofthecomputerproblem-solvingmodel.AlgorithmdevelopmentphaseImplementationphaseMaintenancephase25.Howdoesthecomputerproblem-solvingmodeldifferfromPolya’s?InPolya’slist,thehumanexecutestheplanandevaluatestheresults.Inacomputersolution,aprogramiswrittenthatexpressestheplanin Lewis_complete_ans5/26/044:54PMPage619Chapter6Exercises619alanguagethatthecomputercanexecute.Thehumanthentakesthecomputeroutputandevaluatestheresults.26.Describethestepsinthealgorithmdevelopmentphase.Thealgorithmdevelopmentphaseincludesanalysis(understandingtheproblem),proposedsolution(logicalsequenceofsolutionsteps),andtesting(followingalgorithm).27.Describethestepsintheimplementationphase.Theimplementationphaseincludescoding(translatingthealgorithmintoacomputerlanguage)andtesting(compilingandrunningtheprogram).28.Describethestepsinthemaintenancephase.Themaintenancephaseinvolvesusingtheprogramandmodifyingtheprogramtoaddfunctionalityorcorrecterrors.29.Lookuparecipeforchocolatebrowniesinacookbookandanswerthefollowingquestions.a.Istherecipeanalgorithm?Justifyyouranswer.(Oneauthor’ssolution.)Yes,therecipeisanalgorithm.Ifthestepsarefollowedexactly,browniesareproduced.b.Organizetherecipeasanalgorithm,usingpseudo-code. Lewis_complete_ans5/26/044:54PMPage620620AnswerstoExercisesPreheatovento3750Put2ozunsweetenedchocolateindoubleboilerAdd1/2cupbuttertochocolateindoubleboilerPutdoubleboilerovermoderateflameMeltcontentsofdoubleboilerRemovedoubleboilerfromflameGetacupofsugarPut2eggsinbowlWhile(moresugar)BeateggsaddsugargraduallyPutcontentsofcooleddoubleboilerinbowlMixcontentsofbowlSift1/2cupflouranddashofsaltStirflourmixtureintobowlAdd1teaspoonvanillatobowlAdd1/2cupchoppednutstobowlMixcontentsofbowlGrease9-inchsquarepanPourcontentsofbowlintopanSetminutesto20PutpaninovenWhile(minutesnot0)Setminutestominutes-1RemovepanfromovenCutinto1-1/2”squaresEatc.Listthewordsthathavemeaningincomputing.Whileistheonlycomputingword.Itmeansrepetition.d.Listthewordsthathavemeaningincooking.Wordswithmeaningincookingincludepreheat,add,doubleboiler,melt,moderateflame,beat,gradually,mix,sift,dash,chopped,andgrease.e.Makethebrowniesandtakethemtoyourprofessor. Lewis_complete_ans5/26/044:54PMPage621Chapter6Exercises62130.Wesaidthatfollowingarecipeiseasierthandevelopingone.Gotothesupermarketandbuyavegetablethatyouhavenotcooked(oreaten)before.Takeithomeanddeveloparecipe.Writeupyourrecipeandyourcritiqueoftheprocess.(Ifitisgood,sendittotheauthors.)Thisisanactivity.Noanswerexpected.31.Describethetop-downdesignprocess.Thetop-downdesignprocessischaracterizedbysuccessivelayersofrefinement.Thetop-leveltasksarelisted.Ateachsucceedinglevel,thetasksfromthepreviousonearefurtherdeveloped.32.Differentiatebetweenaconcretestepandanabstractstep.Anabstractstepisoneinwhichfurtherdevelopmentisneeded.Aconcretestepisoneinwhichallthestepsarefullyspecified.33.Writeatop-downdesignforthefollowingtasks.Solutionsarenotunique.a.Buyingatoyforyourfour-year-oldcousin.GotostoreChoosetoyBuytoyGotostoreChoosestoreFindlocationTakebusChoosetoyWalkupanddownaislesPanicatchoicesGrabnearestlargestuffedanimal Lewis_complete_ans5/26/044:54PMPage622622AnswerstoExercisesBuytoyGotoclerkGivestuffedanimaltoclerkGivecreditcardtoclerkSigncreditcardslipb.Organizinganawardsbanquetforyoursoccerteam.RentbanquetroomSendinvitationsChoosemenuBuytrophiesRentbanquetroomFindwhatisavailableVisitpossiblechoicesChooseoneMakereservationSendinvitationsGetlistofpeopletoinviteBuyinvitationsAddressinvitationsMailinvitationsBuytrophiesFindouthowmanytobuyFindstorethatcarriestrophiesOrdertrophiesoverthephonePickuptrophies Lewis_complete_ans5/26/044:54PMPage623Chapter6Exercises623c.Buyingadressorsuitforanawardsbanquetatwhichyouarebeinghonored.GotofavoritestoreChoosedressorsuitthatsuitsyouPayforchoiceGohome34.Writeatop-downdesignforthefollowingtasks.Solutionsarenotunique.a.Calculatingtheaverageoftentestscores.Setcountto0Setsumto0While(count<10)GetscoreSetsumtosumplusscoreSetcounttocountplus1Setaveragetosumdividedby10b.Calculatingtheaverageofanunknownnumberoftestscores.Setcountto0Setsumto0While(therearemorescores)GetscoreSetsumtosumplusscoreSetcounttocountplus1Setaveragetosumdividedbycountc.Describethedifferencesinthetwodesigns.Theloopinthefirstdesignoperatesexactly10times.Theloopintheseconddesignoperatesaslongastherearemorescores.35.Writeatop-downdesignforthefollowingtasks.Solutionsarenotunique. Lewis_complete_ans5/26/044:54PMPage624624AnswerstoExercisesa.Findingatelephonenumberinthephonebook.FindtherightpageFindtherightcolumnSearchthecolumnfornameFindtherightpageOpentoapproximatepartofbookWhile(pagenotfound)ComparenamewithnameontopofrightpageIf(nameontopisless)TurnpageforwardElseComparenamewithnameontopofleftpageIf(nameontopisgreater)TurnpagebackwardElsePageisfoundFindrightcolumnCurrentcolumnisleftmostoneWhile(columnnotfound)If(nameonbottomofcurrentcolumnisgreater)ColumnisfoundElseSetcurrentcolumntooneatrightofcurrentcolumn Lewis_complete_ans5/26/044:54PMPage625Chapter6Exercises625SearchthecolumnfornameSetfoundtofalseWhile(moretolookatandnotfound)GetnextnameIf(nameistheoneyouwant)GetphonenumberSetfoundtotrueIf(foundisfalse)Numbernotinbookb.FindingatelephonenumberontheInternet.LogontoInternetGotofavoritesearchengineTypein“Findphonenumber”GotofirstresponseGetphonenumberLogoffc.Findingatelephonenumberonascrapofpaperthatyouhavelost.Searchpurses(wallets)forscrapofpaperSearchwastepaperbasketsforscrapofpaperSearchtrashcanforscrapofpaperSearchpurses(wallets)While(papernotfoundandtherearemorepursesorwallets)GetnextoneIf(paperisthere)paperisfound Lewis_complete_ans5/26/044:54PMPage626626AnswerstoExercisesSearchwastepaperbasketsWhile(papernotfoundandtherearemorewastepaperbaskets)GetnextoneIf(paperisthere)paperisfoundd.Describethesimilaritiesanddifferencesamongthesedesigns.Thefirstandthirdbothhaveaprocessrepeatedanumberoftimes;theseconddoesnot.Thefirstandthirdareprocessesthatmostofushavedonephysicallymanytimes.Thefirstandthirdinvolvealinearsearchthroughacontainerofdata:columnsinabookandpurses(wallets),wastepaperbaskets,andtrashcans.36.Distinguishbetweeninformationanddata.Informationisanyknowledgethatcanbecommunicated.Wheninfor-mationisintheformthatacomputercanuse,itiscalleddata.Thusdataisanyknowledgethatcanbecommunicatedinaformthatacomputercanprocess.37.Writeatop-downdesignforsortingalistofnamesintoalphabeticalorder.RepeatScanlistfornameclosesttobeginningofthealphabet(smallest)CopynametonewlistCrossnameofforiginallistUntil(Therearenomorenamesonoriginallist)Copynamesbackontooriginallist38.a.Whyisinformationhidingimportant?Informationhidingdefersdetailsuntilthelevelwherethedetailsareimportant.Thisprocesskeepsanalgorithmfrombeingdependentontheimplementationdetails,whichmaychange.b.Namethreeexamplesofinformationhidingthatyouencountereveryday.Talkingonthetelephone.Drivingacar.Turningonthetelevision. Lewis_complete_ans5/26/044:54PMPage627Chapter6Exercises62739.Anairplaneisacomplexsystem.Solutionsarenotunique.a.Giveanabstractionofanairplanefromtheviewofapilot.Apilotcanviewtheairplaneasacarthatheorshedrivesonahighwayofair.b.Giveanabstractionofanairplanefromtheviewofapassenger.Apassengercanviewtheairplaneastheinsideofalimousinethatiscarryingthepassengerfromoneplacetoanother.c.Giveanabstractionofanairplanefromtheviewofthecabincrew.Thecabincrewcanviewanairplaneasadiningroom.d.Giveanabstractionofanairplanefromtheviewofamaintenancemechanic.Amaintenancemechaniccanviewanairplaneasacollectionofpartsandwiresputtogetheraccordingtohisorhermaintenancediagrams.e.Giveanabstractionofanairplanefromtheviewoftheairline’scorporateoffice.Fromtheviewoftheboardroom,theairplanecanbeviewedasanexpensiveobjectusedintheprocessofmakingmoney.40.ListtheidentifiersandwhethertheynameddataoractionsforthedesignsinExercise33.a.Actions:go,choose,buy,find,give,signData:store,toy,clerk,creditcardb.Actions:rent,send,choose,buy,find,visit,make,get,address,mail,order,pickupData:banquetroom,invitations,menu,trophies,reservation,listofpeople,phonec.Actions:go,choose,payData:store,dress,suit,choice,home41.ListtheidentifiersandwhethertheynameddataoractionsforthedesignsinExercise34.a.Actions:set,getData:count,sum,score,averageb.Actions:set,getData:count,sum,score,average42.ListtheidentifiersandwhethertheynameddataoractionsforthedesignsinExercise35.a.Actions:find,search,open,compare,turn,setData:page,column,name,book,rightpage,leftpage Lewis_complete_ans5/26/044:54PMPage628628AnswerstoExercisesb.Actions:logon,go,type,getData:Internet,searchengine,firstresponse,phonenumber43.Finishtheverificationoftheaddresslistexample.ThenextmoduletobeverifiedisFillinmissingdata.Thefirststate-menttellstheuserwhattodoifinformationisstillnotknown.Thenextstatementgetsanamefromthelist.Thethirdstatementsetsupaloopingsituationthatcontinuesaslongastherearemorenames.Howtheexpressiononthewhilestatementisevaluatedisnotourconcernhere.Weassumewecontinueifthereismoredata.Withintheloop,thelastnameisprinted.Thethirdloopstatementasksifstreetismissing.Wedonothavetoworryatthislevelhowthisisdone,buttrueisreturnedifthedataismissing.Ifthedataismissing,theuserispromptedtoenterthedata,andthedataisread.Weassumethattheuserentersthedatacorrectly,thusthestreetisinputcorrectlyifthatdataismissing.Thesamelogiccanbeappliedtothenexttwoifstate-ments.Thelaststatementgetsanothernamefromthelist.Putlistinalphabeticalordercallsonamoduletosortthelist.Weassumethatthelower-levelmoduleiscorrect,sothismoduleiscorrect.Printthelistwritesaheaderlabelontheoutput.Thenextstatementgetsanamefromthelist.Thethirdstatementsetsupaloopingsitua-tionthatcontinuesaslongastherearemorenames.Thenextfourstatementswritethepartsoftheentry.Weassumethatthelower-levelmodulesprintthedatacorrectly.Ablanklineiswrittentoseparatethisperson’sdatafromthenext.Thelaststatementintheloopgetsanothername.44.Takesomesampledataanddeskchecktheaddresslistexamplewithactualvalues.Thisisanactivity,notaquestion.45.VerifythedesignsinExercise33usingawalk-through.Thisisanactivity,notaquestion.46.VerifythedesignsinExercise34usinganinspection.Thisisanactivity,notaquestion.47.VerifythedesignsinExercise35usingtop-downreasoning.Therearethreetasksinthemainmodule:Findtherightpage,Findtherightcolumn,Searchthecolumnforthename.Ifthefirsttaskisdonecorrectlyandthesecondtaskisdonecorrectly,thethirdtaskhasthepropercolumnuponwhichtosearch.Ifthesearchingmoduleworkscorrectly,thenthetelephonenumberisfound. Lewis_complete_ans5/26/044:54PMPage629Chapter6Exercises629ModuleFindtherightpagestartsbyopeningthephonebooktotheapproximatepage.Aloopissetuptokeeplookingatpagesuntilthecorrectoneisfound.Thisisdonebycomparingthenamewiththenameonthetopoftheright-handpage,whichisthe“largest”nameonthepage.Iftheoneforwhichwearesearchingis“larger,”thentheright-handpageisturnedandtheprocessstartsagain.Iftheoneforwhichwearesearchingis“smaller,”itiscomparedtothenameonthetopoftheleft-handpage,whichisthe“smallest”nameonthepage.Ifthenamewearelookingforis“smaller,”weturntheleft-handpage.Otherwise,thenamewearelookingforisonthedoublepagefound.ModuleFindtherightcolumn,setsthecurrentcolumntotheleftmostone.Ifthenameonthebottomofthecurrentcolumnis“greater,”therightcolumnisfound;otherwisethecurrentcolumnisthenextcolumnontheright.ModuleSearchthecolumnforthenamesetsfoundtofalseandstartslookingnamebynamefortheonewhosephonenumberyouwant.Theprocessofsearchingcontinuesuntilthenameisfoundortherearenomorenamestoexamine.Ifthenameisfound,thenumberisaccessed.Iftheloopendsandfoundisstillfalse,thenthenamewasnotinthebook.Iftheloopexpressionisevaluatedcorrectlyandthecomparisonbetweennamesworkscorrectly,thenthismoduleworkscorrectly.b.Thereisonlyonemoduleinthissolution.Thefirstthreestatementsareactions,whichweassumearecorrect.Thefourthstatementassumesthatthefirstresponsefromthesearchisanonlinetele-phonebook.Thefifthstatementassumesthatthenumberisinthephonebook.Giventheseassumptions,themoduleiscorrect.48.Distinguishbetweenanobjectandanobjectclass.Anobjectclassisdescriptionofagroupofobjectswithsimilarprop-ertiesandbehaviors.Anobjectisathingorentitythathadmeaningwithinaproblem.Anobjectisoneofthethingsdescribedbyanobjectclass.49.Distinguishbetweenafieldandamethod.Afieldnamesdataoractionswithinaclass.Amethodisanamedactionwithinaclass.Thusafieldcancontainamethod.50.Howcanobjectsrelatetooneanother?Objectscanberelatedbycontainment,inheritance,orcollaboration.Anobjectcancontainanotherobjectasafield.Anobjectcaninherit Lewis_complete_ans5/26/044:54PMPage630630AnswerstoExercisesthedataandbehaviorofanotherobjectclass.Anobjectcancollabo-ratewithanobjectofitsownclassoranotherclass.51.Discussthedifferencesbetweenatop-downdesignandanobject-orienteddesign.Top-downdesignbreakstheproblemintosuccessivelevelsoftasks;object-orienteddesignbreakstheproblemintosuccessivelevelsofdataobjects.52.Weoutlinedastrategyfordevelopinganobject-orienteddecomposi-tion.a.Listthefourstages.Brainstorming,filtering,scenarios,andresponsibilityalgorithms.b.Outlinethecharacteristicsofeachstage.Brainstormingisagroupproblem-solvingactivitythatinvolvesthespontaneouscontributionofideasfromallmembersofthegroup.Theoutputfromthisactivityisalistofpossibleclasses.Filteringisagroupactivityinwhichthetentativelistofclassesisanalyzedtodetermineifthereareduplicates,ifsomeclassessharecommonattributesandbehaviors,andifthereareclassesthatreallydonotbelonginthesolution.Scenariosaregroupactivitiesthatdeterminetheresponsibilitiesoftheclasses.Theyask“whatif”questionsanddetermineifallpossiblesituationshavebeenconsidered.Responsibilityalgorithmsarethealgorithmsthatimplementtheresponsibilities.Thisphaseiswherethealgorithmstocarryoutthesolutiongetwritten.c.Whatistheoutputfromeachofthefourstages?Brainstorming:alistofpossibleclasses.Filtering:CRCcardsfortheclassesthatsurvivedthisstage.Scenarios:CRCcardswithresponsibilitiesoutlinedandcollabora-torsindicated.Responsibilityalgorithms:Algorithmsforeachoftheresponsibili-ties.d.Arethestagesindependent?Explain.No,eachstateisnotindependent.Thefirststageproducesatenta-tivelistthatisusedasinputtothesecondstage.Thesecondstageproducesalistofclassesthathavesurvivedthefilteringstagesasinputtothethirdstage.ThethirdstageproducescompletedCRCcardsthatareinputtothefourthstage. Lewis_complete_ans5/26/044:54PMPage631Chapter6Exercises63153.DesigntheCRCcardsforaninventorysystemforacardealership,usingbrainstorming,filtering,andscenarios.Brainstorming:color,idnumber,datearrivedatdealership,datesold,nameofbuyer,nameofcar,nameofseller,dateboughtbydealer,dateoflastrepairFiltering:car,date,person,name,listofcars,idnumber,colorScenarios:ClassName:CarSuperclass:Subclasses:UsedCarResponsibilitiesCollaborationsInitializeitself(name,date,color,idnumber)String,Date,String,StringKnowcolorStringKnowdateBoughtDateKnownameStringKnowidnumberStringSetRepair(date)DateKnowRepairDateDateSold(name,date)Name,DateKnowdateSoldDateKnowbuyerNameKnowrepairDateClassName:UsedCarSuperclass:CarSubclasses:ResponsibilitiesCollaborationsInitializeitself(car,date,name)Car,Date,NameKnowdateBoughtDateKnowfromWhomName Lewis_complete_ans5/26/044:54PMPage632632AnswerstoExercisesClassName:DateSuperclass:Subclasses:ResponsibilitiesCollaborationsInitializeitself(month,day,year)int,int,intKnowmonthintKnowdayintKnowyearintClassName:NameSuperclass:Subclasses:ResponsibilitiesCollaborationsInitializeitself(first,last)String,StringKnowfirstStringKnowlastStringClassName:List(fromLibrary)Superclass:Subclasses:ResponsibilitiesCollaborationsInsert(car)CarDelete(car)Car...54.DesigntheCRCcardsforadatabaseforazoousingbrainstorming,filtering,andscenarios.Brainstorming:familyname,name,dateofbirth,datebought,food,cageNumber,sex,dateoflastshotsFiltering:animal,name,date,food,cageNumber,sexScenarios: Lewis_complete_ans5/26/044:54PMPage633Chapter6Exercises633ClassName:AnimalSuperclass:Subclasses:ResponsibilitiesCollaborationsInitializeitself(familyName,name,String,String,Date,Date,String,String,dateOfbirth,dateBought,eatsWhat,CharcageNumber,sex)KnowfamilyNameStringKnownameStringKnowfoodStringKnowdateOfbirthDateKnowdateBoughtDateGetshots(Date)DateKnowdateOfShotsDateKnowcageNumberStringKnowsexCharKnowdiesStringClassName:DateSuperclass:Subclasses:ResponsibilitiesCollaborationsInitializeitself(month,day,year)int,int,intKnowmonthintKnowdayintKnowyearintClassName:List(fromLibrary)Superclass:Subclasses:ResponsibilitiesCollaborationsInsert(animal)AnimalDelete(animal)Animal...55.Distinguishbetweendataabstractionandproceduralabstraction.Dataabstractionistheseparationofthelogicalviewofdatafromitsimplementation.Proceduralabstractionistheseparationofthelogicalviewofanactionfromitsimplementation.Dataabstractionisassoci- Lewis_complete_ans5/26/044:54PMPage634634AnswerstoExercisesatedwithdataobjects;proceduralabstractionisassociatedwithactions.56.Whatisaprogramminglanguage?Aprogramminglanguageisasequenceofinstructionstoperformaspecifiedtaskwritteninalanguagethatacomputercanexecuteorthatcanbetranslatedintoalanguagethatacomputercanexecute.57.Distinguishbetweensyntaxandsemantics.Syntaxisthesetofformalrulesgoverninghowinstructionsarewritteninalanguage.Semanticsisthesetofrulesthatgivemeaningtotheinstructionsinalanguage.Chapter7ExercisesForExercises1–15,marktheanswerstrueandfalseasfollows:A.TrueB.False1.ArithmeticcanbeperformedintheInstructionRegister.B2.ArithmeticcanbeperformedintheARegister.A3.Arithmeticcanbeperformedintheaccumulator.A4.TheZbitis1iftheaccumulatoriszero.A5.TheNbitis0iftheaccumulatorisnegative.B6.TheProgramCounterandtheInstructionRegisteraretwonamesforthesameplace.B7.TheAregisterandtheaccumulatoraretwonamesforthesameplace.A8.TheInstructionRegisteristhreebyteslong.A9.TheProgramCounteristhreebyteslong.B Lewis_complete_ans5/26/044:54PMPage635Chapter7Exercises63510.Thestatusbitsareeachonebytelong.B11.Theinstructionspecifieristwobyteslong.B12.Ifthedatatobeloadedintotheaccumulatorisstoredintheoperand,theinstructionspecifieris00.A13.Ifthedataintheaccumulatoristobestoredintheplacenamedintheoperand,theinstructionspecifieris00.B14.AllPep/7instructionsoccupythreebytes.B15.Thebranchinginstructionstestthestatusbits.AGiventhefollowingstateofmemory(inhexadecimal),answerExercises16through20bymatchingtheproblemtothesolutionshown.0001A20002110003FF000400A.1010001000010010B.1111111100000000C.0000000000000011D.1110110100000001E.000100100000000016.WhatarethecontentsoftheAregisteraftertheexecutionofthisinstruction?000010000000000000000011C17.WhatarethecontentsoftheAregisteraftertheexecutionofthisinstruction?000010010000000000000011B Lewis_complete_ans5/26/044:54PMPage636636AnswerstoExercises18.WhatarethecontentsoftheAregisteraftertheexecutionofthefollowingtwoinstructions?000010010000000000000001000110000000000000000001A19.WhatarethecontentsoftheAregisteraftertheexecutionofthefollowingtwoinstructions?000010000000000000000001000110010000000000000010E20.WhatarethecontentsoftheAregisteraftertheexecutionofthefollowingtwoinstructions?000010010000000000000011001000010000000000000010DExercises21–53areshortanswerorprograms.21.Whatdoesitmeanwhenwesaythatacomputerisaprogrammabledevice?Programmablemeansthatdataandinstructionsarelogicallythesameandarestoredinthesameplace.Theconsequenceofthisfactisthattheprogramthecomputerexecutesisnotwiredintothehardwarebutenteredfromoutside.22.Listfiveoperationsthatanymachinelanguagemustinclude.Theremustbemachine-languageinstructionstostore,retrieve,andprocessdata,toinputdata,andtooutputdata.TheseinstructionsmirrortheoperationsofthevonNeumannmachine.23.Thedistinctionbetweenconcreteandabstractstepsinalgorithmsisnotalwaysclearcut.Discussthisdilemmaandgiveconcreteexamplestosupportyourdiscussion.Algorithmsareeventuallycodedinaprogramminglanguage.Differentprogramminglanguagesrepresentdifferentlevelsofabstrac-tion.Whattakesasinglestepinonelanguagemaytakemanystepsinanotherlanguage.Thus,aconcretestepinonelanguagemaybeanabstractstepinanother. Lewis_complete_ans5/26/044:54PMPage637Chapter7Exercises63724.Whatisavirtualmachine?DiscussthisdefinitionintermsofthePep/7computer.Avirtualmachineisahypotheticalmachinedesignedtoillustrateimportantfeaturesofarealcomputer.ThePep/7computerisavirtualmachinedesignedtoillustratethefeaturesofthevonNeumannarchi-tecture.Ithasinstructionstostore,retrieve,andprocessdataaswellasinstructionstoinputandoutputdata.25.WesaidthatyoushouldhaveguessedthataPep/7instructionwoulduse5bitswhenwesaidthattherewere32instructions.Explain.Ittakesexactly5bitstorepresent32differentthings,instructionsinthiscase.26.DescribethefeaturesofthePep/7CPUthatwecoveredinthischapter.Thereisoneregisterforarithmeticandlogicaloperations:theAregister(theaccumulator).ThereisaProgramCounterthatcontainstheaddressofthenextinstructiontobeexecutedandtheInstructionRegisterthatcontainstheinstructionbeingexecuted.Therearetwostatusbits,NandZ,whichareoneiftheaccumulatorisnegativeorzeroiftheaccumulatorispositive,respectively.Memoryisbyteaddressable.27.Wecoveredonlytwoofthefouraddressingmodes.Ifwehadnotstatedthisexplicitly,couldyouhavededucedthatthiswastrue?Explain.Iftherewereonlytwoaddressingmodes,onebitwouldhavebeenusedinsteadoftwo.Becausetwobitsareused,theremustbefourmodes.28.Whereisthedata(operand)iftheaddressmodespecifierisa.00Iftheaddressmodespecifieris00,thedataisintheoperandspecifier.b.01Iftheaddressmodespecifieris01,thedataisstoredintheplacenamedintheoperandspecifier.29.DistinguishbetweentheIR(instructionregister)andthePC(programcounter).TheIRcontainsaninstruction(theonebeingexecuted);thePCcontainsanaddress(theaddressofthenextinstructiontobeexecuted).30.HowmanybitsarerequiredtoaddressthePep/7memory?ThePep/7memorycontains4096bytes,so12bitsarerequiredtoaddresseachone. Lewis_complete_ans5/26/044:54PMPage638638AnswerstoExercises31.Howmanymorecellscouldbeaddedtomemorywithouthavingtochangetheinstructionformat?Justifyyouranswer.Theoperandspecifieris16bitslong.Therefore216differentbytescouldbeaddressedwithoutchangingtheinstructionformat.Thus,61440morebytescouldbeadded.32.SomePep/7instructionsareunary,takingonlyonebyte.Otherinstructionsrequirethreebytes.Giventheinstructionsthatwehavecoveredinthischapter,woulditbeusefultodefineinstructionsthatrequireonlytwobytes?Theinstructionswehavecovered,otherthantheStopinstruction,usetheoperandspecifieroftheinstruction.Theoperandspecifieristwobyteslong,sothreebytesarerequiredfortheinstruction:theinstruc-tionspecifierandtheoperandspecifier.Therefore,two-byteinstruc-tionswouldnotbeuseful.33.IftheinputcharacterisA,whatistheresultofexecutingthefollowingtwoinstructions?00011101100100000000000001100004111000000000000000001010Aiswrittenonthescreen.34.IftheinputcharacterisA,whatistheresultofexecutingthefollowingtwoinstructions?00011101100100000000000001100004111000010000000000001010Whateverisstoredinlocation01000001iswrittenonthescreen.35.Writethealgorithmforwritingoutyourname,giventhattheimple-mentationlanguageisPep/7machinecode.Write“Nell”Write“Nell”Write“N”Write“e”Write“l”Write“l” Lewis_complete_ans5/26/044:54PMPage639Chapter7Exercises639Write“N”Write4E(hex)Write“e”Write65(hex)Write“l”Write6C(hex)Write“l”Write6C(hex)36.Writethemachine-languageprogramtoimplementthealgorithminExercise35.E0004EE00065E0006CE0006Czz37.Writethealgorithmforwritingoutyourname,giventhattheimple-mentationlanguageisPep/7assemblylanguage.Write“Nell”Write“Nell”Write“N”Write“e”Write“l”Write“l” Lewis_complete_ans5/26/044:54PMPage640640AnswerstoExercises38.Writetheassembly-languageprogramtoimplementthealgorithminExercise37.CHAROh#0010,d;Output‘N’CHAROh#0011,d;Output‘e’CHAROh#0012,d;Output‘l’CHAROh#0013,d;Output‘l’STOP.ASCII/Nell/;Store‘Hello’intoproperplaces.END39.Rewritethemachinelanguageprogramin7.4,usingdirectaddressing.E10010E10011E10012E10013E100140048656C6C6Fzz40.DistinguishbetweenthePep/7menuoptionsLoad,Load/Execute,andExecute.Loadputstheprograminmemoryreadytoexecute.Load/Executeloadstheprogramintomemoryandexecutesit.Ifaprogramisloaded,anExecutecommandexecutestheprogram.Iftheactivewindowcontainsamachinelanguageprogramandthereisnoloadedprogram,theExecutecommandloadsandexecutesit.41.Thefollowingprogramseemstorun,butdoesstrangethingswithcertaininputvalues.Canyoufindthebug?BRMainsum:.WORDd#0num1:.BLOCKd#1num2:.BLOCKd#1num3:.BLOCKd#1Main:LOADAsum,dDECInum1,dDECInum2,dDECInum3,dADDAnum3,dADDAnum2,dADDAnum1,dSTOREAsum,dDECOsum,dSTOP.END Lewis_complete_ans5/26/044:54PMPage641Chapter7Exercises641Onebyteofstorageissetupforeachinputvalue.Ifthevaluethatisreadisgreaterthanonebyte,theexcessspillsovertothebyteabove,givingthewronganswer.42.CorrectthecodeinExercise41andrunthetestplanoutlinedinthechapter.BRMainsum:.WORDd#0num1:.BLOCKd#2num2:.BLOCKd#2num3:.BLOCKd#2Main:LOADAsum,dDECInum1,dDECInum2,dDECInum3,dADDAnum3,dADDAnum2,dADDAnum1,dSTOREAsum,dDECOsum,dSTOP.ENDThetestplangivesthecorrectanswerswiththiscode.43.Finishexecutingthetestplanforthealgorithminthetextthatreadsandsumsthreevalues.Theanswersarecorrect.44.Writeanalgorithmthatreadsinthreevaluesandwritesouttheresultofsubtractingthesecondvaluefromthesumofthefirstandthethirdvalues.Readnum1Readnum2Readnum3Loadnum1Addnum3Subnum2StoreinanswerWriteanswer Lewis_complete_ans5/26/044:54PMPage642642AnswerstoExercises45.ImplementthealgorithminExercise44asanassembly-languageprogram.BRMainanswer:.WORDd#0num1:.BLOCKd#2num2:.BLOCKd#2num3:.BLOCKd#2Main:DECInum1,dDECInum2,dDECInum3,dLOADAnum1,dADDAnum3,dSUBAnum2,dSTOREAanswer,dDECOanswer,dSTOP.END46.WriteandimplementatestplanfortheprograminExercise45.ReasonforTestCaseInputValuesExpectedOutputObservedOutputAssumption:Inputvaluesarenogreaterthan215–1orlessthan–215Input3positivenumbers4,6,1–1–1Input3negativenumbers–4,–6,–111Inputmixednumbers4,6,–1–3–34,–6,111114,–6,–1–9–9–4,6,1–9–9–4,6,–1–11–11–4,–6,133Largenumbers32767,–1,+1,overflowsoverflows32767,1,–13276747.Designandimplementanalgorithminassemblylanguagethatreadsfourvaluesandprintsthesum. Lewis_complete_ans5/26/044:54PMPage643Chapter7Exercises643Readnum1Readnum2Readnum3Readnum4Loadnum1Addnum2Addnum3Addnum4StoreinanswerWriteanswerBRMainanswer:.WORDd#0num1:.BLOCKd#2num2:.BLOCKd#2num3:.BLOCKd#2num4:.BLOCKd#2Main:DECInum1,dDECInum2,dDECInum3,dDECInum4,dLOADAnum1,dADDAnum2,dADDAnum3,dADDAnum4,dSTOREAanswer,dDECOanswer,dSTOP.END48.Isthetestplanforamachinelanguageprogramvalidforthesamesolutionwritteninassemblylanguage?Explainyouranswer.Adata-coverageplaniswrittenwithoutlookingatthecode,sothesametestplanwouldbevalid.Acode-coverageplanlooksatthecode,butbecausethereisaone-to-onerelationshipbetweenamachinecodeinstructionandanassemblylanguageinstruction,thesametestplanwouldbevalid. Lewis_complete_ans5/26/044:54PMPage644644AnswerstoExercises49.Distinguishbetweenthepseudocodeinstructions.BLOCKand.WORD.Thepseudocodeinstruction.BLOCKtakesadecimalargumentandsetsasidethatmanybytesofstorageandsetsthemtozero.A.WORDpseudocodeinstructiontakesadecimalargumentandgeneratesonewordofstoragewiththedecimalvaluestoredinit.50.Distinguishbetweenassemblylanguagepseudocodeinstructionsandmnemonicinstructions.Pseudocodeinstructionsareinstructionstotheassembler;mnemonicinstructionsaretobetranslatedbytheassembler.51.Distinguishbetweentestplansbasedoncodecoverageanddatacoverage.Acode-coveragetestplanisbasedonexaminingandcoveringthestatementsinthecode.Adata-coveragetestplanisbasedontheinputdatatotheprogram.52.ExplainthemeaningofthePep/7menuoptionExecutionInput.TheExecutionInputmenuasksifyouwanttheinputdatatocomefromthecurrentwindoworfromthekeyboard.53.WritethePep/7assemblylanguagestatementforthefollowinginstruc-tions.a.BranchtolocationBranch1iftheaccumulatoriszero.BREQBranch1b.BranchtolocationBranch1iftheaccumulatorisnegative.BRLTBranch1c.BranchtolocationBranch1iftheaccumulatorisnegativeandtoBranch2ifaccumulatorisnotnegative.BRLTBranch1Branch2:Thatis,gotolocationBranch1iftheaccumulatorisnegative.Iftheaccumulatorisnotnegative,thenextinstructionisexecuted,soitmustbelabeledBranch2.Chapter8ExercisesForExercises1–14,matchthequestionwiththeappropriatetranslationorexecutionsystem.A.InterpreterB.AssemblerC.CompilerD.Machinecode Lewis_complete_ans5/26/044:54PMPage645Chapter8Exercises6451.Whattranslatesahigh-levellanguageintomachinecode?C2.WhattranslatesaJavaprogramintoBytecode?C3.WhatexecutesBytecode?A4.Whattranslatesanassemblylanguageprogram?B5.Whatistheoutputofanassembler?D6.Whattakesinputinahigh-levellanguageanddirectsthecomputertoperformtheactionsspecifiedineachstatement?A7.WhatexecutestheJavaVirtualMachine?D8.WhatisusedtotranslateaprograminALGOL?C9.WhatisusedtotranslateaprograminAPL?A10.WhatisusedtotranslateaprograminCOBOL?C11.WhatisusedtotranslateaprograminFORTRAN?C12.WhatisusedtotranslateaprograminLisp?A13.WhatisusedtotranslateaprograminSNOBOL4?A14.Whichtranslatorrunstheslowest?AForExercises15–36,matchthelanguageparadigmandthelanguageorlanguagedescription.A.ImperativeorproceduralB.FunctionalC.LogicD.Objectoriented Lewis_complete_ans5/26/044:54PMPage646646AnswerstoExercisesE.Procedurallanguagewithsomeobject-orientedfeaturesF.Object-orientedlanguagewithsomeproceduralfeatures15.WhichparadigmmostaccuratelydescribesFORTRAN?A16.WhichparadigmmostaccuratelydescribesC++?E17.WhichparadigmmostaccuratelydescribesPASCAL?A18.WhichparadigmmostaccuratelydescribesJava?F19.WhichparadigmmostaccuratelydescribesLisp?B20.WhichparadigmmostaccuratelydescribesBASIC?A21.WhichparadigmmostaccuratelydescribesPROLOG?C22.WhichparadigmmostaccuratelydescribesSIMULA?D23.WhichparadigmmostaccuratelydescribesALGOL?A24.WhichparadigmmostaccuratelydescribesML?B25.WhichparadigmmostaccuratelydescribesScheme?B26.WhichparadigmmostaccuratelydescribesAda?A27.WhichparadigmmostaccuratelydescribesC?A28.WhichparadigmmostaccuratelydescribesSmalltalk?D29.Thedominantlanguagesusedinindustrythroughoutthehistoryofcomputingsoftwarecomefromwhichparadigm?A30.WhichparadigmdidtheJapanesechooseforthefifth-generationcomputer?C Lewis_complete_ans5/26/044:54PMPage647Chapter8Exercises64731.Whichparadigmallowstheprogrammertoexpressalgorithmsasahierarchyofobjects?D32.Whichparadigmallowstheprogrammertoexpressalgorithmsasahierarchyoftasks?A33.Whichparadigmallowstheprogrammertoexpressalgorithmsasmathematicalfunctions?B34.Whichparadigmhasnoassignmentstatement?B35.Whichparadigmusesrecursionexclusivelytoexpressrepetition?B36.Whichparadigmhasnovariables?BExercises37–82areshortanswer.37.Whatisthehallmarkofanassemblylanguage?Thehallmarkofanassemblylanguageisthateachassemblylanguageinstructionistranslatedintoonemachinelanguageinstruction.38.Distinguishbetweenanassemblerandacompiler.Anassemblertranslatesassembly-languageinstructionsintomachinecode.Acompilertranslateshigh-levellanguageinstructionsintomachinecode.Thetranslationofanassemblerisonetoone:Onestatementinassemblylanguageistranslatedintoonestatementinmachinecode.Thetranslationofacompilerisonetomany:Onehigh-levellanguageinstructionistranslatedintomanymachinelanguageinstructions.39.Distinguishbetweenacompilerandaninterpreter.Theoutputfromacompilerisamachine-languageprogram.Thatprogrammaybestoredforlateruseorimmediatelyexecuted,buttheexecutionisadistinctprocessfromthetranslation.Theoutputfromaninterpreterisasolutiontotheoriginalproblem,notaprogramthatwhenexecutedgivesyouthesolution.40.Compareandcontrastanassembler,acompiler,andaninterpreter.Allthreearetranslators.Theydifferinthecomplexityofthelanguagestheytranslateandintheoutputfromthetranslator.Assem-blersandcompilersproducemachine-languageprograms,whichwhen Lewis_complete_ans5/26/044:54PMPage648648AnswerstoExercisesrun,solvetheoriginalproblem;interpretersproducesolutionstotheoriginalproblem.Assemblerstranslateverysimplelanguages;compilersandinterpreterscantranslateverycomplexlanguages.41.Describetheportabilityprovidedbyacompiler.Aprogramwritteninahigh-levellanguagethatiscompiledcanbetranslatedandrunonanymachinethathasacompilerforthelanguage.42.DescribetheportabilityprovidedbytheuseofBytecode.Bytecodeistheoutputfrom(usually)aJavacompiler.ThereisavirtualmachineforwhichBytecodeisthemachinelanguage.AprogramcompiledintoBytecodecanbeexecutedonanysystemthathasasimulatorforthevirtualmachine.TheJavaVirtualMachine(JVM)executedBytecode.43.DescribetheprocessofcompilingandrunningaJavaprogram.AJavaprogramiscompiledintoBytecode,whichcanbeexecutedonanysystemwithaJVM.44.Discussthewordparadigmasitrelatestocomputing.Programminglanguagesreflectdifferingviewsofreality,whichwecallparadigms.Weusetheseviews(paradigms)toclassifythelanguages.45.Namefourprogramminglanguageparadigmsandgiveanexamplelanguageineach.Imperativeorproceduralparadigm:Fortran,Basic,Cobol,C,C++Functionalparadigm:Lisp,Scheme,ML,FPLogicparadigm:PROLOGObject-orientedparadigm:Simula,Smalltalk,Java46.Whatarethecharacteristicsoftheimperativeparadigm?Programsdescribetheprocessesnecessarytosolvetheproblem.47.Whatarethecharacteristicsofthefunctionalparadigm?Programsareexpressedastheevaluationoffunctions.48.Whatarethecharacteristicsofthelogicparadigm?Rulesoflogicareusedtodeduceanswersfromfactsandrules.49.Howdoestheviewofanobject-orientedprogramdifferfromtheviewofanimperativeprogram?Anobject-orientedviewofaprogramisthatofinteractingobjects;theimperativeviewofaprogramisthatofinteractingtasks. Lewis_complete_ans5/26/044:54PMPage649Chapter8Exercises64950.Howdoyouaskquestionsinaprogramminglanguage?Toaskaquestioninaprogramminglanguage,youmakeanassertion.Iftheassertionistrue,theansweristrue.Iftheassertionisfalse,theanswerisfalse.51.WhatisaBooleanvariable?ABooleanvariableisaplaceinmemory,referencedbyanidentifier,thatcancontaintrueorfalse.52.WhatisaBooleanexpression?ABooleanexpressionisasequenceofidentifiers,separatedbycompatibleoperators,thatevaluatestotrueorfalse.53.GivenBooleanvariablesone,two,andthree,writeanassertionforeachofthefollowingquestions.a.Isonegreaterthanbothtwoandthree?(one>two)AND(one>three)b.Isonegreaterthantwo,butlessthanthree?(one>two)AND(one0)AND(two>0)AND(three>0)d.Isonelessthantwooronelessthanthree?(oneone)AND(three,whatdothevaluesmean?Thisaddressmeansthe133byteonpage2.Exercises59–61refertothefollowingPMT.Page0123Frame527359.Iftheframesizeis1024,whatisthephysicaladdressassociatedwiththelogicaladdress<2,85>?7253 Lewis_complete_ans5/26/044:54PMPage677Chapter10Exercises67760.Iftheframesizeis1024,whatisthephysicaladdressassociatedwiththelogicaladdress<3,555>?362761.Iftheframesizeis1024,whatisthephysicaladdressassociatedwiththelogicaladdress<3,1555>?Illegaladdress.Theoffsetislargerthanthepagesize.62.Whatisvirtualmemoryandhowdoesitapplytodemandpaging?Virtualmemoryistheillusionthatmemoryislimitlessandthusthereisnolimitonthesizeofaprogram.Demandpagingisthetechniquewherepagesarebroughtintomemoryonlywhentheyarereferenced(needed).Demandpagingallowsprogramsofanysizetorun,thusgivingtheillusionofinfinitememory.63.Whataretheconceptualstagesthroughwhichaprocessmoveswhilebeingmanagedbytheoperatingsystem?new,ready,running,waiting,andterminated64.Describehowaprocessmightmovethroughthevariousprocessstates.Createspecificreasonswhythisprocessmovesfromonestatetoanother.Anewprocessbeginsinthenewstate.Whentheprocesshasnobarstoitsexecution,itmovesintothereadystate.Itwaitsinthereadystateuntilitgetstimeintherunningstate.Itrunsforawhileandissuesacommandforfileinput.TheprocessismovedintothewaitingstateuntiltheI/Ohasbeencompleted,atwhichtimeitmovesintothereadystatetoawaitanotherturnintherunningstate.EventuallyitgetsbacktotheCPUandrunsuntilitneedsaccesstoapartoftheprogramthatisonsecondarystorage.Itmovesintothewaitingstateuntiltheneededpagesarebroughtin;thenitmovesbacktothereadystate.ItgetsitsthirdshotattheCPUandfinishes,andmovesintotheterminatedstate.65.Whatisaprocesscontrolblock?Aprocesscontrolblock(PCB)isadatastructurethatcontainsinfor-mationaboutaprocess.APCBiscreatedforeachnewprocess.Whenaprocessmovesfromonestatetoanother,itsPCBismovedwithit.67.HowiseachconceptualstagerepresentedintheOS?EachconceptualstageisrepresentedbyalistofthePCBsinthatstage.68.Whatisacontextswitch?WhenaprocessismovedoutoftheCPU,thecurrentcontentsoftheregisters,includingtheprogramcounter,mustbesavedintheprocess’sPCB.WhenanewprocessmovesintotheCPU,thecontents Lewis_complete_ans5/26/044:54PMPage678678AnswerstoExercisesoftheregistersfromthisprocess’sPCBarerestored.Thisprocessofsavingandrestoringregistersiscalledacontextswitch.69.Distinguishbetweenpreemptiveschedulingandnonpreemptivesched-uling.Withnonpreemptivescheduling,onceaprocessisintherunningstate,itremainsthereuntilitvoluntarilyleaves.Withpreemptivesched-uling,theOScanmoveaprocessfromtherunningstatetothewaitingstateorreadystate.70.NameanddescribethreeCPUschedulingalgorithms.First-come,first-served:Theprocessesaremovedintotherunningstateintheorderinwhichtheyarriveinthereadystate.Shortestjobnext:WhentheCPUisreadyforantherjob,theprocessinthereadystatethattakestheshortesttimeismovedintotherunningstate.TheestimatedlengthoftimethataprocessneedstheCPUmayormaynotbeaccurate.Roundrobin:Eachprocessstaysintherunningstateforapredeter-minedamountoftime,calledatimeslice.Whenaprocess’stimesliceisover,itismovedbackintothereadystate,whereitstaysuntilitisitsturnfortheCPUagain.UsethefollowingtableofprocessesandservicetimeforExercises71through73.ProcessP1P2P3P4P5Servicetime120601805030071.DrawaGanttchartthatshowsthecompletiontimesforeachprocessusingfirst-come,first-servedCPUscheduling.0120180360410710P1P2P3P4P572.DrawaGanttchartthatshowsthecompletiontimesforeachprocessusingshortestjobnextCPUscheduling.050110230360710P4P2P1P3P5 Lewis_complete_ans5/26/044:54PMPage679Chapter10Exercises67973.DrawaGanttchartthatshowsthecompletiontimesforeachprocessusingroundrobinCPUschedulingwithatimesliceof60.060120180230290350410470530590650710P1P2P3P4P5P1P3P5P3P5P5P574.Giventhefollowingstateofmemorywherethepartitionsaredynamic,showmemoryafterusingeachofthefollowingpartitionselectionapproachesafteranewjobrequiring66blocksofmainmemory.a.firstfitb.bestfitc.worstfitOperatingSystemProcess1Process2Process3Empty300blocksTheansweristhesameinallthreepartitionselectionapproaches. Lewis_complete_ans5/26/044:54PMPage680680AnswerstoExercisesOperatingSystemProcess1Process2Process3Process4Empty144blocks75.Distinguishbetweenfixedpartitionsanddynamicpartitions.Thesizesofthepartitionsarefixedinafixedpartitionscheme,althoughtheyarenotnecessarilythesamesize.Inadynamicpartitionscheme,thepartitionsareallocatedasneeded.Chapter11ExercisesForExercises1–15,marktheanswerstrueandfalseasfollows:A.TrueB.False1.Atextfilestoresbinarydatathatisorganizedintogroupsof8or16bitsthatareinterpretedascharacters.A2.Aprogramwritteninahigh-levellanguageisstoredinatextfilethatisalsocalledasourcefile.A3.Thetypeofafiledetermineswhatkindsofoperationscanbeperformedonit.A Lewis_complete_ans5/26/044:54PMPage681Chapter11Exercises6814.Thecurrentfilepointerindicatestheendofafile.B5.Sequentialaccessanddirectaccesstakeaboutthesameamountoftimetoretrievedata.B6.Someoperatingsystemsmaintainaseparatereadpointerandwritepointerforafile.A7.Unixfilepermissionsallowagroupofuserstoaccessafileinvariousways.A8.Inmostoperatingsystems,adirectoryisrepresentedasafile.A9.Twofilesinadirectorysystemcanhavethesamenameiftheyareindifferentdirectories.A10.Arelativepathisrelativetotherootofthedirectoryhierarchy.B11.Anabsolutepathandarelativepathwillalwaysbethesamelength.B12.Anoperatingsystemisresponsibleformanagingtheaccesstoadiskdrive.A13.Theseektimeistheamountoftimeittakesfortheheadsofadisktoreachaparticularcylinder.A14.Theshortest-seek-time-firstdiskschedulingalgorithmmovestheheadstheminimumamountitcantosatisfyapendingrequest.A15.Thefirst-come,first-serveddiskschedulingalgorithmmovestheheadstheminimumamountitcantosatisfyapendingrequest.B Lewis_complete_ans5/26/044:54PMPage682682AnswerstoExercisesForExercises16–20,matchthefileextensionswiththeappropriatefile.A.txtB.mp3,au,andwavC.gif,tiff,jpgD.docandwp3E.java,c,andcpp16.audiofileB17.imagefileC18.textdatafileA19.programsourcefileE20.wordprocessingfileDForExercises21–23,matchthesymbolwithitsuse.A./B.C...21.SymbolusedtoseparatethenamesinapathinaWindowsenviron-ment.B22.SymbolusedtoseparatethenamesinapathinaUnixenvironment.A23.Symbolusedtorepresenttheparentdirectoryinarelativepathname.CExercises24–57areproblemsorshortanswerquestions.24.Whatisafile?Afileisthesmallestamountofinformationthatcanbewrittentosecondarymemory.Itisanamedcollectionofdata,usedfororgan-izingsecondarymemory.25.Distinguishbetweenafileandadirectory.Afileisanamedcollectionofdata.Adirectoryisanamedcollectionoffiles. Lewis_complete_ans5/26/044:54PMPage683Chapter11Exercises68326.Distinguishbetweenafileandafilesystem.Afileisanamedcollectionofdata.Afilesystemistheoperatingsystem’slogicalviewofthefilesitmanages.27.Whyisafileagenericconceptandnotatechnicalone?Afileisjustanamedcollectionofbits(data)instorage.Becausetherearedifferentoperatingsystems,therearedifferenttechnicalviewsofafile.Becausewearetalkingfromtheuser’sview,nottheimplementa-tionview,theconceptisgeneric.28.Nameanddescribethetwobasicclassificationsoffiles.Textfiles:Filesthatcontaintext.EachbyteisanASCIIcharacteroreach2typesisaUnicodecharacter.Binaryfiles:Thebytesinabinaryfiledonotnecessarilycontainchar-acters.Thesefilesrequireaspecialinterpretation.29.Whyisthetermbinaryfileamisnomer?Allfilesultimatelyarejustacollectionofbits,sowhycallonefiletype“binary?”Inabinaryfile,thebitsarenotinterpretedattext.Abinaryfilewouldjustbeastreamofuninterpretedbitsunlessthereisaninterpretationprovided.Ifabinaryfileisprintedwithoutinterpreta-tion,itlookslikegarbage.30.Distinguishbetweenafiletypeandafileextension.Afiletypeisadescriptionoftheinformationcontainedinthefile.Afileextensionisapartofthefilenamethatfollowsadotandidentifiesthefiletype.31.Whatwouldhappenifyougivethename“myFile.jpg”toatextfile?Itdependsonwhatapplicationprogramyouusetoopenthefile.Ifyouuseaprogramthatexpectsanimagefile,youwouldgetanerror.Ifyouuseaprogramthatexpectsatextfile,therewouldbenoproblem.32.Howcananoperatingsystemmakeuseofthefiletypesthatitrecog-nizes?IfyouclickonafileonyourdesktopandtheOSrecognizesthefiletype,thentheappropriateapplicationprogramcanbecalledtoopenthefile.IfyouarewritingJavaprogramsusinganintegratedenviron-ment,thenthefilessavedintheIDEaretagged,andclickingonafileautomaticallyopensthefileintheIDE.33.Howdoesanoperatingsystemkeeptrackofsecondarymemory?TheOSmaintainsatableindicatingwhichblocksofmemoryarefree.TheOSalsomaintainsatableforeachdirectorythatcontainsinfor-mationaboutthefilesinthatdirectory. Lewis_complete_ans5/26/044:54PMPage684684AnswerstoExercises34.Whatdoesitmeantoopenandcloseafile?Operatingsystemskeepatableofcurrentlyopenfiles.Theopenoper-ationentersthefileintothistableandplacesthefilepointeratthebeginningofthefile.Thecloseoperationremovesthefilefromthetableofopenfiles.35.Whatdoesitmeantotruncateafile?Truncatingafilemeansthatalltheinformationonthefileiserasedbuttheadministrativeentriesremaininthefiletables.Occasionally,thetruncateoperationremovestheinformationfromthefilepointertotheend.36.Compareandcontrastsequentialanddirectfileaccess.Bothsequentialanddirectfileaccessfindandaccessarecord.Insequentialaccess,thefilepointerbeginsatthebeginningofthefileandcanonlymoveinonedirection.Thussequentialaccessislinear:Theonlyrecordthatcanbeaccessedisthefirstortheoneimmediatelyfollowingthelastoneaccessed.Indirectaccess,thefilepointercanbemovedtoanyspecificrecordandthedataaccessedfromthatplace.37.Fileaccessisindependentofanyphysicalmedium.a.Howcouldyouimplementsequentialaccessonadisk?Sequentialaccessalwaysaccessesthenextrecord.Youimplementsequentialaccessonadiskbynotgivingtheuseranaccesscommandthattakesarecordaddressasaparameter.b.Howcouldyouimplementdirectaccessonamagnetictape?Eachrecordonamagnetictapeisconceptuallynumberedfromthefirsttothelast.Keepacounterofwhichrecordwasreadlast.Whenausergivesanaccesscommandtoreadaspecificrecord,iftherecordnumberisbeyondthelastrecordread,thenrecordsarereadandskippeduntilthecorrectrecordisfound.Iftherecordnumbercomesbeforethelastrecordread,thetapeisrewoundandrecordsarereadandskippeduntilthecorrectrecordisfound.38.Whatisafileprotectionmechanism?Afileprotectionmechanismisonethatanoperatingsystemimple-mentsthatensuresthatonlyvaliduserscanaccessaparticularfile.39.HowdoesUniximplementfileprotection?Uniximplementsfileprotectionbyassociatingwitheachfilea3x3tableinwhichtherowsareOwner,Group,andWorld,andthecolumnsareRead,Write/Delete,andExecute.Thecontentsofeachcellinthetablearebooleanvaluesmeaningyesandno.Forexample,ayesinthecell(Owner,Execute)meansthattheownerofthefilecan Lewis_complete_ans5/26/044:54PMPage685Chapter11Exercises685executeit.Anointhecell(World,Write/Delete)meansthatpermis-siontowriteordeleteafileisnotgrantedtoanyonethatisnottheownerofthefileorwithinaspecifiedgroup.(Groupisalistofthoseconsideredpartofthegroup.)40.Giventhefollowingfilepermission,answerthesequestions.ReadWrite/DeleteExecuteOwnerYesYesYesGroupYesYesNoWorldYesNoNoa.Whocanreadthefile?Anyonecanreadthefile.b.Whocanwriteordeletethefile?Theownerandmembersofthegroupcanwriteordeletethefile.c.Whocanexecutethefile?Onlytheownercanexecutethefile.d.Whatdoyouknowaboutthecontentofthefile?Becausetheownerhaspermissiontoexecutethefile,itmustcontainanexecutableprogram.41.Whatistheminimumamountofinformationadirectorymustcontainabouteachfile?Adirectorymustcontainthefilename,thefiletype,theaddressondiskwherethefileisstored,thecurrentsizeofthefile,andpermissioninformation.42.Howdomostoperatingsystemsrepresentadirectory?Asafile.43.Answerthefollowingquestionsaboutdirectories.a.Adirectorythatcontainsanotherdirectoryiscalledwhat?parentdirectoryb.Adirectorycontainedwithinanotherdirectoryiscalledwhat?subdirectoryc.Thedirectorythatisnotcontainedinanyotherdirectoryiscalledwhat?rootdirectory Lewis_complete_ans5/26/044:54PMPage686686AnswerstoExercisesd.Thestructureshowingthenesteddirectoryorganizationiscalledwhat?directorytreee.RelatethestructureindtothebinarytreedatastructureexaminedinChapter9.Adirectorytreeandabinarytreearebothhierarchicalstructuresinwhichthereisonlyonewaytoreachanysubtree.Therootdirec-toryisequivalenttotherootofthebinarytree.Inabinarytree,eachnodecanhavenone,one,ortwochildnodes.Inadirectorytree,eachnodecanhaveanynumberofsubdirectories.44.Whatisthedirectorycalledinwhichyouareworkingatanyonemoment?workingdirectory45.Whatisapath?Apathisatextstringthatspecifiesthelocationofafileorsubdirec-tory.46.Distinguishbetweenanabsolutepathandarelativepath.Anabsolutepathisapaththatbeginsattherootdirectoryandincludesallsuccessivesubdirectories.Arelativepathisapaththatbeginsatthecurrentworkingdirectoryandincludesallsuccessivesubdirectories.47.ShowtheabsolutepathtoeachofthefollowingfilesordirectoriesusingthedirectorytreeshowninFigure11.4:a.QTEffects.qtxC:WINDOWSSystemQuickTimeQTEffects.qtxb.brooks.mp3C:MyDocumentsdownloadsbrooks.mp3c.ProgramFilesC:ProgramFilesd.3dMaze.scrC:WINDOWSSystem3dMaze.scre.Powerpnt.exeC:ProgramFilesMSOfficePowerpnt.exe48.ShowtheabsolutepathtoeachofthefollowingfilesordirectoriesusingthedirectorytreeshowninFigure11.5:a.tar/bin/tarb.access.old/etc/mail/access.old Lewis_complete_ans5/26/044:54PMPage687Chapter11Exercises687c.named.conf/etc/named.confd.smith/home/smithe.week3.txt/home/smith/reports/week1.txtf.printall/home/jones/utilities/printall49.AssumingthecurrentworkingdirectoryisC:WINDOWSSystem,givetherelativepathnametothefollowingfilesordirectoriesusingthedirectorytreeshowninFigure11.4:a.QTImage.qtxQuickTimeQTImage.qtxb.calc.exe..calc.exec.letters....MyDocumentslettersd.proj3.java....MyDocumentscsc101proj3.javae.adobep4.hlpadobep4.hlpf.WinWord.exe....ProgramFilesMSOfficeWinword.exe50.ShowtherelativepathtoeachofthefollowingfilesordirectoriesusingthedirectorytreeshowninFigure11.5.a.localtimewhenworkingdirectoryistherootdirectory/etc/localtimeb.localtimewhentheworkingdirectoryisetclocaltimec.printallwhentheworkingdirectoryisutilitiesprintalld.week1.txtwhentheworkingdirectoryisman2../reports/week1.txt51.Whatistheworstbottleneckinacomputersystem?Transferringdatatoandfromsecondarymemoryistheworstbottle-neck. Lewis_complete_ans5/26/044:54PMPage688688AnswerstoExercises52.Whyisdiskschedulingconcernedmorewithcylindersthanwithtracksandsectors?Seektime(thetimetofindtherightcylinder)ismoretimeconsumingthanlocatingwhichtrackorwhichsector,soseektimeisthetimetominimize.53.Nameanddescribethreediskschedulingalgorithms.First-come,first-serve(FCSC):Therequestsarehandledintheorderinwhichtheyaregenerated.Shortest-seek-time-first(SSTF):Therequestclosesttotheread/writeheadsishandlednext.SCAN:Theread/writeheadsmovebackandforthhandlingtheclosestinthedirectioninwhichtheyaremoving.UsethefollowinglistofcylinderrequestsinExercises54through57.Theyarelistedintheorderinwhichtheywerereceived.40,12,22,66,67,33,8054.ListtheorderinwhichtheserequestsarehandlediftheFCFSalgo-rithmisused.Assumethatthediskispositionedatcylinder50.40,12,22,66,67,33,8055.ListtheorderinwhichtheserequestsarehandlediftheSSTFalgo-rithmisused.Assumethatthediskispositionedatcylinder50.40,33,22,12,66,67,8056.ListtheorderinwhichtheserequestsarehandlediftheSCANalgo-rithmisused.Assumethatthediskispositionedatcylinder50andtheread/writeheadsaremovingtowardthehighercylindernumbers.66,67,80,40,33,22,1257.Explaintheconceptofstarvation.IntheSSTFalgorithm,itispossibleforsomerequestsnevertobeserv-icedbecauserequestsclosertotheread/writeheadskeepbeingissued.Chapter12ExercisesForExercises1–18,marktheanswerstrueandfalseasfollows:A.TrueB.False1.Acellinaspreadsheetcancontainonlyrawdata.B2.Thevaluesinaspreadsheetcanbeformattedinavarietyofways.A Lewis_complete_ans5/26/044:54PMPage689Chapter12Exercises6893.Aspreadsheetshouldbesetupsothatchangestothedataareauto-maticallyreflectedinanycellsaffectedbythatdata.A4.Aspreadsheetfunctionisaprogramthattheuserwritestocomputeavalue.B(theyarebuiltintothesoftware)5.Arangeofcellscanbespecifiedthatgohorizontallyorvertically,butnotboth.B6.Acircularreferenceinaspreadsheetisapowerfulandusefulsituation.B7.Aspreadsheetisusefulforperformingwhat-ifanalysis.A8.What-ifanalysiscanonlyaffectonevalueatatimeinaspreadsheet.B9.Adatabaseengineissoftwarethatsupportsaccesstothedatabasecontents.A10.Thephysicaldatabaserepresentsthelogicalstructureofthedatainthedatabase.B11.Aqueryisarequesttoadatabaseforinformation.A12.Theresultsofaquerycanbestructuredinmanyways.A13.Thehierarchicalmodelisthemostpopulardatabasemanagementmodeltoday.B14.Adatabasetableisacollectionofrecords,andarecordisacollectionoffields.A15.Thevaluesinthekeyfieldsofatableuniquelyidentifyarecordamongallotherrecordsinthetable.A16.Adatabaseengineofteninteractswithaparticularlanguageforaccessingandmodifyingthedatabase.A Lewis_complete_ans5/26/044:54PMPage690690AnswerstoExercises17.Anentity-relationship(ER)diagramrepresentsprimarydatabaseelementsinagraphicalform.A18.Thecardinalityofarelationshipputsrestrictionsonthenumberofrelationshipsthatcanexistatonetime.AForExercises19–23,matchthesolutiontothequestionusingthespread-sheetshown.A.dynamicB.functionC.circularD.rangeE.schemaF.field19.Aspreadsheetis____inthatitrespondstochangesinthedatabyimmediatelyupdatingallaffectedvalues.A20.Aspreadsheetformulamayoperateona____ofcells,suchasC4..C18.D21.Thedatabase____isthespecificationofthelogicalstructureofthedatainthedatabase.E22.A____referenceoccurswhentheresultofoneformulaisultimatelybasedonanother,andviceversa.C23.A____containsasingledatavalue.F Lewis_complete_ans5/26/044:54PMPage691Chapter12Exercises691Exercises24–62areproblemsorshortanswerquestions.UsethefollowingspreadsheetthatcontainsstudentgradesforExercises24–32.ABCDEFGH1Grades2Exam1Exam2Exam3Average34Bill89338067.33335Bob90507571.66666Chris66607065.33337Jim50757767.33338StudentsJudy808080809June8384858410Mari87899088.666611Mary99989095.666612Phil8990858813Sarah75908583.333314Suzy8690959015Total893839912881.33316Average81.181876.272782.909080.121224.SpecifythegradesforExam2.E4..E1425.SpecifytheaverageforExam1.D1526.SpecifytheaverageforSarah.G1327.SpecifythethirdexamgradeforMari.F1028.SpecifytheexamgradesforSusy.D14..F1429.WhatformulaisstoredinF15?SUM(F4..F14) Lewis_complete_ans5/26/044:54PMPage692692AnswerstoExercises30.D16containstheformulaD15/COUNT(D4..D14).Whatisanotherformulaforthesamevalue?AVERAGE(D4..D14)31.WhatformulaisstoredinE13?Thereisn’taformulastoredthere;itisasinglevalue.32.WhatvaluesinwhatcellswouldchangeifPhil’sExam2scorewascorrectedto87?F12,F15,F16,G12,G1533.Whatisaspreadsheetcircularreference?Whyisitaproblem?Acircularreferenceisoneinwhichtwoormoreformulasdependuponeachother.Forexample,F5mayuseD4initscalculation,andD4mayuseF5initscalculation.AcircularreferencemaybedirectasintheF5,D4exampleorindirectinvolvingmanydifferentformulas.Theproblemisthatthecalculationcannotbemadebecauseoftheinterdependenceofthereferences.34.GiveaspecificexampleofanindirectcircularreferencesimilartotheoneshowninFigure12.5.B1=SUM(A1..A5)*C2C2=SUM(B5..B12)B8=G1-D2D2=G3*B1B1dependsonC2;C2dependsonB8;B8dependsonD2;andD2dependsonB1.35.Whatiswhat-ifanalysis?Thevaluesrepresentingassumptionsinaspreadsheetcanbechangedandtheeffectsonrelateddatacanbeobserved.Thisvaryingofvaluesandtheobservationoftheresultsrepresentwhat-ifanalysis.Thatis,youcanaskwhathappensifyouchangecertainvaluesandseetheresults.36.Namesomewhat-ifanalysisquestionsthatyoumightaskifyouwereusingaspreadsheettoplanandtracksomestockpurchases.Explainhowyoumightsetupaspreadsheettohelpanswerthosequestions.WeareconsideringbuyingstockinfourFortuneFiveHundredcompanies.Whatwouldmygainbeifallfourofthestocksgained6%overayear?Whatwouldmygainbeiftwogained6%overayear,buttheothertwolost2%? Lewis_complete_ans5/26/044:54PMPage693Chapter12Exercises693Whatwouldmylossbeifallfourlost2%?Allofthesepercentagescouldbevariedandtheresultsexamined.ThespreadsheetcouldbesetupwiththestocknamesinB2..B5,theinitialpricesinC2..C5,thecalculatedpricesbasedonpercentagegainsorlossesperstockinD2..D5.C6couldcontaintheformulaforsummingC2..C5.D6couldcontaintheformulaforsummingD2..D5.E6couldcontaintheformulaforsubtractingC6fromD6tocalculatethegainorloss.ForQuestions37through40,usethepaperspreadsheetformsuppliedonthetextbook’swebsiteoruseanactualspreadsheetapplicationprogramtodesignthespreadsheets.Yourinstructormayprovidemorespecificinstruc-tionsregardingthesequestions.Theseareactivitiesforwhichtherearenospecificanswers.37.Designaspreadsheettotrackthestatisticsofyourfavoritemajorleaguebaseballteam.Includedataregardingruns,hits,errors,andruns-batted-in(RBIs).Computeappropriatestatisticsforindividualplayersandtheteamasawhole.38.Designaspreadsheettomaintainagradesheetforasetofstudents.Includetestsandprojects,givingvariousweightstoeachinthecalcu-lationofthefinalgradeforeachstudent.Computetheaveragegradepertestandprojectforthewholeclass.39.Assumeyouaregoingonabusinesstrip.Designaspreadsheettokeeptrackofyourexpensesandcreateasummaryofyourtotals.Includevariousaspectsoftravelsuchascarmileage,flightcosts,hotelcosts,andmiscellaneous(suchastaxisandtips).40.Designaspreadsheettoestimateandthenkeeptrackofaparticularproject’sactivities.Listtheactivities,theestimatedandactualdatesforthoseactivities,andscheduleslippageorgain.Addotherdataasappropriateforyourproject.41.Compareadatabasewithadatabasemanagementsystem.Adatabaseisastructuredsetofdata.Adatabasemanagementsystemisasoftwaresystemmadeupofthedatabase,adatabaseengine(formanipulatingthedatabase),andadatabaseschemathatprovidesthelogicalviewofthedatabase.42.Whatisadatabaseschema?Adatabaseschemaisthespecificationofthelogicalstructureofadatabase. Lewis_complete_ans5/26/044:54PMPage694694AnswerstoExercises43.Describethegeneralorganizationofarelationaldatabase.Arelationaldatabaseisorganizedaroundtheconceptofatable.Bothdataandrelationshipsarerepresentedintables.44.Whatisafield(attribute)inadatabase?Afieldisasinglevalueinadatabaserecord.Afieldrepresentsoneaspectorattributeoftheiteminadatabase.45.Whatotherfields(attributes)mightweincludeinthedatabasetableofFigure12.7?TherearefourfieldsinthetableinFigure12.7thatdescribeamovie:MovieID,Title,Genre,andRating.AdditionalitemsmightbeDirector,MaleLead,FemaleLead,Producer,andDate.46.Whatotherfields(attributes)mightweincludeinthedatabasetableofFigure12.8?TherearefourfieldsinthetableinFigure12.8thatdescribeacustomer:CustomerID,Name,Address,andCreditCardNumber.AdditionalitemsmightbePhoneNumber,HighestRatingAcceptable,andMaxMovies.47.Whatisakeyinarelationaldatabasetable?Inarelationaldatabase,everyrecordinatablemustbeuniquelyiden-tified.Thefieldorcombinationoffieldsthatareusedtouniquelyidentifyrecordsinatableiscalledthekeyfield.48.SpecifytheschemaforthedatabasetableofFigure12.8.Customer(CustomerId,Name,Address,CreditCardNumber)49.Howarerelationshipsrepresentedinarelationaldatabase?Inatable,ofcourse!Atableiscreatedthatrepresentstherelation-ship.Usually,thekeysofbothitemsintherelationshipsarerepre-sentedasfieldsintherelationshiptable,alongwithappropriateinformationabouttherelationship.50.DefineanSQLquerythatreturnsallattributesofallrecordsintheCustomertable.select*fromCustomer51.DefineanSQLquerythatreturnsthemovieidnumberandtitleofallmoviesthathaveanRrating.selectMovieId,TitlefromMoviewhereRating=‘R’ Lewis_complete_ans5/26/044:54PMPage695Chapter12Exercises69552.DefineanSQLquerythatreturnstheaddressofeverycustomerintheCustomertablethatlivesonLoisLane.selectAddressfromCustomerwhereAddresslike‘%LoisLane%’53.DefineanSQLstatementthatinsertsthemovieArmageddonintotheMovietable.insertintoMovievalues(1433,Armageddon,actionsci-fi,R)54.DefineanSQLstatementthatchangestheaddressofAmyStevensintheCustomertable.updateCustomersetAddress=‘333SilverWay’whereName=‘AmyStevens’55.DefineanSQLstatementthatdeletesthecustomerwithacustomeridof103.deletefromCustomerwhereCustomerId=10356.WhatisanERdiagram?AnERdiagramisagraphicalrepresentationofanentity-relationshipmodel,whichisatechniquefordesigningrelationaldatabases.57.HowareentitiesandrelationshipsrepresentedinanERdiagram?InanERdiagram,tablesarerepresentedbyrectangles,anddiamondsrepresentrelationships.58.HowareattributesrepresentedinanERdiagram?Attributesarerepresentedinovalswithlinesconnectingthemtotheentitytheydescribe.59.WhatarecardinalityconstraintsandhowaretheyshowninERdiagrams?CardinalityconstraintsarethenumberofrelationshipsthatcanexistbetweenentitiesinanERdiagram.Theyarerepresentedbythenumber1andtheletterM(forMany).Thesevaluesarewrittenonthelineconnectingthetableandtherelationship.60.Whatarethethreegeneralcardinalityconstraints?Onetoone,onetomany,andmanytomany. Lewis_complete_ans5/26/044:54PMPage696696AnswerstoExercises61.Designadatabasethatstoresdataaboutthebooksinalibrary,thestudentsthatusethem,andtheabilitytocheckoutbooksforaperiodoftime.CreateanERdiagramandsampletables.NameTitle1MStudentsChecksOutBooksPhoneNoIdNumIdNumAuthorStudentsIdNumNamePhoneNo223456789SallySilent232-4432432543654LottieLoud343-3321898978675MaudMiddle454-3452BooksIdNumAuthorTitle443233BrownFlyFishingintheSahara567622SmithDustStormsintheAmazonBasin657687AndersonSkatingonThinIceChecksOutIdNumAuthorDateDue443233Brown10/23/2004567622Smith10/30/2004657687Anderson11/1/2004 Lewis_complete_ans5/26/044:54PMPage697Chapter12Exercises69762.Designadatabasethatstoresdataaboutthecoursestaughtatauniversity,theprofessorsthatteachthosecourses,andthestudentsthattakethosecourses.CreateanERdiagramandsampletables.NameTitle1MStudentsTakesClassesPhoneNoIdNumIdNumNameTitle1MFacultyTeachesClassesPhoneNoIdNumIdNum Lewis_complete_ans5/26/044:54PMPage698698AnswerstoExercisesStudentsIdNumNamePhoneNo223456789SallySilent232-4432432543654LottieLoud343-3321898978675MaudMiddle454-3452FacultyIdNumNamePhoneNo344567777AbbyAbsent632-4432222222222StevenStern373-3321434343434MaryModern453-3452CoursesIdNumTitleCS304IntroductiontoCSCS328AbstractDataTypesCS375CompilerDesignChapter13ExercisesForExercises1–5,matchthetypeofambiguitywithanexample.A.LexicalB.ReferentialC.Syntactic1.“Standupforyourflag.”A.Does“standup”meansupportorrisetoyourfeet?2.“Godownthestreetontheleft.”C.Doesthismeantogoleftdownthestreetorgodownthestreetthatisontheleft?3.“Hedrovethecaroverthelawnmower,butitwasn’thurt.”B.Whatwasn’thurt,thecarorthelawnmower? Lewis_complete_ans5/26/044:54PMPage699Chapter13Exercises6994.“IsawthemovieflyingtoHouston.”C5.“MaryandKaywereplayinguntilshecameinside.”BForExercises6–21,marktheanswerstrueandfalseasfollows:A.TrueB.False6.Acomputerdoessometasksmuchbetterthanahumanbeing.A7.Ahumanbeingdoessometasksmuchbetterthanacomputer.A8.AcomputersystemthatcanpasstheTuringtestisconsideredtobeintelligent.A9.SomeAIresearchersdon’tthinkwecanachievetrueartificialintelli-genceuntilacomputerprocessesinformationinthesamewaythehumanminddoes.A10.Asemanticnetworkisusedtomodelrelationships.A11.Ifinformationisstoredinasemanticnetwork,itiseasytoanswerquestionsaboutit.B(itdependsonhowthenetworkisstructured)12.Acomputerhasneverbeatenahumanatchessinmaster-levelplay.B13.Aninferenceengineispartofarule-basedexpertsystem.A14.Abiologicalneuronacceptsasingleinputsignalandproducesmultipleoutputsignals.B15.Eachelementinanartificialneuralnetisaffectedbyanumericweight.A16.Voicesynthesisisthemostdifficultpartofnaturallanguageprocessing.B Lewis_complete_ans5/26/044:54PMPage700700AnswerstoExercises17.Eachhumanhasauniquevoiceprintthatcanbeusedtotrainvoicerecognitionsystems.A18.Theword“light”canbeinterpretedinmanywaysbyacomputer.A19.Syntacticambiguityisnolongeraproblemfornaturallanguagecomprehension.B20.ArobotmayfollowtheSense-Plan-Actapproachtocontrolitsmove-ments.A21.IsaacAsimovcreatedthreefundamentallawsofrobotics.AForExercises22–30,matchthetaskwithwhich(humanorcomputer)cansolveitmoreeasily.A.ComputerB.Human22.Identifyadoginapicture.B23.Addacolumnof100four-digitnumbers.A24.Interpretapoem.B25.Matchafingerprint.A26.Paintalandscape.B27.Carryonanintelligentconversation.B28.Learntospeak.B29.Judgeguiltorinnocence.A30.Giveaffection.A Lewis_complete_ans5/26/044:54PMPage701Chapter13Exercises701Exercises31–76areproblemsorshortanswerquestions.31.WhatistheTuringTest?TheTuringTestisatestdevisedbyAlanTuringtoanswertheques-tion“Howcanweknowwe’vesucceededincreatingamachinethatcanthink?”Thetestisbasedonwhetheracomputercouldfoolahumanintobelievingthatthecomputerisanotherhumanbeing.32.HowistheTuringTestorganizedandadministered?Ahumaninterrogatorsitsinaroomandusesacomputerterminaltocommunicatewithtworespondents.Theinterrogatorknowsthatonerespondentishumanandtheotherisacomputer.Afterconversingwithboththehumanandthecomputer,theinterrogatormustdecidewhichrespondentisthecomputer.Ifthecomputercouldfoolenoughinterrogators,thenitmustbeconsideredintelligent.33.WhatisweakequivalenceandhowdoesitapplytotheTuringTest?Weakequivalenceistheequalityoftwosystemsbasedontheirresults.TheTuringTestshowsweakequivalence.34.Whatisstrongequivalence?Strongequivalenceisthequalityoftwosystemsbasedontheirresultsandtheprocessbywhichtheyarriveatthoseresults.35.WhatistheLoebnerPrize?LoebnerPrizeisthefirstformalinstantiationoftheTuringTest.Ithasbeenheldannuallysince1991.36.NameandbrieflydescribefiveissuesintheworldofAIcoveredinthischapter.Knowledgerepresentation:Thetechniquesusedtorepresentknowl-edgesothatacomputersystemcanuseitinproblemsolving.Expertsystems:Computersystemsthatembodytheknowledgeofhumanexperts.Neuralnetworks:Computersystemsthatmimictheprocessingofthehumanbrain.Naturallanguageprocessing:Computersystemsthatprocessthelanguagethathumansusetocommunicate.Robotics:ThestudyofmobilerobotsthatuseAItechniquestointeractwiththeirenvironments.37.Nameanddefinetwoknowledgerepresentationtechniques.Semanticnetworks:Atechniquethatrepresentstherelationshipsamongobjects. Lewis_complete_ans5/26/044:54PMPage702702AnswerstoExercisesSearchtrees:Astructurethatrepresentsalternativesinadversarialsituationssuchasgames.38.WhatdatastructuredefinedinChapter9isusedtorepresentasemanticnetwork?Agraphisusedtorepresentasemanticnetwork.Thenodesinthegraphrepresentobjectsandthearrows(arcs)representrelationships.39.Createasemanticnetworkfortherelationshipsamongyourfamilymembers.Listfivequestionsthatyoursemanticnetcouldeasilybeusedtoanswerandfivequestionsthatwouldbemoreofachallengetoanswer.3MaleagegenderJustinhaschildhaschildParentinstancinstanceofeofJohnSharonderhasgendergenchildschildhaMaleFemaleKaylagenageder1FemaleEasyquestionstoanswergiventhisorganization:WhoareJohn’schildren?WhatisthegenderofKayla?HowoldareSharon’schildren? Lewis_complete_ans5/26/044:54PMPage703Chapter13Exercises703HowmanyfemalechildrendoesJohnhave?DoesSharonhaveanychildrenolderthan5yearsofage?Morechallengingquestionstoanswergiventhisorganization:WhoareKayla’sparents?WhoareJustin’ssiblings?Howmanyfemalechildrenarethere?WhoisthemotherofJohn’schildren?DoesJohnhaveanystep-children?40.Createasemanticnetworkthatcapturestheinformationinasmallsectionofanewspaperarticle.Thisisanactivityforwhichnoanswerisappropriate.41.Whatobject-orientedpropertiesdosemanticnetworksborrow?Semanticnetworksborrowinheritanceandinstantiation.Theinheri-tanceisexpressedinthe“is-a”relationship,andinstantiationisexpressedwhenanobjectisrelatedtosomethingthatdescribesit.42.Whatisasearchtree?Asearchtreeisastructurethatrepresentsallpossiblemovesforbothplayersinatwo-persongame.43.Whyaretreesforcomplexgameslikechesssolarge?Asearchtreecontainsallpossiblemovesfromthefirstposition,allpossiblemovesfromeachofthemovesfromthefirstposition,....,allpossiblemovesfromallpossiblemovesatthelevelabove.Thusthetreesareverylargeforcomplexgameslikechess.44.Distinguishbetweendepth-firstsearchingandbreadth-firstsearching.Depth-firstsearchingbeginsatthetoplevel(root)andcontinuesgoingdeeperanddeeperintothetreeuntilthesearchhasreachedaleafnode,atwhichtimethesearchmovesbackuponelevelandstartsdownagain.Abreadth-firstsearchbeginsatthetoplevel,thensearcheseverynodeonthenextlowerlevel,thensearcheseverynodeatthenextlowerlevel,untilithassearchedeverynodeoneverylevel.45.Whatdoesitmeantopruneatree?Pruningatreemeanstoeliminatesomebranchesfromsearching.46.Distinguishbetweenknowledge-basedsystemsandexpertsystems.Aknowledge-basedsystemisasoftwaresystemthatusesaspecificsetofinformationfromwhichitextractsandprocessesparticularpieces.Anexpertsystemissometimesusedasasynonym,butitcanalso Lewis_complete_ans5/26/044:54PMPage704704AnswerstoExercisescarrywithittheideaofmodelingtheexpertiseofaprofessionalinthatparticularfield.47.Distinguishbetweenrule-basedsystemsandinferenceengines.Arule-basedsystemisasoftwaresystemthatusesasetofrulestoguideitsprocessing.Aninferenceengineisthesoftwaresystemthatprocessestherules.48.Whatisanexampleofahumanexpertsystem?Adoctorisanexampleofahumanexpertsystem.Thedoctorasksquestionsandrunstestsbasedonhisknowledgeandexperience.49.Whatdowecallaknowledge-basedsystemthatmodelstheexpertiseofprofessionalsinthefield?Anexpertsystem.50.Whyisanexpertsystemcalledarule-basedsystem?Anexpertsystemiscalledarule-basedsystembecauseitusesasetofrulestoguideitsprocessing.51.Whatisthepartofthesoftwareinanexpertsystemthatdetermineshowtherulesarefollowedandwhatconclusionscanbedrawn?Aninferenceengine.52.Howaretherulesexpressedinanexpertsystem?Therulesareexpressedasselectionstatements(ifstatements).53.Whataretheadvantagesofanexpertsystem?Anexpertsystemisgoal-oriented;itdoesn’tfocusonabstractortheo-reticalinformation.Itisefficient;itrecordspreviousresponsesanddoesn’taskirrelevantquestions.Anexpertsystemcanprovideusefulguidanceevenifitcan’tprovidetheanswertoaspecificquestion.54.Whatisasinglecellthatconductsachemically-basedelectronicsignal?Aneuron55.Whatdoaseriesofconnectedneuronsform?Apathwayinthebrain56.Uponwhatdoesthesignalalongaparticularpathwaydepend?Thesignalsdependonthestateoftheneuronsthroughwhichthesignalpasses.57.Whatarethemultipleinputtentaclesinabiologicalneuron?Dentrites58.Whatistheprimaryoutputtentacleinabiologicalneuron?Anaxon Lewis_complete_ans5/26/044:54PMPage705Chapter13Exercises70559.Fromwheredodendritesofoneneuronpickupthesignalsfromotherneuronstoformanetwork?Thedendritesofoneneuronpickupthesignalsfromtheaxonsofotherneuronstoformaneuralnetwork.60.Whatisthegapbetweenanaxonandadendrite?Asynapse.61.Whattempersthestrengthofasynapse?Thechemicalcompositionofasynapsetempersthestrengthofitsinputsignal.62.Whatistheroleofasynapse?Theroleofasynapseistoweightheinputsignal.63.Howisasynapsemodeledinanartificialneuralnetwork?Asynapseisrepresentedbyaweightassignedtoeachinputsignal.64.Whatisaneffectiveweightinanartificialneuron?Aneffectiveweightisthesumoftheweightsmultipliedbythecorre-spondinginputvalues.65.Howistheoutputvaluefromanartificialneuroncalculated?Eachneuronhasanumericthresholdvalue.Iftheeffectiveweightisgreaterthanthethreshold,a1isoutput;otherwise,a0isoutput.66.Iftheprocessingelementinanartificialneuralnetacceptedfiveinputsignalswithvaluesof0,0,1,1,and0andcorrespondingweightsof5,-2,3,3,and6,whatistheoutputifthethresholdis5?167.Iftheprocessingelementinanartificialneuralnetacceptedfiveinputsignalswithvaluesof0,0,1,1,and0andcorrespondingweightsof5,-2,3,3,and6,whatistheoutputifthethresholdis7?068.Whatisaphoneme?Aphonemeisafundamentalsoundinalanguage.69.Describethetwodistinctwaysthatvoicesynthesiscanbeaccom-plished.Indynamicvoicegeneration,thesetofphonemesforalanguagearegenerated.Acomputerexaminesthelettersthatmakeupawordandproducethesequenceofsoundsusingthelanguage’sphonemes.Inrecordedspeech,humanspeechisrecorded.Acomputerchoosesthecorrectwordfromitsfileofrecordedwords. Lewis_complete_ans5/26/044:54PMPage706706AnswerstoExercisesDynamicvoicegenerationcanmakeanattempttopronounceanyword,butrecordedspeechcanonlypronouncewordsthathavebeenprerecorded.70.Whatissuesaffecttheabilitytorecognizethewordsspokenbyahumanvoice?Accents,regionaldialects,voicepitch,homonyms,andtheclarityofaperson’sspeech.71.Howcanavoicerecognitionsystembetrained?Avoiceprintisaplotoffrequencychangesovertimerepresentingthesoundofahuman’sspeech.Totrainavoicerecognitionsystem,apersonsaysthesamewordseveraltimesandthecomputerrecordsanaveragevoiceprintfortheword.72.Whyarepersonalizedvoicerecognitionsystemssomuchbetterthanthosethatarenotspecifictooneperson?Generalizedsystemshavetousegenericvoiceprints,butpersonalizedsystemscanusevoiceprintsspecifictotheuser.73.Nameanddescribetwocategoriesofrobots.Fixedrobots:Robotsthatremaininoneplacetoaccomplishtheirtask.Mobilerobots:Robotsthatmovearound,thushavingtointeractwiththeirenvironment.74.Whatareplanningsystems?Planningsystemsarelargesoftwaresystemsthat,givenagoal,astartingposition,andanendingsituation,generateanalgorithmforasolution.75.Whatdefinessubsumptionarchitecture?Behaviorsruninparallelunlesstheycomeintoconflict,atwhichtimetheorderingofgoalsdeterminewhichbehaviortakesprecedence.76.Ofwhatisarobotcomposed?Arobotiscomposedofsensors,actuators,andcomputationalelements.Thesensorstakeindataabouttheoutsideworld,theactua-torsmovetherobot,andthecomputationalelementssendinstructionstotheactuators. Lewis_complete_ans5/26/044:54PMPage707Chapter14Exercises707Chapter14ExercisesForExercises1–8,matchthekindofsimulationwiththeexample.A.ContinuoussimulationB.Discreteeventsimulation1.WeatherforecastingA2.StockportfoliomodelingB3.SeismicexplorationA4.HurricanetrackingA5.PredictingnumberoftellersanewbankneedsB6.Determiningthenumberofwaitingroomsnecessaryforadoctor’sofficeB7.GasexplorationA8.Air-chemistrymodelsAForExercises9–20,marktheanswerstrueandfalseasfollows:A.TrueB.False9.Simplesystemsarebestsuitedtobeingsimulated.B10.Complexsystemsaredynamic,interactive,andcomplicated.A11.Amodelisanabstractionofarealsystem.A12.Therepresentationofamodelmaybeconcreteorabstract.A13.Incomputersimulations,themodelsareconcrete.B Lewis_complete_ans5/26/044:54PMPage708708AnswerstoExercises14.Themorecharacteristicsorfeaturesrepresentedinthemodelthebetter.B15.Continuoussimulationsarerepresentedbyentities,attributes,andevents.B16.Changesindiscreteeventsimulationsarerepresentedbypartialdiffer-entialequations.B17.CADstandsforcomputer-aideddrafting.B18.Atime-drivensimulationcanbethoughtofasabigloopthatexecutesasetofrulesforeachvalueoftheclock.A19.Amodelwhoserealizationiswithinacomputerprogramisanabstractmodel.A20.Aconcretemodelcanberealizedwithinacomputerprogram.BExercises21–49areproblemsorshortanswerquestions.21.Definesimulationandgivefiveexamplesfromeverydaylife.Simulationisthedevelopmentofamodelofacomplexsystemandtheexperimentationwiththemodeltoobservetheresults.TVweatherforecastersusecomputermodelstopredicttheweather.Pilotsspendtimeinaflightsimulatorbeforeactuallyflyinganaircraft.Engineersusewindtunnelstotestoutanewdesign.Automotiveengineersusesimulatedcrashteststoseehowcarssurviveatdifferentspeeds.Dummiesareusedincrashteststoseehowtheysurvive.Achefexper-imentswithanewrecipetoseewhichcombinationofingredientsisbest.22.Whatistheessenceofconstructingamodel?Theessenceofconstructingamodelistoidentifyasmallsubsetofcharacteristicsorfeaturesthataresufficienttodescribethebehaviortobeinvestigated.23.Nametwotypesofsimulationsanddistinguishbetweenthem.Continuoussimulationtreatstimeascontinuousandexpresseschangesintermsofasetofdifferentialequationsthatreflecttherela- Lewis_complete_ans5/26/044:54PMPage709Chapter14Exercises709tionshipsamongthesetofcharacteristics.Discreteeventsimulationismadeupofentities,attributes,andevents,whereentitiesrepresentobjectsintherealsystem,attributesarecharacteristicsofaparticularentity,andeventsareinteractionsamongentities.24.Whatarethekeystoconstructingagoodmodel?Thekeystoconstructingagoodmodelarecorrectlychoosingtheenti-tiestorepresentthesystemandcorrectlydeterminingtherulesthatdefinetheresultsoftheevents.25.Whatdefinestheinteractionsamongentitiesinadiscreteeventsimu-lation?Asetofrulesthatarepartofthemodeldeterminetheinteractionsamongtheevents.26.Whatistherelationshipbetweenobject-orienteddesignandmodelbuilding?Abstractmodelsareimplementedinacomputerprogram,soobject-orienteddesigntechniquescanbeusedtobuildthemodel.27.Definethegoalofaqueuingsystem.Thegoalofaqueuingsystemistodeterminehowtominimizewaittime.28.Whatarethefournecessarypiecesofinformationneededtobuildaqueuingsystem?Thefournecessarystepsare•thenumberofeventsandhowtheyaffectthesystem(todeterminetherulesofentityinteraction)•thenumberofservers(entities)•thedistributionofarrivaltimes(todetermineifanentityentersthesystem)•theexpectedservicetime(todeterminethedurationofanevent)29.Whatpartdoesarandomnumbergeneratorplayinqueuingsimula-tions?Therandomnumbergeneratorisusedtorepresentluck.Ifaneventhappenseveryxminutes,arandomnumbergeneratorisusedtodeter-mineiftheeventhappensateachminute.30.Writetherulesforaqueuingsimulationofaone-pumpgasstation,whereacararrivesevery3minutesandtheservicetimeis4minutes.Ifacararrives,itgetsinline.Acararrivesiftherandomnumberisbetween0.0and0.33. Lewis_complete_ans5/26/044:54PMPage710710AnswerstoExercisesIfthepumpisfreeandthereisacarwaiting,thefirstcarinlineleavesthelineandgoestothepumpandtheservicetimeissetto4.Ifacarisatthepump,thetimeremainingforthecarisdecremented.Iftherearecarsinline,theadditionalminutesthattheyhavebeenwaitingarerecorded.31.DoyouthinkthegasstationinExercise30willbeinbusinessverylong?Explain.No.Theservicetimeisgreaterthanthearrivalprobability.32.RewritethesimulationinExercise30suchthatacararrivesevery2minutesandtheservicetimeis2minutes.Ifacararrives,itgetsinline.Acararrivesiftherandomnumberisbetween0.0and0.5.Ifthepumpisfreeandthereisacarwaiting,thefirstcarinlineleavesthelineandgoestothepumpandtheservicetimeissetto2.Ifacarisatthepump,thetimeremainingforthecarisdecremented.Iftherearecarsinline,theadditionalminutesthattheyhavebeenwaitingarerecorded.33.Writetherulesforaqueuingsystemforanairlinereservationcounter.Thereisonequeueandtworeservationclerks.Peoplearriveevery3minutesandtake3minutestobeprocessed.Ifacustomerarrives,heorshegetsinline.Acustomerarrivesiftherandomnumberisbetween0.0and0.33.Ifaclerkisfreeandthereisapersonwaiting,thefirstpersoninlineleavesthelineandgoestothefreeclerkandtheservicetimeissetto3.Ifacustomeriswiththeclerk,thetimeremainingforthecustomerisdecremented.Iftherearecustomersinline,theadditionalminutesthattheyhavebeenwaitingarerecorded.34.DistinguishbetweenaFIFOqueueandapriorityqueue.DequeinaFIFOqueuereturnstheentitythathasbeeninthequeuethelongesttime.Dequeinapriorityqueuereturnstheentitywiththehighestpriority.35.WhatdidSIMULAcontributetoobject-orientedprogrammingmethodology?SIMULAintroducedtheconceptsofclassesandobjects,inheritance,andpolymorphism. Lewis_complete_ans5/26/044:54PMPage711Chapter14Exercises71136.Ingeneral,meteorologicalmodelsarebasedonthetime-dependentequationsofwhatfields?Meteorologicalmodelsarebasedontime-dependentequationsfromfluidmechanicsandthermodynamics.37.Howmuchmathematicsisnecessarytobeameteorologist?Fivecollegecoursesinthecalculussequenceplusacourseortwoinnumericalmethodsshouldprovidethebackgroundtounderstandthemathematicsinvolvedinthesemodels.38.Whyistheremorethanoneweatherpredictionmodel?Differentmodelsexistbecausedifferentassumptionsarepossible.39.Whydodifferentmeteorologistsgivedifferentforecastsiftheyareusingthesamemodels?Meteorologistsmayormaynotagreewiththepredictionsfromaparticularmodel.Also,variousmodelsgiveconflictinginformation.Thusthemeteorologistmustusetheirjudgmentastowhich,ifany,modeliscorrect.40.Whatarespecializedmeteorologicalmodelsandhowaretheused?Specializedmeteorologicalmodelsareadaptationsforspecializedresearchpurposes.Ameteorologicalmodelmaybecombinedwithair-chemistrymodelstodiagnoseatmospherictransportanddiffusionforavarietyofair-qualityapplications.Specializedmeteorologicalmodelsareusefulinthemilitaryandaviationindustries.41.Whatareseismicmodelsusedfor?Seismicmodelsdepictthepropagationofseismicwavesthroughtheearth’smedium.Theyareusedforoilandmineralexploration.42.Whatare2-dimensionalCADmodelsusedfor?Two-dimensionalCADmodelsareusedaselectronicdrawingboards.43.Whatare3-dimensionalCADmodelsusedfor?Three-dimensionalCADmodelsareusedforgeometricmodeling;thatis,three-dimensionalobjects.Theycanbeusedformodelinganythingfromcarstohouses.44.Whatarethe3methodsofmodelinginthreedimensionsandhowdoyoudeterminewhichmethodshouldbeusedwhere?Thethreetypesofthree-dimensionalmodelsarewireframe,inwhichobjectsarerepresentedbylineelements;surfacemodeling,inwhichtheoutsideofanobjectismodeled;andsolidmodeling,inwhichboththeinteriorandexteriorofanobjectaremodeled.Theintendedpurposeoftheimagedictatestheappropriatemodel. Lewis_complete_ans5/26/044:54PMPage712712AnswerstoExercises45.Distinguishbetweenanembeddedsystemandaregularcomputingsystem.Embeddedsystemsarecomputersthatarededicatedtoperformanarrowrangeoffunctionsaspartofalargersystem.Thereisonlyminimalend-useroroperatorintervention,ifanyatall.46.Embeddedsystems’programmersarethelastholdoutforassemblylanguageprogramming.Explain.Inembeddedsystems,thesizeofthecodeandthespeedofexecutionareveryimportant.Assembly-languageprogramsprovidethebestopportunityforaprogrammertostreamlineandspeedupthecode.47.Arandomnumbergeneratorcanbeusedtovaryservicetimesaswellasdeterminearrivals.Forexample,assumethat20%ofthecustomerstake8minutesand80%ofthecustomerstake3minutes.Howmightyouusearandomnumbergeneratortoreflectthisdistribution?Generatearandomnumberforeachcustomer.Ifthenumberisbetween0and.20,thecustomertakes8minutes;otherwisethecustomertakes3minutes.48.Whydowesaythatsimulationdoesn’tgiveananswer?Simulationisatoolthatallowsyoutoinvestigate“whatif”questions.Youcantrydifferentvaluesfortheparametersofthesimulationandseewhathappenstothewaittime.49.Whatdosimulationsandspreadsheetprogramshaveincommon?Simulationsandspreadsheetprogramsbothexamine“whatif”ques-tions.Chapter15ExercisesForExercises1–6,matchthewordoracronymwiththedefinitionortheappropriateblank.A.LANB.WANC.GatewayD.BustopologyE.EthernetF.Internet1.TheInternetisa_________.B2.TheindustrystandardforLANs.E Lewis_complete_ans5/26/044:54PMPage713Chapter15Exercises7133.AnodethathandlescommunicationbetweenitsLANandothernetworks.C4.Anetworkthatconnectsothernetworks.B5.Startechnologyisa______configuration.A6.Ethernetuses__________.DForExercises7–15,matchthewordoracronymwiththedefinitionortheappropriateblank.A.DLSB.TCP/IPC.UDPD.IPE.TCPF.Broadband7._________andvoicecommunicationcanusethesamephoneline.A8.DLSandcablemodemsare_________connections.F9.AnInternetconnectionmadeusingadigitalsignalonregularphonelines.A10.Networktechnologiesthatgenerallyprovidedatatransferspeedsgreaterthan128Kbps.F11.Thenetworkprotocolthatbreaksmessagesintopackets,reassemblesthematthedestination,andtakescareoferrors.E12.Thesuiteofprotocolsandprogramsthatsupportlow-levelnetworkcommunication.B13.AnalternativetoTCPthatachieveshighertransmissionspeeds.C14.Softwarethatdealswiththeroutingofpackets.D Lewis_complete_ans5/26/044:54PMPage714714AnswerstoExercises15._________hasmorereliabilitythanUDP.EForExercises15–20,matchtheprotocolorstandardwithwhatitspecifiesordefines.A.SMTPB.FTPC.TelnetD.HTTPE.MIMEtype16.Transferofelectronicmail.A17.Logintoaremotecomputersystem.C18.Transferfilestoandfromanothercomputer.B19.Formatofemailattachments.E20.ExchangeofWorldWideWebdocuments.DForExercises21–25,marktheanswerstrueandfalseasfollows:A.TrueB.False21.Aportisanumericdesignationthatcorrespondstoaparticularhigh-levelprotocol.A22.Afirewallprotectsalocalareanetworkfromphysicaldamage.B(itprotectsitfrominappropriateaccess)23.Eachcompanycanestablishitsownaccesscontrolpolicy.A24.Sometop-leveldomainsarebasedonthecountryinwhichtheregis-teringorganizationisbased.A25.Twoorganizationscannothavethesamenameforacomputer.B Lewis_complete_ans5/26/044:54PMPage715Chapter15Exercises715Exercises26–63areproblemsorshortanswerquestions.26.Whatisacomputernetwork?Acomputernetworkisacollectionofcomputingdevicesconnectedsothattheycancommunicateandshareresources.27.Howarecomputersconnectedtogether?Thecomputersinanetworkcanbephysicallyconnectedbywiresorcablesorlogicallyconnectedbyradiowavesorinfraredsignals.28.Towhatdoesthewordnode(host)refer?Anodeorhostisanyaddressabledeviceattachedtoanetwork.29.Nameanddescribetwokeyissuesrelatedtocomputernetworks.Datatransferrate:ThespeedwithwhichdataismovedacrossthenetworkProtocol:Thesetofrulesthatdefinehowdataisformattedandprocessedacrossanetwork30.Whatisasynonymfordatatransferrate?Bandwidth31.Describetheclient/servermodelanddiscusshowhasithaschangedhowwethinkaboutcomputing.Theclient/serverisamodelinwhichresourcesarespreadacrosstheWeb.Theclientmakesarequestforinformationoranactionfromaserverandtheserverresponds.Forexample,afileserver,acomputerdedicatedtostoringandmanagingfilesfornetworkusers,respondstorequestsforfiles.Awebserver,acomputerdedicatedtorespondingtorequestsforwebpages,producestherequestedpage.Beforetheclient/servermodelwasdeveloped,auserthoughtofcomputingwithintheboundariesofthecomputerinfrontofhimorher.Nowthefunctionsthatwereprovidedwithinonecomputeraredistributedacrossanetwork,withseparatecomputersinchargeofdifferentfunc-tions.32.Justhowlocalisalocal-areanetwork?Alocal-areanetworkconnectsarelativelysmallnumberofmachinesinarelativelyclosegeographicalarea,usuallywithinthesameroomorbuilding,butoccasionallyaLANspansafewclosebuildings.33.DistinguishbetweenthefollowingLANtopologies:ring,star,andbus.Aringtopologyisoneinwhichthenodesareconnectedinaclosedloop.Astartopologyisoneinwhichthenodesareallconnectedtoacentralnode.Abustopologyisoneinwhichthenodesshareacommonline. Lewis_complete_ans5/26/044:54PMPage716716AnswerstoExercises34.HowdoestheshapeofthetopologyinfluencemessageflowthroughaLAN?Inaringtopology,messagesflowinonlyonedirectionaroundtheLAN.Inastartopology,messagesflowthroughthecentralnode.Inabustopology,messagesflowinbothdirectionsalongthebus.35.WhatisaMANandwhatmakesitdifferentfromaLANandaWAN?AMANisametropolitan-areanetwork.ItisanetworkwithsomeofthefeaturesofbothaLANandaWAN.Largemetropolitanareashavespecialneedsbecauseofthevolumeoftraffic.MANsarecollec-tionsofsmallernetworksbutareimplementedusingsuchtechniquesasrunningopticalfibercablethroughsubwaytunnels.36.DistinguishbetweentheInternetbackboneandanInternetserviceprovider(ISP).TheInternetbackboneisasetofhigh-speednetworksthatcarryInternettraffic.AnISPisacompanythatprovidesaccesstotheInternet,usuallyforafee.AnISPconnectsdirectlytotheInternetbackboneortoalargerISPwithaconnectiontothebackbone.37.NameatleasttwonationalISPs.AOLandProdigyaretwonationalISPs.38.NameanddescribethreetechnologiesforconnectingahomecomputertotheInternet.Phonemodem:Amodemisadevicethatconvertscomputerdataintoananalogaudiosignalandbackagain,thusallowingyoutotransferdatatoandfromacomputerusingyourtelephoneline.DSLline:ADSL(digitalsubscriberline)isanInternetconnectionmadeusingdigitalsignalsonregularphonelines.CableModem:AcablemodemisadevicethatallowscomputernetworkcommunicationusingthecableTVconnection.39.WhatroledoISPsplaywiththethreetechnologiesinExercise38?EachofthetechnologiesinExercise38requirestheconnectiontogothroughanISP.Withaphonemodem,youdialupacomputerthatispermanentlyconnectedtotheInternet.Oncetheconnectionismade,youmaytransferdata.ADSLlinemaintainsanactiveconnectionbetweenyourhomeandtheISP.ThecommunicationsetuptoandfromyourhomeusingcablegoesthroughanISP. Lewis_complete_ans5/26/044:54PMPage717Chapter15Exercises71740.Whataretheadvantagesanddisadvantagesofeachofthetechnolo-giesinExercise38?Phonemodemsarethecheapestbecausethephonelinesareinplace,buttransferspeedisveryslowbecausecomputerdatamustbeconvertedintoananalogaudiosignalfortransfer.DSLserviceusesregularphonelinestotransferdigitaldataandyoudonothavetodialin,butyoumustbewithinacertaindistanceofspecialequipmentorthesignaldegrades.Cablemodemsuseaservicethatmanypeoplealreadyhave,butthesignaldeterioratesiftoomanypeopleintheneighborhoodhavetheservice.BothDSLandcablemodemsarebroadbandconnections.41.Phonemodemsanddigitalsubscriberlines(DSL)usethesamekindofphonelinetotransferdata.WhyisDSLsomuchfasterthanphonemodems?Phonemodemstranslatedigitalsignalstoanaloginordertosendthemovervoicefrequencies.DSLsendsthedigitalsignalsoverthesamephonelinebutatadifferentfrequency.BecauseDSLandvoiceareatdifferentfrequencies,theycansharethesamephoneline.42.WhydoDSLandcablemodemsuppliersusetechnologythatdevotesmorespeedtodownloadsthantouploads?Usersspendmoretimeaskingfordatatobesenttotheirmachines(downloads)thantheydosendingdatatoothermachines(uploads).Therefore,DSLandcablemodemsuppliersmaximizethespeedonthemostcommontask.43.MessagessentacrosstheInternetaredividedintopackets.Whatisapacketandwhyaremessagesdividedintothem?Apacketisaunitofdatasentacrossanetwork.ItismoreefficienttosenduniformsizedmessagesacrosstheInternet.44.Explainthetermpacketswitching.PacketsthatmakeupamessagearesentindividuallyovertheInternetandmaytakedifferentroutestotheirdestination.Whenallthepacketsarriveatthedestinationtheyarereassembledintotheoriginalmessage.45.Whatisarouter?Arouterisanetworkdevicethatdirectspacketsbetweennetworkstowardtheirfinaldestinations. Lewis_complete_ans5/26/044:54PMPage718718AnswerstoExercises46.Whatisarepeater?Arepeaterisanetworkdevicethatstrengthensandpropagatesasignalalongalonecommunicationline.47.Whatproblemsariseduetopacketswitching?Becausepacketsmaytakedifferentroutes,theymaynotarriveinorder.Thus,theymustbereassembledintotherightorderatthereceivingend.48.Whatareproprietarysystemsandwhydotheycauseaproblem?Aproprietarysystemisonedesignedandbuiltbyacommercialvendorthatkeepsthetechnologiesusedprivate.Ifanetwork’ssoft-wareisaproprietarysystem,thenitcanonlycommunicatewithothernetworksthatusethesamesoftware.49.Whatdowecalltheabilityofsoftwareandhardwareonmultipleplatformsfrommultiplecommercialvendorstocommunicate?Interoperability50.Whatisanopensystemandhowdoesitfosterinteroperability?Anopensystemisasystembasedonacommonmodelofnetworkarchitectureadheringtoanaccompanyingsuiteofprotocols.Ifallcommercialvendorsadheretoacommonlogicalarchitectureandprotocols,thennetworksonmultipleplatformsfrommultiplevendorscancommunicate.51.Compareandcontrastproprietaryandopensystems.Bothproprietaryandopensystemscanbeusedtocreatenetworks.Networksusingthesameproprietarysystemscancommunicatewitheachother,butnotwithnetworksthatdonotusethesamesystem.Networksusingopensystemscanallcommunicate.52.Whatistheseven-layerlogicalbreakdownofnetworkinteractioncalled?OpenSystemsInterconnection(OSI)ReferenceModel53.Whatisaprotocolstackandwhyisitlayered?Aprotocolstackislayersofprotocolsthatbuildandrelyoneachother.Protocolsarelayeredsothatnewprotocolscanbedevelopedwithoutabandoningfundamentalaspectsoflowerlevels.54.Whatisafirewall,whatdoesitaccomplish,andhowdoesitaccom-plishit?Afirewallisacomputersystemthatprotectsanetworkfrominappro-priateaccess.Afirewallfiltersincomingtraffic,checkingthevalidityofincomingmessages,andperhapsdenyingaccesstomessages.For Lewis_complete_ans5/26/044:54PMPage719Chapter15Exercises719example,aLANmightdenyanyremoteaccessbyrefusingalltrafficthatcomesinonport23(theportfortelnet).55.Whatisahostnameandhowisitcomposed?AhostnameisauniqueidentificationforaspecificcomputerontheInternetmadeupofwordsseparatedbydots.56.WhatisanIPaddressandhowisitcomposed?AnIPaddressismadeupoffournumericvaluesseparatedbydotsthatuniquelyidentifiesacomputerontheInternet57.WhatistherelationshipbetweenahostnameandanIPaddress?HostnamesareforpeopleandIPaddressesareforcomputers.EachhostnameistranslatedintoauniqueIPaddress.Peoplerefertothemachinebyitshostname;computersrefertothemachinebyitsIPaddress.58.IntowhatpartscananIPaddressbesplit?AnIPaddresscanbesplitintoanetworkaddress,whichspecifiesthenetwork,andahostnumber,whichspecifiesaparticularmachineonthenetwork.59.WhataretherelativesizesofClassAnetworks,ClassBnetworks,andClassCnetworks?ClassAnetworksarethelargest,ClassBnetworksareinthemiddle,andClassCnetworksarethesmallest.60.HowmanyhostsarepossibleinClassCnetworks,inClassBnetworks,andinClassAnetworks?ClassCnetworksusethreebytesforthenetworknumberandonlyonebyteforthehostnumber,sotheycanidentify256hosts.ClassBnetworksusetwobytesforthenetworknumberandtwobytesforthehostnumber,sotheycanidentify32768hosts.ClassAnetworksuseonebyteforthenetworknumberandthreebytesforthehostnumber,sotheycanidentify224hosts.61.Whatisadomainname?Adomainnameisthatpartofthehostnamethatspecifiestheorgani-zationorgrouptowhichthehostbelongs.62.Whatisatop-leveldomainname?Thelastpartofadomainnamethatspecifiesthetypeoforganizationoritscountryoforigin.63.Howdoesthecurrentdomainnamesystemtrytoresolveahostname?Firstarequestissenttoanearbydomainnameserver(acomputerthatattemptstotranslateahostnameintoanIPaddress).Ifthat Lewis_complete_ans5/26/044:54PMPage720720AnswerstoExercisesservercannotresolvethehostname,itsendsarequesttoanotherdomainnameserver.Ifthesecondservercan’tresolvethehostname,therequestcontinuestopropagateuntilthehostnameisresolvedortherequestexpiresbecauseittooktoomuchtime.Chapter16ExercisesForExercises1–10,marktheanswerstrueandfalseasfollows:A.TrueB.False1.TheInternetandtheWebareessentiallytwonamesforthesamething.B2.Thecomputerthatissetuptorespondtowebrequestsisawebbrowser.B(it’sawebserver)3.Whenwevisitawebsite,weactuallybringthesitetous.A4.Mostsearchenginesuseacontext-basedapproachforfindingcandi-datepages.B5.Acookieisaprogramthatisexecutedonyourcomputer.B(mostusekeywordmatching)6.Allelementsassociatedwithaparticularwebpagearebroughtoverwhenarequestforthatwebpageismade.A7.Networkshavebeenusedtoconnectcomputerssincethe1950s.A8.NetworkcommunicationwasnotpossibleuntiltheadventoftheWeb.B9.TheWebwasdevelopedinthemid-1990s.A10.YoumusthaveawebbrowserinordertoaccesstheWeb.A Lewis_complete_ans5/26/044:54PMPage721Chapter16Exercises721ForExercises11–20,matchthewordoracronymwiththedefinitionorblank.A.JSPscriptletB.URLC.HTMLD.TagE.JavaappletF.XML11.AprogramdesignedtobeembeddedintoanHTMLdocument.E12.Uniquelyidentifieseverywebpage.B13.________runsonthewebserver.A14._________runsonthewebbrowser.E15.Tagsin_________arefixed.C16.Tagsin_________arenotpredefined.F17._________isametalanguage.F18.Thestructureofan________documentisdescribedbyitscorrespon-dingDocumentTypeDefinition(DTD).F19.Thesyntacticelementinamarkuplanguagethatindicateshowinfor-mationshouldbedisplayed.D20.Partofa_________isthehostnameofthecomputeronwhichtheinformationisstored.BExercises21–68areproblemsorshortanswerquestions.21.WhatistheInternet?TheInternetisawide-areanetworkspanningtheglobe.22.WhatistheWeb?TheWebisaninfrastructureofdistributedinformationcombinedwiththesoftwarethatusesnetworksasavehicletoexchangethatinformation. Lewis_complete_ans5/26/044:54PMPage722722AnswerstoExercises23.Whatisawebpage?Awebpageisadocumentthatcontainsorreferencesvariouskindsofdatasuchastext,images,graphics,andprograms.24.Whatisawebsite?Awebsiteisacollectionofrelatedwebpagesusuallydesignedandcontrolledbythesamepersonorcompany.25.WhatisalinkinthecontextoftheWeb?Alinkisaconnectionbetweenonewebpageandanother.26.WhyisaspiderwebagoodanalogyfortheWorldWideWeb?TheInternetisthehardwareuponwhichthespider-likeconnectionsoftheWorldWideWebhavebeencreated.27.Whatistherelationshipbetweenawebpageandawebsite?Awebpageisadocumentthatcontainsorreferencesvariouskindsofdata.Awebsiteisacollectionofrelatedwebpages.28.WhatisthedifferencebetweentheInternetandtheWeb?TheInternetisawideareanetworkthatspanstheearth.TheWebistheinfrastructureofdistributedinformationandnetworksoftwarethatletsususetheInternetmoreeasily.29.Describehowawebpageisretrievedandviewedbyawebuser.Whenawebaddressisspecifiedinabrowser,thebrowsersendsarequesttothatsite.Thesitereceivingtherequestsendsthepageandallassociatedinformationbacktobedisplayedinthebrowser.30.WhatisaUniformResourceLocator?AUniformResourceLocator(URL)isthestandardwayofspecifyingthelocationofawebpage.31.Whatisamarkuplanguage?Wheredoesthenamecomefrom?Amarkuplanguageisonethatusestagstoidentifytheelementsinadocumentandindicatehowtheyshouldbedisplayed.Thenamecomesfromtheideaoftakingadocumentandwriting(markingup)thedocumentwithtagsthatsayhowtodisplayit.32.Compareandcontrasthypertextandhypermedia.Hypertextandhypermediabothmeanthatdata(information)isnotorganizedlinearly.Thereareembeddedlinksthatallowustojumpfromoneplacetoanotherindocuments.BecauseinformationontheWebismorethanjusttext,hypermediaisamoreaccurateterm.33.DescribethesyntaxofanHTMLtag.HTMLtagsarecomposedofreservedwordsenclosedinangledbrackets(<...>).Somereservedwordsareusedinpairswiththesecondoneprecededbya/. Lewis_complete_ans5/26/044:54PMPage723Chapter16Exercises72334.Whatisahorizontalrule?Whataretheyusefulfor?Horizontalrulesarelinesacrossapage.Theyareusefulforsepa-ratingsectionsofapage.35.NamefiveformattingspecificationsthatcanbeestablishedusingHTMLtags.HTMLisnotcasesensitive...bold..italic
horizontalrule
    ..
unorderedlist
    ..
orderedlist
  • listitem

    ..

    number3heading36.Whatisatagattribute?Giveanexample.Atagattributeispartofatagthatgivesextrainformation.isanexample.Thetagisimgforimage,andtheattributeissrcforsourceofimage,whichisfollowedbythenameofafilecontainingtheimageinquotes.37.WritetheHTMLstatementthatinputstheimageonfile“mine.gif”intothewebpage.38.WritetheHTMLstatementthatsetsupalinktohttp://www.cs.utexas.edu/users/ndale/andshowsthetext“DaleHomePage”onthescreen.DaleHomePage39.Whathappenswhenauserclickson“DaleHomePage”assetupinExercise38?Acopyofthepageathttp://www.cs.utexas.edu/users/ndaleisdisplayedontheuser’sbrowser.40.DesignandimplementanHTMLdocumentforanorganizationatyourschool.Activity,noanswerexpected.41.DesignandimplementanHTMLdocumentdescribingoneormoreofyourpersonalhobbies.Activity,noanswerexpected. Lewis_complete_ans5/26/044:54PMPage724724AnswerstoExercises42.WhatisaJavaapplet?AJavaappletisaJavaprogramdesignedtobeembeddedinanHTMLdocument,transferredovertheWeb,andexecutedinabrowser.43.HowdoyouembedaJavaappletinanHTMLdocument?AJavaappletisembeddedinanHTMLdocumentusingtheapplettag.Forexample,thefollowingHTMLtagembedsclassMyClassinanHTMLdocument:44.WheredoesaJavaappletgetexecuted?AJavaappletgetsexecutedintheuser’sbrowser.45.WhatkindsofrestrictionsareputonJavaapplets?Why?BecauseaJavaappletisexecutedontheuser’smachine,itmustbetransmittedfromthewebserver.Also,theuser’scomputermaynothavearesourcethattheappletneeds.Thusonlyrelativelysmallprogramsusingverystandardresourcesareappropriate.46.WhatisaJavaServerPage?AJavaServerPage(JSP)isawebpagethathasJavascriptletsembeddedinit.47.Whatisascriptlet?AscriptletisacodesegmentembeddedinanHTMLdocumentdesignedtocontributetothecontentofthepage.48.HowdoyouembedascriptletinanHTMLdocument?ThespecialHTMLtags<%..%>enclosethescriptlet.49.HowdoesJSPprocessingdifferfromappletprocessing?Scriptletprocessingisdoneontheserverside;appletprocessingisdoneontheuser’sside.50.Whatisametalanguage?Ametalanguageisalanguageusedtodefineotherlanguages.51.WhatisXML?XMLisametalanguagethatisusedtodefineothermarkuplanguages.52.HowareHTMLandXMLalikeandhowaretheydifferent?BothHTMLandXMLusedtaggeddata.ThetagsthatHTMLusesarepredefined,bothintermsofsyntaxandsemantics.XMLisametalanguagethatdefinesnewmarkuplanguages.AnXMLdocu-mentiswrittenusingtags,whicharethendefinedintheaccompa-nyingDocumentTypeDefinition. Lewis_complete_ans5/26/044:54PMPage725Chapter16Exercises72553.HowdoesanXMLdocumentrelatetoaDocumentTypeDefinition?TheXMLdocumentandtherelatedDTDdefineanewmarkuplanguage.54.a.InaDTD,howdoyouindicatethatanelementistoberepeatedzeroormoretimes?Anelementinparentheseswithanasteriskfollowingtheelementindicateszeroormoretimes.b.InaDTD,howdoyouindicatethatanelementistoberepeatedoneormoretimes?Anelementinparentheseswithaplussignfollowingtheelementindicatesoneormoretimes.c.InaDTD,howdoyouindicatethatanelementcannotbebrokendownintoothertags?Anelementfollowedby(#PCDATA)indicatesthattheelementcannotbebrokendownfurther.55.WhatisXSL?XSLstandsforExtensibleStylesheetLanguage.XSLisusedtodefinetransformationsofXMLdocumentstootherformats.56.WhatistherelationshipbetweenXMLandXSL?XSListhelanguagethatcanbeusedtodetermineformatsfortheXMLdocumentanditsaccompanyingDTD.57.HowdoesanXMLdocumentgetviewed?AnXMLdocumentistranslatedbyXSLintoaformthatcanbedisplayed.58.DefineanXMLlanguage(theDTD)foryourschoolcoursesandproduceasampleXMLdocument.AnalysisofAlgorithmsComputerScience170SmythTheAmericanRevolution Lewis_complete_ans5/26/044:54PMPage726726AnswerstoExercisesHistory240JeffersonSpanishPoetrySpanish470Garcia59.DefineanXMLlanguage(theDTD)forpoliticalofficesandproduceasampleXMLdocument.PresidentoftheUnitedStatesFederalGeorgeW.BushRepublicanWilliamClintonGeorgeH.W.BushRonaldReagan Lewis_complete_ans5/26/044:54PMPage727Chapter16Exercises727JamesCarterVicePresidentoftheUnitedStatesFederalRichardCheneyRepublicanAlGoreDanQuayleGeorgeH.W.BushWalterMondale60.DefineanXMLlanguage(theDTD)forzooanimalsandproduceasampleXMLdocument.kangaroo Lewis_complete_ans5/26/044:54PMPage728728AnswerstoExercisesmammaliamarsupialia2CletusNate0elephantmammaliaelephantidae1Max2BeautyGeraldinealligatorreptiliacrocodilia Lewis_complete_ans5/26/044:54PMPage729Chapter16Exercises7294761.Thischapterisfullofacronyms.Defineeachofthefollowingones.a.HTMLHypertextMarkupLanguageb.XMLExtensibleMarkupLanguagec.DTDDocumentTypeDefinitionsd.XSLExtensibleStylesheetLanguagee.SGMLStandardGeneralizedMarkupLanguagef.URLUniformResourceLocatorg.ISPInternetServiceProviders Lewis_complete_ans5/26/044:54PMPage730730AnswerstoExercises62.CreateanHTMLdocumentforawebpagethathaseachofthefollowingfeatures.a.centeredtitleb.unorderedlistc.orderedlistd.linktoanotherwebpagee.apictureActivity;noanswerexpected.63.DistinguishbetweenanHTMLtagandanattribute.Atagisasyntacticelementinamarkuplanguagethatindicateshowinformationshouldbedisplayed.Anattributeispartofatagthatgivesadditionalinformationaboutit.64.Whydoesthesamewebpagelookdifferentindifferentbrowsers?ThetagsintheHTMLdocumentthatdefinesawebpagemaybeinterpreteddifferentlybydifferentbrowsers.65.WhatarethetwosectionsofeveryHTMLdocument?Theheadofthedocumentandthebodyofthedocument.66.WhatarethecontentsofthetwopartsofanHTMLdocument?Theheadcontainsinformationaboutthedocument.Thebodycontainstheinformationtobedisplayed.67.WhatdoestheAstandforinthetagthatspecifiesaURLforapage?Anchor68.CreateanHTMLdocumentforawebpagethathaseachofthefollowingfeatures.a.aright-justifiedtitleinlargetypefontb.anappletclassnamed“Exercise.class”.c.twodifferentlinksd.twodifferentpicturesActivity;noanswerprovided.Chapter17ExercisesForExercises1–15,matchtheBig-Onotationwithitsdefinitionoruse.A.O(1)B.O(log2N)C.O(N)D.O(Nlog2N)E.O(N2)F.O(2N)G.O(N!) Lewis_complete_ans5/26/044:54PMPage731Chapter17Exercises7311.FactorialtimeG2.NlogNtimeD3.LineartimeC4.QuadratictimeE5.ExponentialtimeF6.LogarithmictimeB7.BoundedtimeA8.Timenotdependentonthesizeoftheproblem.A9.Algorithmsthatsuccessivelycuttheamountofdatatobeprocessedinhalfateachstep.B10.MergesortandHeapsortD11.SelectionsortandBubblesortE12.AddingacolumnofNnumbersC13.DemonstratedbythefableoftheKingandtheCorn.F14.TravelingsalespersonG15.WhatQuicksortdegeneratestoifthedataisalreadysorted.E Lewis_complete_ans5/26/044:54PMPage732732AnswerstoExercisesForExercises16–20,matchthenameofthetechniquewiththealgorithm.A.EvenparityB.OddparityC.CheckdigitsD.Error-correctingcodesE.Paritybit16.Anextrabitassociatedwitheachbyteinthehardwarethatensuresthatthenumberof1bitsisoddorevenacrossallbytes.E17.Ultimateredundancywouldbetokeeptwocopiesofeveryvalue.D18.Thenumberof1bitsplustheparitybitisodd.B19.Thenumberof1bitsplustheparitybitiseven.A20.Aschemetosumtheindividualdigitsinanumberandstoretheunit’sdigitofthatsumwiththenumber.CForExercises21–30,marktheanswerstrueandfalseasfollows:A.TrueB.False21.(1+X–1)isalwaysequaltoX.B22.Representationalerrorisasynonymforround-offerror.A23.Softwareverificationactivitiesarelimitedtotheimplementationphase.B24.Halftheerrorsinasoftwareprojectoccurinthedesignphase.A25.Mostlargesoftwareprojectsaredesignedbyasinglegeniusandthengiventoteamsofprogrammerstoimplement.B26.Thelaterinthesoftwarelifecyclethatanerrorisdetected,thecheaperitistofix.B Lewis_complete_ans5/26/044:54PMPage733Chapter17Exercises73327.Formalverificationofprogramsisoftheoreticalinterestbuthassofarneverbeenuseful.B28.Big-Onotationtellsushowlongthesolutiontakestorunintermsofmicroseconds.B29.Softwareengineering,abranchofcomputing,emergedinthe1960s.A30.Maintainingandevolvingexistingsoftwarehasbecomemoreimpor-tantthanbuildingnewsystems.AExercises31–61areproblemsorshortanswerquestions.31.Definerepresentationalerror,cancellationerror,underflow,andover-flow.Discusshowthesetermsareinterrelated.Representationalerror(round-offerror)istheerrorcausedbythefactthattheprecisionoftheresultofanarithmeticoperationisgreaterthantheprecisionofourmachine.Cancellationerroristhelossofaccuracyduringadditionorsubtrac-tionofnumbersofwidelydifferingsizes,duetolimitsofprecision.Underflowistheconditionthatoccurswhentheresultsofacalcula-tionaretoosmalltorepresentinagivenmachine.Overflowistheconditionthatoccurswhentheresultsofacalculationaretoolargetorepresentinagivenmachine.Thesetermsarerelatedbecausetheyallrefertoproblemsthatoccurbecausenumbersareinfinite,andtheirrepresentationinacomputerisfinite.32.Showtherangeofintegernumbersthatcanberepresentedforeachoffollowingwordsizes.a.8-bits–128..127b.16bits–32768..31767c.24bits–8388608..8388607d.32bits–2147483648..2147483647e.64bits–9223372036854775808..9223372036854775807 Lewis_complete_ans5/26/044:54PMPage734734AnswerstoExercises33.Thereisalogicalactiontotakewhenunderflowoccurs,butnotwhenoverflowoccurs.Explain.Underflowoccurswhenthenumberistoosmalltorepresent.Whenthishappens,itislogicaltosetthevalueto0.Overflowoccurswhenthenumberistoobigtorepresent.Thereisnologicalvaluetosubsti-tutewhenthisoccurs.34.a.Showhowthenumbers1066and1492wouldberepresentedinalinkedlistwithonedigitpernode.b.Usealinkedlisttorepresentthesumoftheseintegers.c.Outlineanalgorithmtoshowhowthecalculationmightbecarriedoutinacomputer.a.10661492b.2558c.Tocalculatethesum,youmustmovefromrighttoleftinthelistratherthanlefttoright.Assumeapreviousoperationgetsthenodebeforecurrent.MODisanoperationthatreturnstheremainderfromintegerdivision.DIVisanoperationthatreturnsthequotientfromintegerdivision.SetcurrentFirsttolastSetcurrentSecondtolastSetcarryto0While(currentFirst<>NULLandcurrentSecond<>NULL)GetanewnodeSetinfo(newnode)to(info(currentFirst)+info(currentSecond)+carry)MOD10Setcarryto(info(currentFirst)+info(currentSecond)+carry)DIV10SetcurrentFirsttoprevious(currentFirst)SetcurrentSecondtoprevious(currentSecond)Putnewnodeintoresult Lewis_complete_ans5/26/044:54PMPage735Chapter17Exercises735While(currentFirst<>NULL)//Copyrestoffirstlistifitisnotempty.GetanewnodeSetinfo(newnode)to(info(currentFirst)+carry)MOD10Setcarryto(info(currentFirst)+carry)DIV10SetcurrentFirsttoprevious(currentFirst)PutnewnodeintoresultWhile(currentSecond<>NULL)//CopyrestofsecondlitifitisnotemptyGetanewnodeSetinfo(newnode)to(info(currentSecond)+carry)MOD10Setcarryto(info(currentSecond)+carry)DIV10SetcurrentSecondtoprevious(currentSecond)Putnewnodeintoresult35.ExplaintheTitanicEffectinrelationtohardwarefailure.TheTitanicEffectstatesthattheseveritywithwhichasystemfailsisdirectlyproportionaltotheintensityofthedesigner’sbeliefthatitcannot.Themoreintensethedesigner’sbeliefisthattheproductcannotfail,themorecatastrophicafailureis.36.Haveanyhardwarefailureshappenedtoyou?Explain.Noanswerexpected.37.Giventhefollowing8-bitcode,whatistheparitybitifoddparityisbeingused?a.111000101b.101010101c.111111111d.000000001e.111011110 Lewis_complete_ans5/26/044:54PMPage736736AnswerstoExercises38.Giventhefollowing8-bitcode,whatistheparitybitifevenparityisbeingused.a.111000100b.101010100c.111111110d.000000000e.11101111139.Giventhefollowingnumbers,whatwouldbethecheckdigitforeach?a.10663b.14982c.16681d.20013e.4040840.WhaterrorswouldbedetectedusingthecheckdigitsinExercise39?Thistechniquerecognizeswhenonedigitofanumberiscorrupted.41.Giventhefollowingnumbers,whatwouldbetheadditionaldigitsiftheunit’sdigitofthesumoftheevendigitsisusedalongwiththecheckdigit?Countingisfromlefttoright.a.10666b.14982c.16684d.20011e.40400 Lewis_complete_ans5/26/044:54PMPage737Chapter17Exercises73742.Giventhefollowingnumbers,whatwouldbetheadditionaldigitsiftheunit’sdigitofthesumoftheodddigitsisusedalongwiththecheckdigit?Countingisfromlefttoright.a.10667b.14980c.16687d.20012e.4040843.HowdotherepresentationsinExercises41and42improvetheerrordetectionoverasimplecheckdigit?Thistechniquecatchesatranspositionerrorbetweenadjacentdigits.44.Explaintheconceptofthesoftwarelifecycle.Thesoftwarelifecycleistheconceptthatsoftwareisdeveloped,notjustcoded,andevolvesoveritslifetime.45.Wheredomostoftheerrorsoccurinasoftwareproject?Halftheerrorsoccurinthedesignphaseandhalfoccurintheimple-mentationphase.46.Whydoesthecostoffixinganerrorincreasethelongertheerrorremainsundetected?Softwareevolvesovertime.Whenaerrorisdetecteditmustbecorrectedwhereitfirstoccursandeverysubsequentplacetowhichtheerrorpropagates.47.Compareandcontrastthesoftwareverificationactivitiescodetodesignwalk-throughsandinspections.Awalk-throughisanactivityinwhichateamperformsamanualsimulationoftheprogramordesign.Aninspectionisanactivityinwhichonememberofateamreadstheprogramordesignlinebylineandtheotherspointouterrors.Botharegroupactivities,butaninspectionisleadbyoneperson.48.Howcanaprogrambeverifiedtobecorrectbutstillbeworthless?Aprogrammaydoexactlyasitsspecificationrequires,butifthespec-ificationisincorrect,theprogramisworthless. Lewis_complete_ans5/26/044:54PMPage738738AnswerstoExercises49.Nameatleast5placeswhereasoftwareerrorcouldbeintroduced.Errorscanbeintroducedineachphaseofthesoftwarelifecycle:requirements,specifications,design,implementation,andmainte-nance.50.HowwastheAT&Tsoftwarefailuretypicalofsuchfailures?Onepersonmadetheerror,butmanyothersreviewedthecodewithoutseeingtheerror.Thefailurewastriggeredbyarelativelyuncommonsequenceofeventsthatweredifficulttoanticipateinadvance.Theerroroccurredincodedesignedtoimproveacorrectlyworkingsystem.51.Whatisformalverification?Formalverificationistheverificationofprogramcorrectnessinde-pendentoftesting.Thegoalistodevelopamethodforprovingprogramsthatisanalogoustothemethodofprovingtheoremsingeometry.52.Explaintheanalogyoftheelephantandthegoldfish.Therelativesizeoftheelephantdwarfsthecontributionofthegold-fish.53.Definepolynomialtime.Apolynomialtimealgorithmisonewhosecomplexitycanbeexpressedasapolynomialinthesizeoftheproblem.54.HowisitpossibletothrowawayallbutthetermwiththelargestexponentwhenassessingtheBig-Oofapolynomialtimealgorithm?Asthesizefactorincreases,thelargesttermdwarfsthecontributionoftheotherterms.55.GivetheBig-Ocomplexitymeasureofthefollowingpolynomials.a.4x3+32x2+2x+1003O(N3)b.x5+xO(N5)c.x2+124578O(N2)d.x+1O(N)56.Explaintheanalogyofbinsofcomplexitymeasures.WecanthinkofabinrepresentingoneoftheBig-Ocomplexitymeas-ures.Thebincontainsallofthealgorithmsthathavethatcomplexitymeasure,butwithinthebinthealgorithmscanbeorderedbythediscardedterms. Lewis_complete_ans5/26/044:54PMPage739Chapter17Exercises73957.WhomanufacturesaTuringmachine?ATuringmachineisahypotheticalmachineusedasamodeltostudythelimitsofwhatcanbecomputed.58.HowdoesaTuringmachinesimulateahumanwithapaperandpencil?ATuringMachineconsistsofacontrolunitwitharead/writehead(thebrain)thatcanreadandwritesymbolsonaninfinitetape.Thetapeisdividedintocells.Themodelisbasedonapersondoingaprimitivecalculationonalongstripofpaperusingapencilwithaneraser.Eachline(cell)ofthepapercontainsasymbolfromafinitealphabet.Startingatonecell,thesymbolisexaminedandeitherleftaloneorerasedandreplacedwithanothersymbolfromthealphabet.Anadjacentcellisaccessedandtheactionsarerepeated.59.Arethereproblemsforwhichtherearenosolutions?Yes;thereisatleastone.60.DescribetheHaltingProblem.TheHaltingProblemsasksthequestion:Givenaprogramandaninputtotheprogram,determineiftheprogramwilleventuallystopwiththisinput.61.HowisthefactthatdataandprogramslookalikeinsideacomputerusedintheproofthattheHaltingproblemisunsolvable?Intheproof,theprogramisgivenitselfasdata. Lewis_complete_ans5/26/044:54PMPage740IntentionalBlank740'