Post on 10-Feb-2021
1
GraduateProgramDepartmentofComputerScience
ComprehensiveExamination–PracticeQuestions
CMPS500–OperatingSystems
1.Inwhatwayisanoperatingsystemlikeagovernment?A)Itseldomfunctionscorrectly.B)Itcreatesanenvironmentwithinwhichotherprogramscandousefulwork.C)Itperformsmostusefulfunctionsbyitself.D)Itisalwaysconcernedprimarilywiththeindividual'sneeds.2.____operatingsystemsaredesignedprimarilytomaximizeresourceutilization.A)PCB)HandheldcomputerC)MainframeD)Network3.Themostcommonsecondarystoragedeviceis____.A)randomaccessmemoryB)solidstatedisksC)tapedrivesD)magneticdisk4.WhichofthefollowingwouldleadyoutobelievethatagivensystemisanSMP-typesystem?A)Eachprocessorisassignedaspecifictask.B)Thereisaboss–workerrelationshipbetweentheprocessors.C)Eachprocessorperformsalltaskswithintheoperatingsystem.D)Noneoftheabove5.Whatstatementconcerningprivilegedinstructionsisconsideredfalse?A)Theymaycauseharmtothesystem.B)Theycanonlybeexecutedinkernelmode.C)Theycannotbeattemptedfromusermode.D)Theyareusedtomanageinterrupts.6.Whichofthefollowingstatementsisfalse?A)Mobiledevicesmustbeconcernedwithpowerconsumption.B)Mobiledevicescanprovidefeaturesthatareunavailableondesktoporlaptopcomputers.C)Thedifferenceinstoragecapacitybetweenamobiledeviceandlaptopisshrinking.D)Mobiledevicesusuallyhavefewerprocessingcoresthanastandarddesktopcomputer.
2
7.A(n)________istheunitofworkinasystem.A)processB)operatingsystemC)timerD)modebit8.ThetwoseparatemodesofoperatinginasystemareA)supervisormodeandsystemmodeB)kernelmodeandprivilegedmodeC)physicalmodeandlogicalmodeD)usermodeandkernelmode9.A_____isanexampleofasystemsprogram.A)commandinterpreterB)WebbrowserC)textformatterD)databasesystem10.Ifaprogramterminatesabnormally,adumpofmemorymaybeexaminedbya____todeterminethecauseoftheproblem.A)moduleB)debuggerC)shellD)controlcard11.Amessage-passingmodelis____.A)easiertoimplementthanasharedmemorymodelforintercomputercommunicationB)fasterthanthesharedmemorymodelC)anetworkprotocol,anddoesnotapplytooperatingsystemsD)onlyusefulforsmallsimpleoperatingsystems12.Policy____.A)determineshowtodosomethingB)determineswhatwillbedoneC)isnotlikelytochangeacrossplacesD)isnotlikelytochangeovertime13.______isamobileoperatingsystemdesignedfortheiPhoneandiPad.A)MacOSXB)AndroidC)UNIXD)iOS14.The________providesaportionofthesystemcallinterfaceforUNIXandLinux.A)POSIX
3
B)JavaC)StandardClibraryD)StandardAPI15.Whichofthefollowingstatementsisincorrect?A)Anoperatingsystemprovidesanenvironmentfortheexecutionofprograms.B)Anoperatingsystemmanagessystemresources.C)Operatingsystemsprovidebothcommandlineaswellasgraphicaluserinterfaces.D)Operatingsystemsmustprovidebothprotectionandsecurity.16._____is/arenotatechniqueforpassingparametersfromanapplicationtoasystemcall.A)CachememoryB)RegistersC)StackD)Specialblockinmemory17.The____ofaprocesscontainstemporarydatasuchasfunctionparameters,returnaddresses,andlocalvariables.A)textsectionB)datasectionC)programcounterD)stack18.Aprocesscontrolblock____.A)includesinformationontheprocess'sstateB)storestheaddressofthenextinstructiontobeprocessedbyadifferentprocessC)determineswhichprocessistobeexecutednextD)isanexampleofaprocessqueue19.ThelistofprocesseswaitingforaparticularI/Odeviceiscalleda(n)____.A)standbyqueueB)devicequeueC)readyqueueD)interruptqueue20.The_____________referstothenumberofprocessesinmemory.A)processcountB)long-termschedulerC)degreeofmultiprogrammingD)CPUscheduler21.WhichofthefollowingisnotaprocesstypeintheChromebrowser?
4
A)Plug-inB)RendererC)SandboxD)Browser22.The________applicationistheapplicationappearingonthedisplayscreenofamobiledevice.A)mainB)backgroundC)displayD)foreground23.Aprocessthathasterminated,butwhoseparenthasnotyetcalledwait(),isknownasa________process.A)zombieB)orphanC)terminatedD)init24.The_______processisassignedastheparenttoorphanprocesses.A)zombieB)initC)mainD)renderer25.____isathreadlibraryforSolaristhatmapsmanyuser-levelthreadstoonekernelthread.A)PthreadsB)GreenthreadsC)SthreadsD)Javathreads26.Pthreadsrefersto____.A)thePOSIXstandard.B)animplementationforthreadbehavior.C)aspecificationforthreadbehavior.D)anAPIforprocesscreationandsynchronization.27.The____multithreadingmodelmultiplexesmanyuser-levelthreadstoasmallerorequalnumberofkernelthreads.A)many-to-onemodelB)one-to-onemodelC)many-to-manymodel
5
D)many-to-somemodel28.Cancellationpointsareassociatedwith____cancellation.A)asynchronousB)deferredC)synchronousD)non-deferred29._________involvesdistributingtasksacrossmultiplecomputingcores.A)ConcurrencyB)TaskparallelismC)DataparallelismD)Parallelism30.___________isaformulathatidentifiespotentialperformancegainsfromaddingadditionalcomputingcorestoanapplicationthathasaparallelandserialcomponent.A)TaskparallelismB)DataparallelismC)DatasplittingD)Amdahl'sLaw31.WhenOpenMPencountersthe#pragmaompparalleldirective,itA)constructsaparallelregionB)createsanewthreadC)createsasmanythreadsasthereareprocessingcoresD)parallelizesforloops32.GrandCentralDispatchhandlesblocksbyA)placingthemonadispatchqueueB)creatinganewthreadC)placingthemonadispatchstackD)constructingaparallelregion33.Aracecondition____.A)resultswhenseveralthreadstrytoaccessthesamedataconcurrentlyB)resultswhenseveralthreadstrytoaccessandmodifythesamedataconcurrentlyC)willresultonlyiftheoutcomeofexecutiondoesnotdependontheorderinwhichinstructionsareexecutedD)Noneoftheabove34.Aninstructionthatexecutesatomically____.A)mustconsistofonlyonemachineinstructionB)executesasasingle,uninterruptibleunitC)cannotbeusedtosolvethecriticalsectionproblem
6
D)Alloftheabove35.Acountingsemaphore____.A)isessentiallyanintegervariableB)isaccessedthroughonlyonestandardoperationC)canbemodifiedsimultaneouslybymultiplethreadsD)cannotbeusedtocontrolaccesstoathread'scriticalsections36.Amutexlock____.A)isexactlylikeacountingsemaphoreB)isessentiallyabooleanvariableC)isnotguaranteedtobeatomicD)canbeusedtoeliminatebusywaiting37.A___typepresentsasetofprogrammer-definedoperationsthatareprovidedmutualexclusionwithinit.A)transactionB)signalC)binaryD)monitor38.____________occurswhenahigher-priorityprocessneedstoaccessadatastructurethatiscurrentlybeingaccessedbyalower-priorityprocess.A)PriorityinversionB)DeadlockC)AraceconditionD)Acriticalsection39.Whatisthecorrectorderofoperationsforprotectingacriticalsectionusingmutexlocks?A)release()followedbyacquire()B)acquire()followedbyrelease()C)wait()followedbysignal()D)signal()followedbywait()40.Whatisthecorrectorderofoperationsforprotectingacriticalsectionusingabinarysemaphore?A)release()followedbyacquire()B)acquire()followedbyrelease()C)wait()followedbysignal()D)signal()followedbywait()41.Whichofthefollowingistrueofcooperativescheduling?A)Itrequiresatimer.
7
B)AprocesskeepstheCPUuntilitreleasestheCPUeitherbyterminatingorbyswitchingtothewaitingstate.C)Itincursacostassociatedwithaccesstoshareddata.D)Aprocessswitchesfromtherunningstatetothereadystatewhenaninterruptoccurs.42.____isthenumberofprocessesthatarecompletedpertimeunit.A)CPUutilizationB)ResponsetimeC)TurnaroundtimeD)Throughput43.____schedulingisapproximatedbypredictingthenextCPUburstwithanexponentialaverageofthemeasuredlengthsofpreviousCPUbursts.A)MultilevelqueueB)RRC)FCFSD)SJF44.The____schedulingalgorithmisdesignedespeciallyfortime-sharingsystems.A)SJFB)FCFSC)RRD)Multilevelqueue45.Therateofaperiodictaskinahardreal-timesystemis____,wherepisaperiodandtistheprocessingtime.A)1/pB)p/tC)1/tD)pt46.Whichofthefollowingistrueoftherate-monotonicschedulingalgorithm?A)Thetaskwiththeshortestperiodwillhavethelowestpriority.B)Itusesadynamicprioritypolicy.C)CPUutilizationisboundedwhenusingthisalgorithm.D)Itisnon-preemptive.47.Whichofthefollowingistrueofearliest-deadline-first(EDF)schedulingalgorithm?A)Whenaprocessbecomesrunnable,itmustannounceitsdeadlinerequirementstothesystem.B)Deadlinesareassignedasfollowing:theearlierthedeadline,thelowerthepriority;thelaterthedeadline,thehigherthepriority.C)Prioritiesarefixed;thatis,theycannotbeadjustedwhenanewprocessstartsrunning.D)Itassignsprioritiesstaticallyaccordingtodeadline.
8
48.Thetwogeneralapproachestoloadbalancingare__________and____________.A)softaffinity,hardaffinityB)coarsegrained,finegrainedC)softreal-time,hardreal-timeD)pushmigration,pullmigration49.Adeadlockedstateoccurswhenever____.A)aprocessiswaitingforI/OtoadevicethatdoesnotexistB)thesystemhasnoavailablefreeresourcesC)everyprocessinasetiswaitingforaneventthatcanonlybecausedbyanotherprocessinthesetD)aprocessisunabletoreleaseitsrequestforaresourceafteruse50.Onenecessaryconditionfordeadlockis____,whichstatesthatatleastoneresourcemustbeheldinanonsharablemode.A)holdandwaitB)mutualexclusionC)circularwaitD)nopreemption51.Onenecessaryconditionfordeadlockis______,whichstatesthataprocessmustbeholdingoneresourceandwaitingtoacquireadditionalresources.A)holdandwaitB)mutualexclusionC)circularwaitD)nopreemption52.Onenecessaryconditionfordeadlockis______,whichstatesthataresourcecanbereleasedonlyvoluntarilybytheprocessholdingtheresource.A)holdandwaitB)mutualexclusionC)circularwaitD)nopreemption53.Onenecessaryconditionfordeadlockis______,whichstatesthatthereisachainofwaitingprocesseswherebyP0iswaitingforaresourceheldbyP1,P1iswaitingforaresourceheldbyP2,andPniswaitingforaresourceheldbyP0.A)holdandwaitB)mutualexclusionC)circularwaitD)nopreemption54.Thewitnesssoftwareproductisa____.A)lock-orderverifierthatusesmutual-exclusionlockstoprotectcriticalsectionsB)modelertodevelopresourceallocationgraphs
9
C)driverthatcanbeusedtopreventmutualexclusionfornonsharableresourcesD)implementationofthebanker'salgorithmavailableformostoperatingsystems55.Inasystemresource-allocationgraph,____.A)adirectededgefromaprocesstoaresourceiscalledanassignmentedgeB)adirectededgefromaresourcetoaprocessiscalledarequestedgeC)adirectededgefromaprocesstoaresourceiscalledarequestedgeD)Noneoftheabove56.Acycleinaresource-allocationgraphis____.A)anecessaryandsufficientconditionfordeadlockinthecasethateachresourcehasmorethanoneinstanceB)anecessaryandsufficientconditionforadeadlockinthecasethateachresourcehasexactlyoneinstanceC)asufficientconditionforadeadlockinthecasethateachresourcehasmorethanonceinstanceD)isneithernecessarynorsufficientforindicatingdeadlockinthecasethateachresourcehasexactlyoneinstance57.Absolutecodecanbegeneratedfor____.A)compile-timebindingB)load-timebindingC)execution-timebindingD)interruptbinding58._____isthemethodofbindinginstructionsanddatatomemoryperformedbymostgeneral-purposeoperatingsystems.A)InterruptbindingB)CompiletimebindingC)ExecutiontimebindingD)Load-timebinding59.AnaddressgeneratedbyaCPUisreferredtoasa____.A)physicaladdressB)logicaladdressC)postrelocationregisteraddressD)Memory-ManagementUnit(MMU)generatedaddress60.Supposeaprogramisoperatingwithexecution-timebindingandthephysicaladdressgeneratedis300.Therelocationregisterissetto100.Whatisthecorrespondinglogicaladdress?A)199B)201
10
C)200D)30061.Consideralogicaladdresswithapagesizeof8KB.Howmanybitsmustbeusedtorepresentthepageoffsetinthelogicaladdress?A)10B)8C)13D)1262.Consideralogicaladdresswith18bitsusedtorepresentanentryinaconventionalpagetable.Howmanyentriesareintheconventionalpagetable?A)262144B)1024C)1048576D)1863.AssumeasystemhasaTLBhitratioof90%.Itrequires15nanosecondstoaccesstheTLB,and85nanosecondstoaccessmainmemory.Whatistheeffectivememoryaccesstimeinnanosecondsforthissystem?A)108.5B)100C)22D)176.564.Giventhelogicaladdress0xAEF9(inhexadecimal)withapagesizeof256bytes,whatisthepagenumber?A)0xAEB)0xF9C)0xAD)0x00F965.Whichofthefollowingisabenefitofallowingaprogramthatisonlypartiallyinmemorytoexecute?A)Programscanbewrittentousemorememorythanisavailableinphysicalmemory.B)CPUutilizationandthroughputisincreased.C)LessI/Oisneededtoloadorswapeachuserprogramintomemory.D)Alloftheabove66.Insystemsthatsupportvirtualmemory,____.A)virtualmemoryisseparatedfromlogicalmemory.B)virtualmemoryisseparatedfromphysicalmemory.C)physicalmemoryisseparatedfromsecondarystorage.D)physicalmemoryisseparatedfromlogicalmemory.
11
67.Thevfork()systemcallinUNIX____.A)allowsthechildprocesstousetheaddressspaceoftheparentB)usescopy-on-writewiththefork()callC)isnotintendedtobeusedwhenthechildprocesscallsexec()immediatelyaftercreationD)duplicatesallpagesthataremodifiedbythechildprocess68.Supposewehavethefollowingpageaccesses:12342341211314andthattherearethreeframeswithinoursystem.UsingtheFIFOreplacementalgorithm,whatisthenumberofpagefaultsforthegivenreferencestring?A)14B)8C)13D)1069.Supposewehavethefollowingpageaccesses:12342341211314andthattherearethreeframeswithinoursystem.UsingtheFIFOreplacementalgorithm,whatwillbethefinalconfigurationofthethreeframesfollowingtheexecutionofthegivenreferencestring?A)4,1,3B)3,1,4C)4,2,3D)3,4,270.Supposewehavethefollowingpageaccesses:12342341211314andthattherearethreeframeswithinoursystem.UsingtheLRUreplacementalgorithm,whatisthenumberofpagefaultsforthegivenreferencestring?A)14B)13C)8D)1071.Giventhereferencestringofpageaccesses:12342341211314andasystemwiththreepageframes,whatisthefinalconfigurationofthethreeframesaftertheLRUalgorithmisapplied?A)1,3,4B)3,1,4C)4,1,2D)1,2,372.Belady'sanomalystatesthat____.A)givingmorememorytoaprocesswillimproveitsperformanceB)asthenumberofallocatedframesincreases,thepage-faultratemaydecreaseforallpagereplacementalgorithms
12
C)forsomepagereplacementalgorithms,thepage-faultratemaydecreaseasthenumberofallocatedframesincreasesD)forsomepagereplacementalgorithms,thepage-faultratemayincreaseasthenumberofallocatedframesincreases73.IntheUNIXoperatingsystem,adomainisassociatedwiththe____.A)userB)processC)procedureD)task74.InMULTICS,theprotectiondomainsareorganizedina_____.A)starstructureB)linearstructureC)ringstructureD)directorystructure75.Inanaccessmatrix,the____rightallowsaprocesstochangetheentriesinarow.A)ownerB)copyC)control.D)switch76.The____implementationofanaccesstableconsistsofsetsoforderedtriples.A)globaltableB)accesslistforobjectsC)lock-keymechanismD)capabilitylist77.Incapabilitylists,eachobjecthasa____todenoteitstype.A)gateB)tagC)keyD)lock78.Whichofthefollowingimplementationsoftheaccessmatrixisacompromisebetweentwootherimplementationslistedbelow?A)accesslistB)capabilitylistC)globaltableD)lock-key79.Inthereacquisitionschemeforimplementingtherevocationofcapabilities,____.A)akeyisdefinedwhenthecapabilityiscreated
13
B)thecapabilitiespointindirectly,notdirectly,totheobjectsC)alistofpointersismaintainedwitheachobjectthatpointtoallcapabilitiesassociatedwiththatobjectD)capabilitiesareperiodicallydeletedfromeachdomain80.Themostcommonmethodusedbyattackerstobreachsecurityis____.A)masqueradingB)messagemodificationC)sessionhijackingD)phishing81.Acodesegmentthatmisusesitsenvironmentiscalled____.A)abackdoorB)atrapdoorC)awormD)aTrojanhorse82.Worms____.A)usethespawnmechanismtoravagesystemperformanceB)canshutdownanentirenetworkC)continuetogrowastheInternetexpandsD)Alloftheabove83.Adenialofserviceattackis____.A)aimedatgaininginformationB)aimedatstealingresourcesC)aimedatdisruptinglegitimateuseofasystemD)generallynotnetworkbased84.Inapaired-passwordsystem,____.A)theuserspecifiestwopasswordsB)thecomputersuppliesonepartofapasswordandtheuserenterstheotherpartC)passwordsmustcontainequalamountsofnumbersanddigitspairedtogetherD)twousersmustentertheirownseparatepasswordtogainaccesstothesystem85.A____viruschangeseachtimeitisinstalledtoavoiddetectionbyantivirussoftware.A)polymorphicB)tunnelingC)multipartiteD)stealth86.____isasymmetricstreamcipher.A)DES
14
B)AESC)RC4D)twofish87.Inavirtualmachine,eachprogrambelievesthatithas____.A)multipleprocessorsB)itsownmemoryC)another"virtual"computertoassistinitsoperationsD)morememorythanisphysicallyavailableonthemachine88.____isapopularcommercialapplicationthatabstractsIntel80XXx86hardwareintoisolatedvirtualmachines.A).NETB)JITC)JVMD)VMware89._____isnotanexampleofabenefitofvirtualmachines.A)TheabilitytorunseveraldifferentoperatingsystemsthatallsharethesamehardwareB)TheabilitytoconcurrentlyrunseveraldifferentoperatingsystemsC)UseslessphysicalmemorythananactualoperatingsystemD)Protectsthehostsystemfromguestoperatingsystems90.______tricksanapplicationbyhavingitthinkitistheonlyprocessonthesystem.A)ParavirtualizationB)SimulationC)TheJavavirtualmachineD)The.NETframework91._________allowsavirtualmachinetobehaveasifitisactinginkernelmode.A)ParavirtualizationB)LivemigrationC)Trap-and-emulateD)TheJavavirtualmachine92.Microsoft.NETandtheJavavirtualmachineareexamplesof__________.A)ParavirtualizationB)ProgrammingenvironmentvirtualizationC)EmulatorsD)Type0hypervisors93.WhichofthefollowingstatementsregardingavirtualCPU(VCPU)isconsideredfalse?A)TheVCPUdoesnotexecutecode.B)ItrepresentsthestateofthephysicalCPU.
15
C)EachguestsharestheVCPU.D)TheVCPUisfoundinmostvirtualizationoptions.94.Inadistributedsystem,a____usuallyindicatesthelocationofamachine.A)nodeB)hostC)siteD)resource95.____involvesthemovementofjobsfromonesitetoanothertodistributeprocessingmoreevenlyacrossthenetwork.A)ComputermigrationB)LoadsharingC)ResourcesharingD)Downsizing96.Thesftp___commandtransfersafilefromtheremotemachinetothelocalmachine.A)copyB)putC)getD)cd97.Whichofthefollowingroutingschemescannotadapttolinkfailuresorloadchanges?A)virtualroutingB)fixedroutingC)dynamicloadingD)Alloftheabove98.Whichofthefollowingconnectionstrategiesinvolvesbreakingupamessageintoanumberofpacketsthatmustbereassembleduponarrival?A)messageswitchingB)packetswitchingC)circuitswitchingD)processswitching99.WhichofthefollowinglayersofacommunicationsnetworkintheOSIprotocolisusedtohandleframes,orfixed-lengthpartsofpackets?A)networklayerB)physicallayerC)data-linklayerD)transportlayer100.Whichofthefollowingisnotconsideredabenefitofprocessmigration?A)Loadbalancing
16
B)SoftwareneutralityC)HardwarepreferenceD)Computationspeedup
17
CMPS501–ProgrammingLanguages
1. Whichofthefollowingareobjectorientedlanguages?a. Javab. Cobolc. Cd. Allofabovee. Noneofabove
2. Inprogramming,aseriesoflogicallyorderedstepsthatleadtoarequiredresultiscalleda. Acompilerb. Aprogramc. Adatastructured. Analgorithm
3. WhichisatypicallanguageforprogramminginsideWebpages?a. javaScriptb. HTMLc. Cobold. XML
4. Whichofthefollowingconvertssourcecodeintomachinecodeateachruntime?a. Linkerb. Compilerc. Interpreterd. Objetencoder
5. Whichofthefollowingcommonlyhappenstovariables(inmostlanguages)?a. Expansionb. Derivationc. Assignmentd. Allofabovee. Noneofabove
6. Assumingthat+and*arearithmeticoperators(additionandmultiplication),towhatdoestheexpression2+4*5+1evaluate?
a. 36b. 31c. 26d. 23
7. Assumingthat=and/aretheassignmentanddivisionoperators,whatwillbetheoutcomeofthefollowingcodeinmostprogramminglanguages:
a. Syntaxerrorb. Runtimeerrorc. Logicerrord. Compilererror
8. Whichisatypicalkindofvariableforkeepinganorderedsetofvaluesinmemory,thatcanbereferencedase.g.A[3],A[n+1]etc.?
a. File
18
b. Stringc. Arrayd. container
9. AND,ORandNOTarelogicaloperators.Whatdatatypeisexpectedfortheiroperands?a. Integerb. Booleanc. Decimald. Character
10. Inmanyprogramminglanguages,‘otherwise’and‘else’arepartofwhichbuildingblock?a. Loopb. Counterc. Selectiond. Liststructure
11. Whatbuildingblockdoesthefollowingdiagramrepresent?whilex<10 printx x=x+1
a. Sequenceb. Selectionc. Functiond. Iteration
12. Whichisaworkingsolutionforproducingthefollowingoutput:1491625?
a. Ab. Bc. Cd. D
13. Thefollowingisatypicalpatternforreadingandprocessingdatafromasequentialfile.Whatishiddenbehindthequestionmarks?
19
a. whilenotEOFb. ifcount=endc. countuntilendd. Noneofabove
14. (Inmostprogramminglanguages),whichstatementwouldbeusedinthedefinitionofafunction,toindicatetheresultingvaluewhenthisfunctioniscalled?
a. result=xb. replyxc. sendxd. returnx
15. ‘Tracing’,‘stepping’and‘breakpoint’aretypicaltermsbelongingtowhichprogrammingdevelopmentaspect?
a. projectplanningb. compilationc. debuggingd. versioncontrol
16. Whichtermdescribesthemechanismofafunctioncallingitself?a. encapsulationb. recursionc. inheritanced. polymorphism
17. Whatistheonlylanguagethatacomputerunderstandsdirectly?a. English,asspokeninBoston,Mass.b. BASICtheBeginners’All-purposeSymbolicInstructionCodec. machinelanguage,differentforeverytypeofCPUd. noneofabove
18. Whatarethethreemaintypesofcomputerprogramminglanguages?a. Machinelanguage,assemblylanguage,highlevellanguageb. Imperativelanguage,functionallanguage,declarativelanguagec. COBOL,Fortran-77,C++d. Noneofabove
19. Fromthepointofviewoftheprogrammerwhatarethemajoradvantagesofusingahigh-levellanguageratherthaninternalmachinecodeorassemblerlanguage?
20
a. Efficiencyb. Programportabilityc. Easydevelopmentd. Noneofabove
20. Aliasinginthecontextofprogramminglanguagesreferstoa. multiplevariableshavingthesamememorylocationb. multiplevariableshavingthesamevaluec. multiplevariableshavingthesameidentifierd. multipleusesofthesamevariable
21. WhatisprintedbytheprintstatementsintheprogramP1assumingcallbyvalueparameterpassing?
ProgramPl(){x=10;y=3;func1(y,x,x);printx;printy;}func1(x,y,z){y=y+4;z=x+y+z;}
a. 10,3b. 31,3c. 27,7d. Noneoftheabove
22. Considerthefollowingprogram
ProgramP2varn:int:procedureW(varx:int)beginx=x+1;printx;endprocedureDbeginvarn:int;n=3;
21
W(n);endbegin//beginP2n=10;D;endIfthelanguagehasdynamicscopingandparametersarepassedbyreference,whatwillbeprintedbytheprogram?
a. 10b. 11c. 3d. Noneoftheabove
23. The-resultsreturnedbyfunctionsundervalue-resultandreferenceparameterpassingconventions
a. Donotdifferb. Differinthepresenceofloopsc. Differinallcasesd. Maydifferinthepresenceofexceptions
24. WhatisprintedbytheprintstatementsintheprogramP1assumingcallbyvalueparameterpassing?
ProgramPl(){x=10;y=3;func1(y,x);printx;printy;}func1(x,y){y=y+4;x=2*x+y;}
a. 10,3b. 14,20c. 4,4d. Noneoftheabove
25. WhatisprintedbytheprintstatementsintheprogramP1assumingcallbyreferenceparameterpassing?
ProgramPl(){
22
x=10;y=3;func1(y,x);printx;printy;}func1(x,y){y=y+4;x=2*x+y;}
a. 10,3b. 14,20c. 4,4d. Noneoftheabove
26. WhatisprintedbytheprintstatementsintheprogramP1assumingcallbyresultparameterpassing?
ProgramPl(){x=10;y=3;func1(y,x);printx;printy;}func1(x,y){y=y+4;x=2*x+y;}
a. 10,3b. 14,20c. 4,4d. Noneoftheabove
27. WhatisprintedbytheprintstatementsintheprogramP1assumingcallbyvalue-resultparameterpassing?
ProgramPl(){x=10;y=3;func1(y,x);printx;
23
printy;}func1(x,y){y=y+4;x=2*x+y;}
a. 10,3b. 14,20c. 4,4d. Noneoftheabove
28. WhatisprintedbytheprintstatementsintheprogramP1assumingcallbynameparameterpassing?
ProgramPl(){x=10;y=3;func1(y,x);printx;printy;}func1(x,y){y=y+4;x=2*x+y;}
a. 10,3b. 14,20c. 4,4d. Noneoftheabove
29. Whichfollowingterm(s)isnotaPLprogrammingparadigm?a. Imperativeb. Functionalc. Logicald. hierarchical
30. Whichfeature(s)isnotamistakemadebyapastPL?a. Spacesinvariablenamesb. Non-reservedkeywordsc. Callbreferenced. 2-digitrepresentationofyear
31. WhatisthefullformofLISP?a. LightProcessingb. ListProcessing
24
c. LikeProcessingd. Noneoftheabove
32. Whatistheoutputofthefollowingstatement?(CAR‘(PHW))
a. Pb. Hc. Wd. PHW
33. Whatistheoutputofthefollowingstatement?(CADAR‘((ab)(cd)))
a. ab. bc. cd. d
34. Whatistheoutputofthefollowingstatement?(cdr‘(abc))
a. ab. bc. (bc)d. Noneoftheabove
35. Whichallowprocedurestousethemselvesagain?a. Recursionb. Reusec. Reinitiated. Noneoftheabove
36. Theleftsideofanassignmentstatementwillhold:a. avariableb. anobjectpropertyc. anexpressiond. Bothaandbe. Alloftheabove
37. Therightsideofanassignmentstatementwillhold:a. avariableb. anobjectpropertyc. anexpressiond. Bothaandbe. Alloftheabove
38. Whatisaprocedurethatreturnsavaluethatsignalstrueorfalse?a. Listb. Predicatesc. Datad. Noneoftheabove
39. Whatistheoutputofthegivenstatement?(equal(+22)3)
25
a. Tb. NILc. Fd. Bothb&c
40. Whichnotationfacilitatesuniformityinlisp?a. Prefixb. Postfixc. Infixd. Noneoftheabove
41. Whichisaproceduressuppliedbyuserintermsofprimitives?a. Customb. User-definedc. Definited. Alloftheabove
42. Whatistheoutputofthefollowingstatement?(+3.142.71)
a. 3.14b. 2.71c. 5.85d. Noneoftheabove
43. Whatistheoutputofthegivenstatement?(progn(setfa‘x)(setfb‘y)(Setfc‘z))
a. Xb. Yc. Zd. XYZ
44. Whatistheoutputofthegivenstatement?(setfprecious‘(time)‘(Timeisprecious)
a. Timeispreciousb. Timeistimec. Timed. Noneoftheabove
45. WhichofthefollowingSchemeexpressionswouldbeinterpretedasfalsewhenevaluated:
a. NILb. –1c. (CAR‘(01))d. ‘()e. noneoftheabove
46. Whichofthefollowingisnotconsideredafunctionalprogramminglanguage?a. MLb. Haskellc. Smalltalk
26
d. Schemee. Lisp
47. ThemainprogramminglanguageusedinthefieldofNumericalAnalysisis:a. Javab. Haskellc. Fortrand. Assembler
48. AprogramminglanguageusedheavilyinthefieldofArtificialIntelligenceis:a. Snobolb. Lispc. Fortrand. C++
49. WhichoftheprogrammingstylesortechniquesisleastwellsupportedbyScheme?a. Functionalprogrammingb. Imperativeprogrammingc. Objectorientedprogrammingd. Recursiveprogramming
50. Whichofthefollowingisnotapplicationssoftware?a. Wordprocessingb. Spreadsheetc. UNIXd. Desktoppublishing
51. ConsiderthegrammarS->ABSC/AbcBA->ABBb->bbAb->abAa->aaWhichofthefollowingsentencescanbegeneratedbythisgrammar?
a. abcb. aabc. abccd. abbc
52. Themostwidelyusedlogicprogramminglanguageisa. BASICb. COBOLc. PROLOGd. LOGO
53. (cons’a’(bcd))generatesa. bcdab. abcdc. (bcda)d. (abcd)
54. (cons(2)(345))generates
27
a. 2345b. (2345)c. (2)345d. ((2)345)
55. (append’(bc)’(ef))evaluatestoa. bcefb. (bcef)c. bc(ef)d. ((bc)ef)
56. (cdr'(abcdef))evaluatestoa. ab. bcdefc. fd. (bcdef)
57. (car'(abcdef))evaluatestoa. ab. bcdefc. fd. (bcdef)
58. (list'a'(bc)'(ef))evaluatestoa. abcefb. (a(bc)(ef))c. (abcef)d. ((a)(bc)(ef))
59. (cadadr'(a(cd)(efg)))returnsa. Ab. Cc. Dd. Ee. G
60. (caar(list(list'a'b)'c))returnsa. Ab. Bc. Cd. ABC
61. (cadr(list(list12)(list34)))returnsa. 12b. (12)c. 34d. (34)
62. Whichofthefollowingistrueofaliases?a. Analiaschangesthenameofsomethingb. Analiasprotectsanexistingvaluefrombeingoverwrittenc. Analiasprovidesanalternativewayofaccessingsomething
28
d. Analiasallowstypeinferencee. Aliasesshouldbeavoidedifatallpossible
63. Whathappensinanassignmentsuchas``x:=y''?a. Theaddressofxismodifiedtobetheaddressofyb. Theaddressofyismodifiedtobetheaddressofxc. xandybecomealiasesd. Theobjectboundtoyiscopiedandboundtox,andanypreviousbindingofxto
anobjectislost64. Whichofthefollowingistrueofl-valuesandr-vlaues?
a. Anl-valueisalogicalvalue,andanr-valueisarealvalueb. l-valuesarealwaystotheleftofr-valuesc. Anl-valuereferstoavariable’slocationwhileanr-valuetoitscurrentvalued. L-valuesarelocalandr-valuesarerelative
65. Whichoftheselanguagesdoesnothaveaprimitivedatatypeforacharacterstring:a. CommonLispb. Pascalc. Adad. Java
66. Whatdistinguishesapurely``functional''programminglanguagefroman``imperative''one?
a. Therearenovariablesandhencenoassignmentoperationinapurelyfunctionallanguage
b. Apurelyfunctionallanguagelacksthe``goto''statement,butanimperativelanguagealwayshassuchacommand
c. Allsubprogramsmustbedeclaredwiththekeywordfunctioninapurelyfunctionallanguage
d. Thereisnorealdifference,onlyadifferenceintherecommendedcodingstyle67. Prologisastronglytypedlanguage.
a. Trueb. False
68. ThescopeofavariableinPrologisasingleclause(i.e.,afactorrule)orasinglequery.a. Trueb. False
69. OneofPrologstrengthsisitsuseoffuzzylogic.a. Trueb. False
70. TermsaretoPrologass-expressionsaretoLisp.a. Trueb. False
71. TheemptylistinPrologisrepresentedbytheatomicsymbolNIL.a. Trueb. False
72. AvariableinPrologmuststartwitheitheranupper-caseletteroranunderscore(_).a. True
29
b. False73. AlllocalvariablesmustbedeclaredbeforetheyareusedinProlog.
a. Trueb. False
74. APrologvariablecanonlybeassignedtoavalueonce.a. Trueb. False
75. Inprolog,hasTelephone(mutte).isaa. Factb. Rulec. Queryd. Noneoftheabove
76. Inprolog,eavesdrops(X,Y):-controls(X,nsa),hasTelephone(Y),usesTelephone(Y).isaa. Factb. Rulec. Queryd. Noneoftheabove
77. Inprolog,?-k(Y).isaa. Factb. Rulec. Queryd. Noneoftheabove
78. Inprolog,?-jealous(X,Y).isaa. Factb. Rulec. Queryd. Noneoftheabove
79. Inprolog,loves(Vincent,mia).isaa. Factb. Rulec. Queryd. Noneoftheabove
80. Inprolog,jealous(A,B):-loves(A,C),loves(B,C).isaa. Factb. Rulec. Queryd. Noneoftheabove
81. TheremaybemanysolutionstoaPrologquery.a. Trueb. False
82. GiventhefollowingsetofPrologclausesfather(X,Y):-parent(X,Y),male(X).parent(sally,bob).parent(jim,bob).
30
parent(alice,jane),parent(thomas,jane).male(bob).male(jim).male(thomas).female(sally).female(alice).HowmanyatomsarematchedtothevariableXbeforethequeryfather(X,jane)reportsaresult?
a. 1b. 2c. 3d. 4
83. GiventhefollowingsetofPrologclausesfather(X,Y):-parent(X,Y),male(X).parent(sally,bob).parent(jim,bob).parent(alice,jane),parent(thomas,jane).male(bob).male(jim).male(thomas).female(sally).female(alice).WhatwillthevariableXbeboundwithwhenthequeryfather(X,jane)reportsaresult?
a. Bobb. Jimc. Thomasd. jane
84. Inlogicprogramming,theprogramdeclaresthegoalsofthecomputations,notthemethodforachievingthem
a. Trueb. False
85. ForthePROLOGgoal?[[X,Y],Z|R]=[[a,b],[1,2],[c,d]].Whichbindingapply?
a. X=aY=bZ=[1,2]R=[[c,d]]b. none,becausethegoalfailc. X=aY=bZ=1R=[2,c,d]d. X=aY=bZ=[c,d]R=[c,d]
86. Incaseofargumentspassedbyvalueswhencallingafunctionsuchasz=addidion(x,y),a. Anymodificationstothevariablesx&yfrominsidethefunctionwillnothave
anyeffectoutsidethefunction.
31
b. Thevariablesxandywillbeupdatedwhenanymodificationisdoneinthefunction
c. Thevariablesxandyarepassedtothefunctionadditiond. Noneofabovearevalid
87. Incaseofpassbyreference,a. Thevaluesofthosevariablesarepassedtothefunctionsothatitcanmanipulate
themb. Thelocationofvariableinmemoryispassedtothefunctionsothatitcanuse
thesamememoryareaforitsprocessingc. Bothaandcd. Noneofaandb
88. Afunctionmayonlybecalledatoneplaceinaprogram.a. Trueb. False
89. Informationcanbepassedintoafunctionthroughparameters.a. Tureb. False
90. InLisp,(+83)returnsa. 8b. 3c. 83d. 11
91. InLisp,(1234)returnsa. 1b. 2c. 3d. 4e. Error
92. InScheme,(CAR'((IHATE)(PEANUTBUTTER)(ANDJELLY)))returnsa. IHATEb. (IHATE)c. Id. HATEe. NONEOFTHEABOVE
93. (CAR(CDR'(SANDWITCH)))returnsa. SANDb. (SAND)c. WITCHd. (WITCH)
94. Giventhefollowingcode, inta; procedurefoo(intx){ x=x+10; a=a+x;
32
} procedurefie(){ a=5; foo(a); print(a); } Whatwillbeprintedoutifcallbyvalueisused?
a. 10b. 15c. 20d. 30e. Noneoftheabove
95. Giventhefollowingcode, inta; procedurefoo(intx){ x=x+10; a=a+x; } procedurefie(){ a=5; foo(a); print(a); } Whatwillbeprintedoutifcallbyresultisused?
a. 10b. 15c. 20d. 30e. Noneoftheabove
96. Giventhefollowingcode, inta; procedurefoo(intx){ x=x+10; a=a+x; } procedurefie(){ a=5; foo(a); print(a); } Whatwillbeprintedoutifcallbyvalue-resultisused?
a. 10b. 15c. 20
33
d. 30e. Noneoftheabove
97. Giventhefollowingcode, inta; procedurefoo(intx){ x=x+10; a=a+x; } procedurefie(){ a=5; foo(a); print(a); } Whatwillbeprintedoutifcallbyreferenceisused?
a. 10b. 15c. 20d. 30e. Noneoftheabove
98. Giventhefollowingcode, inta; procedurefoo(intx){ x=x+10; a=a+x; } procedurefie(){ a=5; foo(a); print(a); } Whatwillbeprintedoutifcallbynameisused?
a. 10b. 15c. 20d. 30e. Noneoftheabove
99. Whichvariablehasthelongestscope? #includeintb;intmain(){intc;return0;}
34
inta;a. ab. bc. cd. Bothaandb
100. Whatistheprogrammingstyleoftheobjectorientedconceptualmodel?a. Invariantrelationshipsb. Algorithmsc. Classesandobjectsd. Goals,oftenexpressedinapredicatecalculus.
35
CMPS502ComputerOrganization
1. Adesktopcomputerisdesignedforusebyanindividual,usuallyincorporatingagraphicsdisplay,akeyboard,andamouse.
A. TrueB. False
2. Aservercomputerisusedforrunninglargerprogramsformultipleusers,often
simultaneouslyandtypicallyaccessedonlyviaanetwork.A. TrueB. False
3. Supercomputerisaclassofcomputerswiththehighestperformanceandcost;theyare
configuredasserversandtypicallycostmillionsofdollars.A. TrueB. False
4. Datacenterisaroomorbuildingdesignedtohandlethepower,cooling,andnetworkingneedsoflargenumberofservers.
A. TrueB. False
5. Embeddedcomputersarethelargestclassofcomputersandspanthewidestrangeof
applicationsandperformance.A. TrueB. False
6. Aprogramthattranslateshigh-levellanguagestatementsintoassemblylanguage
statementsiscalledA. AssemblerB. CompilerC. InterpreterD. Translator
7. Aprogramthattranslatessymbolicversionofinstructionsintothebinaryversionis
calledA. AssemblerB. CompilerC. Interpreter
36
D. Translator
8. AbinaryrepresentationofmachineinstructionsiscalledA. AssemblylanguageB. MachinelanguageC. High-levellanguageD. Clanguage
9. Asymbolicrepresentationofmachinelanguageiscalled
A. AssemblylanguageB. MachinelanguageC. High-levellanguageD. Clanguage
10. Acommandthatcomputerhardwareunderstandsandobeysiscalled
A. LogicB. LanguageC. InstructionD. Translator
11. Amechanismthroughwhichthecomputerisfedinformation,suchasthekeyboardor
mouseiscalledA. OutputdeviceB. InputdeviceC. I/OdeviceD. Memory
12. Amechanismthatconveystheresultofacomputationtoauseroranothercomputeris
knownasA. OutputdeviceB. InputdeviceC. I/OdeviceD. Networking
13. Atransistorissimplyanon/offswitchcontrolledbyelectricity.
A. TrueB. False
37
14. Anintegratedcircuit(IC)combineddozenstohundredsoftransistorsintoasinglechip.A. TrueB. False
15. GordonMoore’slawstatesthatnumberoftransistors(i.e.,transistorcapacity)inan
integratedcircuitdoublesinevery18-24months.A. TrueB. False
16. Theactivepartofthecomputer,whichcontainsthedatapathandcontrol,andwhich
addsnumbers,testnumbers,signalsI/OdevicestoactivateisknownasA. CPU(CentralProcessingUnit)B. MemoryhierarchyC. I/OdevicesD. Motherboard
17. Aplasticboardcontainingpackagesofintegratedcircuitsorchips,includingprocessor,
cache,memory,andconnectionsforI/OdevicessuchasnetworksanddisksisknownasA. CPUB. MemoryhierarchyC. I/OdevicesD. Motherboard
18. Thestorageareainwhichprogramsarekeptwhentheyarerunningandthatcontains
thedataneededbytherunningprogramsiscalledA. CPUB. MotherboardC. IntegratedcircuitsD. Memory
19. SRAM(staticrandomaccessmemory)isfasterbutlessdense,andhencemore
expensivethanDRAM(dynamicrandomaccessmemory).A. TrueB. False
20. Magnetictapeisasequentialaccessmemory.
A. TureB. False
38
21. InDRAM(dynamicrandomaccessmemory),memoryaccesstakebasicallythesame
amountoftimenomatterwhatportionofthememoryisread.A. TrueB. False
22. DRAM(dynamicrandomaccessmemory)isavolatilestoragethatcontainsdataonlyifit
isreceivingpower.A. TrueB. False
23. Magneticdiskisanonvolatilememorybecauseitretainsdataevenintheabsenceof
powersourceanditisusedtostoreprogramsbetweenruns.A. TrueB. False
24. Amemorythatisusedtoholdprogramswhiletheyarerunningisknownas
A. SlowmemoryB. NonvolatilememoryC. MainmemoryD. Secondarymemory
25. Anonvolatilememory(eg.,magneticdisk)usedtostoreprogramsanddatabetween
runsisknownasA. SlowmemoryB. NonvolatilememoryC. MainmemoryD. Secondarymemory
26. Flashmemoryisanonvolatilesemiconductormemory,whichischeaperandslower
thanDRAM.A. TrueB. False
27. Flashmemoryismoreexpensiveandfasterthanmagneticdisksmemory.
A. TrueB. False
39
28. Therelationshipbetweenperformanceandexecutiontimecanbedefinedas:A. Performance=1/(Executiontime)B. Performance=ExecutiontimeC. Performance=2/(Executiontime)D. Performance=2x(Executiontime)
29. IftheperformanceofcomputerXisgreaterthantheperformanceofcomputerY,we
canwrite:A. ExecutiontimeofcomputerX>ExecutiontimeofYB. ExecutiontimeofcomputerX=3x(ExecutiontimeofY)C. ExecutiontimeofcomputerX=1/(ExecutiontimeofY)D. ExecutiontimeofcomputerY>ExecutiontimeofX
30. IfcomputerArunsaprogramin10secondsandcomputerBrunsthesameprogramin
15seconds,howmuchfasterisAthanB?A. 1.5B. 2C. 3D. 3.5
31. TheCPUexecutiontimecanbeexpressedas
A. CPUexecutiontimeforaprogram=(CPUclockcycleforaprogram)/(Clockcycletime)
B. CPUexecutiontimeforaprogram=(CPUclockcycleforaprogram)x(Clockrate)C. CPUexecutiontimeforaprogram=(CPUclockcycleforaprogram)x(Clock
cycletime)D. CPUexecutiontimeforaprogram=(CPUclockcycleforaprogram)x1/(Clock
cycletime)
32. TheexecutiontimeoftheprogramaftermakingtheimprovementisgivenbythefollowingsimpleequationknownasAmdahl’slaw:
A. Executiontimeafterimprovement=(Executiontimeaffectedbyimprovement)/(Amountofimprovement)+Executiontimeunaffected
B. Executiontimeafterimprovement=(Executiontimeunaffected)/(Amountofimprovement)+Executiontimeaffectedbyimprovement
C. Executiontimeafterimprovement=(Amountofimprovement)/(Executiontimeunaffected)+Executiontimeaffectedbyimprovement
40
D. Executiontimeafterimprovement=(Executiontimeunaffected)/(Executiontimeaffectedbyimprovement)+Amountofimprovement
33. Supposeaprogramrunsin100secondsonacomputer,withmultiplyoperations
responsiblefor80secondsofthistime.HowmuchdoIhavetoimprovethespeedofmultiplicationifIwantmyprogramtorunfivetimesfaster?(UseAmdahl’slaw).
A. 50%B. 10%C. ImpossibleD. 5%
34. Averagenumberofclockcyclesprinstructionforaprogramorprogramfragmentis
knowsasA. ClockcyclesB. InstructioncountC. Clockcyclesperinstruction(CPI)D. Clockperiod
35. Thenumberofclockcyclesrequiredforaprogramcanbewrittenas
A. CPUclockcycles=(Instructionsforaprogram)x(Averageclockcyclesperinstruction)
B. CPUclockcycles=(Instructionsforaprogram)x(Numberofclockcyclesperinstruction)
C. CPUclockcycles=(Instructionsforaprogram)x(Totalclockcycles)D. CPUclockcycles=(Instructionsforaprogram)x(Totalclockcyclesper
instruction)
36. TheclassicCPUperformanceequationiswrittenasA. Instructioncount=(CPUtime)x(CPI)x(Clockcycletime)B. Clockcycletime=(Instructioncount)x(CPI)x(CPUtime)C. CPI=(Instructioncount)x(CPUtime)x(Clockcycletime)D. CPUtime=(Instructioncount)x(CPI)x(Clockcycletime)
37. TheclassicCPUperformanceequationiswrittenas
A. CPUtime=(Instructioncount)x(CPI)/(Clockrate)B. CPUtime=(Instructioncount)x(Clockrate)/(CPI)C. CPUtime=(CPI)x(Clockrate)/(Instructioncount)D. CPUtime=(CPI)/(Clockrate)x(Instructioncount)
41
38. Acompilerdesigneristryingtodecidebetweentwocodesequencesforaparticular
computer.Thehardwaredesignershavesuppliedthefollowingfacts:CPIforR-typeinstructionis1,CPIforI-typeinstructionis2,andCPIforJ-typeinstructionis3.Thetwosequenceshavethefollowinginstructioncounts:
Codesequence1:R-type(2),I-type(1),J-type(2) Codesequence2:R-type(4),I-type(1),J-type(1) Howmanyinstructionscodesequence1executes?
A. 2B. 3C. 4D. 5
39. Acompilerdesigneristryingtodecidebetweentwocodesequencesforaparticular
computer.Thehardwaredesignershavesuppliedthefollowingfacts:CPIforR-typeinstructionis1,CPIforI-typeinstructionis2,andCPIforJ-typeinstructionis3.Thetwosequenceshavethefollowinginstructioncounts:
Codesequence1:R-type(2),I-type(1),J-type(2) Codesequence2:R-type(4),I-type(1),J-type(1) Howmanyinstructionscodesequence2executes?
A. 3B. 4C. 5D. 6
40. Acompilerdesigneristryingtodecidebetweentwocodesequencesforaparticular
computer.Thehardwaredesignershavesuppliedthefollowingfacts:CPIforR-typeinstructionis1,CPIforI-typeinstructionis2,andCPIforJ-typeinstructionis3.Thetwosequenceshavethefollowinginstructioncounts:
Codesequence1:R-type(2),I-type(1),J-type(2) Codesequence2:R-type(4),I-type(1),J-type(1) Whichcodesequenceexecutesmoreinstructions?
A. Codesequence1B. Codesequence2C. Bothcodesequencesexecutesamenumberofinstructions
42
41. Acompilerdesigneristryingtodecidebetweentwocodesequencesforaparticular
computer.Thehardwaredesignershavesuppliedthefollowingfacts:CPIforR-typeinstructionis1,CPIforI-typeinstructionis2,andCPIforJ-typeinstructionis3.Thetwosequenceshavethefollowinginstructioncounts:
Codesequence1:R-type(2),I-type(1),J-type(2) Codesequence2:R-type(4),I-type(1),J-type(1) Howmanyclockcyclesarerequiredforcodesequence1?
A. 6B. 9C. 10D. 12
42. Acompilerdesigneristryingtodecidebetweentwocodesequencesforaparticular
computer.Thehardwaredesignershavesuppliedthefollowingfacts:CPIforR-typeinstructionis1,CPIforI-typeinstructionis2,andCPIforJ-typeinstructionis3.Thetwosequenceshavethefollowinginstructioncounts:
Codesequence1:R-type(2),I-type(1),J-type(2) Codesequence2:R-type(4),I-type(1),J-type(1) Howmanyclockcyclesarerequiredforcodesequence2?
A. 6B. 9C. 10D. 12
43. Acompilerdesigneristryingtodecidebetweentwocodesequencesforaparticular
computer.Thehardwaredesignershavesuppliedthefollowingfacts:CPIforR-typeinstructionis1,CPIforI-typeinstructionis2,andCPIforJ-typeinstructionis3.Thetwosequenceshavethefollowinginstructioncounts:
Codesequence1:R-type(2),I-type(1),J-type(2) Codesequence2:R-type(4),I-type(1),J-type(1) Whichcodesequenceneedsmoreclockcycles?
A. Codesequence2B. Codesequence1C. Bothcodesequencesneedsameamountofclockcycles
43
44. Acompilerdesigneristryingtodecidebetweentwocodesequencesforaparticular
computer.Thehardwaredesignershavesuppliedthefollowingfacts:CPIforR-typeinstructionis1,CPIforI-typeinstructionis2,andCPIforJ-typeinstructionis3.Thetwosequenceshavethefollowinginstructioncounts:
Codesequence1:R-type(2),I-type(1),J-type(2) Codesequence2:R-type(4),I-type(1),J-type(1) Whichcodesequenceisfaster?
A. Codesequence1B. Codesequence2
45. Acompilerdesigneristryingtodecidebetweentwocodesequencesforaparticular
computer.Thehardwaredesignershavesuppliedthefollowingfacts:CPIforR-typeinstructionis1,CPIforI-typeinstructionis2,andCPIforJ-typeinstructionis3.Thetwosequenceshavethefollowinginstructioncounts:
Codesequence1:R-type(2),I-type(1),J-type(2) Codesequence2:R-type(4),I-type(1),J-type(1) WhatistheCPIforcodesequence1?
A. 1B. 1.5C. 2.0D. 2.5
46. Acompilerdesigneristryingtodecidebetweentwocodesequencesforaparticular
computer.Thehardwaredesignershavesuppliedthefollowingfacts:CPIforR-typeinstructionis1,CPIforI-typeinstructionis2,andCPIforJ-typeinstructionis3.Thetwosequenceshavethefollowinginstructioncounts:
Codesequence1:R-type(2),I-type(1),J-type(2) Codesequence2:R-type(4),I-type(1),J-type(1) WhatistheCPIforcodesequence2?
A. 1B. 1.5C. 2.0D. 2.5
44
47. TheMIPSprocessorparadigmwascreatedatStanfordUniversitybyA. J.L.HennessyB. D.PattersonC. G.MooreD. A.Tour
48. MIPSstandsfor
A. MIllionsofInstructionProcessingperSecondB. MicroprocessorwithoutInterlockedPipelineStagesC. MicroprocessorInstructionProcessingStyleD. MillionsInstructionsProgramSet
49. MIPSisa
A. RISCprocessorB. CISCprocessor
50. MIPSR2000hashowmanytemporaryregisters?
A. 10B. 30C. 32D. 4
51. MIPSR2000registersare______inlength.
A. 32bitsB. 16bitsC. 64bitsD. 8bits
52. Registernumberzeroisareservedregister.
A. TrueB. False
53. Ifyouwanttoexittheprogram,v0registermustbeloadedwith
A. 10B. 7C. 5D. 0
45
54. Ifyouwanttoreadanintegervaluefromconsole,v0registermustbeloadedwithA. 10B. 7C. 5D. 0
55. Ifyouwanttoprintastring,v0registermustbeloadedwith4A. TrueB. False
56. Whatisthemeaningoftheinstructionbne$s1,$s2,25?A. If($s2>=25)$s1=1;else$s1=0B. If($s1>=$s2)$s1=1;else$s1=0C. If($s2>=$s3)$s1=1;else$s1=0D. If($s1!=$s2)gotoPC+4+100
57. Whatisthemeaningoftheinstructionslt$s1,$s2,$s3?
A. If($s2>=$s3)$s1=1;else$s1=0B. If($s2=20)$s1=1;else$s1=0B. If($s2=20)$s1=1;else$s1=0B. If($s2>10B. $s2=$s1>>10C. $s1=$s2
46
61. Whatisthemeaningoftheinstructionsll$s1,$s2,10?A. $s1=$s210D. $s2=$s1>>10
62. Whatisthemeaningoftheinstructionsw$s1,20($s2)?
A. $s2=Memory[$s1+20]B. $s1=Memory[$s2+20]C. Memory[$s1+20]=$s2D. Memory[$s2+20]=$s1
63. Whatisthemeaningoftheinstructionlw$s1,20($s2)?
A. $s2=Memory[$s1+20]B. $s1=Memory[$s2+20]C. Memory[$s1+20]=$s2D. Memory[$s2+20]=$s1
64. Whatisthemeaningoftheinstructionjal2500?
A. $ra=PC+4;goto2500x1=2500B. $ra=PC+4;goto2500x2=5000C. $ra=PC+4;goto2500x3=7500D. $ra=PC+4;goto2500x4=10000
65. Assumethatthevariablesfandgareassignedtoregisters$s0and$s1respectively.
AssumethatthebaseaddressofarrayAisinregister$s6.WhatistheCcodecorrespondingtothefollowingMIPScode?
lw$s0,16($s6) sub$s0,$0,$s0 sub$s0,$s0,$s1
A. f=-g-A[4]B. g=f-A[4]C. f=-g+A[16]D. f=-g-A[16]
47
66. Assumethatthevariablesiandjareassignedtoregisters$s3and$s4respectively.AssumethatthebaseaddressofarraysAandBareinregisters$s6and$s7,respectively.WhatistheMIPScodecorrespondingtothefollowingCcode? B[8]=A[4]+i-j
A. sub$t0,$s3,$s4
lw$t1,16($s6)add$t0,$t0,$t1sw$t0,32($s7)
B. sub$t0,$s3,$s4 lw$t1,16($s6)
add$t0,$t0,$t1sw$t1,32($s7)
C. sub$t1,$s3,$s4 lw$t1,16($s6)
add$t0,$t0,$t1sw$t0,32($s7)
D. sub$t0,$s3,$s4 lw$t1,16($s7)
add$t0,$t0,$t1sw$t0,32($s6)
67. Assumethatthevariablesf,g,h,iandjareassignedtoregisters$s0,$s1,$s2,$s3and
$s4respectively.AssumethatthebaseaddressofarraysAandBareinregisters$s6and$s7,respectively.WhatistheCcodecorrespondingtothefollowingMIPScode??
slli$s2,$s4,1add$s0,$s2,$s3add$s0,$s0,$s1j
A. f=2j+i+gB. g=2i+f+jC. i=4f+j+hD. f=4j+i+g
68. ConsiderthefollowingMIPSassemblylanguagecode:
.datamsg:.asciiz“HelloWorld\n”
48
.text .globlmain: li$v0,4 li$a0,msg syscall li$v0,10 syscallWhatwillbetheoutputoftheaboveprogram?
A. ThereisanerrorintheprogramandnooutputB. HelloWordC. “HelloWord”D. Nothing
69. ConsiderthefollowingMIPSassemblylanguagecode:
.datamsg:.asciiz“HelloWorld\n”msg1.asciiz“HelloClass\n”
.text .globlmain: li$v0,4 li$a0,msg li$a0,msg1 syscall li$v0,10 syscallWhatwillbetheoutputoftheaboveprogram?
A. ThereisanerrorintheprogramandnooutputB. HelloWordC. “HelloWord”D. HelloClass
49
70. Apipelinehazardsoccurswhenthepipeline,orsomeportionofthepipeline,muststallbecauseconditionsdonotpermitcontinuedexecution.
A. TrueB. False
71. A_____________hazardoccurswhentwo(ormore)instructionsthatarealreadyinthe
pipelineneedthesameresource.A. ResourceB. DataC. Control
72. A_____________hazardoccurswhenthereisaconflictintheaccessofanoperandlocation.
A. ResourceB. DataC. Control
73. A___________hazardoccurswhenthepipelinemakesthewrongdecisiononabranch
predictionandthereforebringsinstructionintothepipelinethatmustsubsequentlybediscarded.
A. ResourceB. DataC. Control
74. Inwhichofthefollowingdependency,aninstructionmodifiesaregisterormemory
locationandasucceedinginstructionreadsthedatainthatmemoryorregisterlocation?
A. ReadafterwriteB. WriteafterreadC. WriteafterwriteD. Readafterread
75. Inwhichofthefollowingdependency,aninstructionreadsaregisterormemory
locationandasucceedinginstructionwritestothelocation.A. ReadafterwriteB. WriteafterreadC. WriteafterwriteD. Readafterread
50
76. Inwhichofthefollowingdependency,twoinstructionsbothwritetothesamelocation.A. ReadafterwriteB. WriteafterreadC. WriteafterwriteD. Readafterread
77. Insuperscalarprocessor,out-of-orderissuepolicyisdonewithabufferreferredtoas
a(n)A. InstructionwindowB. ForwardmemoryC. InstructionlabelD. Forwardmemory
78. Insuperscalarprocessor,theterm“instructionissue”referstotheprocessofinitiating
instructionexecutionintheprocessor’s________________unit.A. FunctionalB. DecodingC. WritebackD. Fetch
79. Insuperscalarprocessor,theterm“instructionissuepolicy”referstotheprotocolused
toissueinstruction.A. TrueB. False
80. Insuperscalarprocessor,out-of-ordercompletionisusedinscalarRISCprocessorsto
improvetheperformanceofinstructionsthatrequiremultiplecycles.A. TrueB. False
81. Thesimplestinstructionissueandcompletionpolicyis
A. In-orderissueandin-ordercompletionB. In-orderissueandout-of-ordercompletionC. Out-of-orderissueandout-of-ordercompletionD. Out-of-orderissueandin-ordercompletion
82. OneofthecharacteristicsofReducedInstructionSetComputers(RISC)isoneinstruction
percycle.
51
A. FalseB. True
83. OneofthecharacteristicsofReducedInstructionSetComputers(RISC)isregisterto
registeroperations.A. TrueB. False
84. ReducedInstructionSetComputers(RISC)architecturehasmoreinstructionscompared
toComplexInstructionSetComputer(CISC)architecture.A. True B. False
85. Delayedbranch,awayofincreasingtheefficiencyofthepipeline,makesuseofabranch
thatdoesnottakeeffectuntilafterexecutionofthefollowinginstruction.A. TrueB. False
86. Instructionlevelparallelism(ILP)referstothedegreetowhich,onaverage,the
instructionsofaprogramcanbeexecutedinparallel.A. TrueB. False
87. Inregisterrenaming,registersareallocateddynamicallybytheprocessorhardware,and
theyareassociatedwiththevaluesneededbyinstructionsatvariouspointsintime.A. TrueB. False
88. Considerthefollowingcodesequencewithsuperscalarprocessor:
I1:R3:=R3opR5I2:R4:=R3+1I3:R3:=R5+1I4:R7:=R3opR4WhattypesofdependencyI2andI3have?
A. TruedatadependencyB. AntidependencyC. ResourceConflict
52
D. Outputdependency
89. Considerthefollowingcodesequencewithsuperscalarprocessor:I1:R3:=R3opR5I2:R4:=R3+1I3:R3:=R5+1I4:R7:=R3opR4WhattypesofdependencyI1andI3have?
A. TruedatadependencyB. AntidependencyC. ResourceConflictD. Outputdependency
90. Considerthefollowingcodesequencewithsuperscalarprocessor:
I1:R3:=R3opR5I2:R4:=R3+1I3:R3:=R5+1I4:R7:=R3opR4Whichofthefollowingmethodwillsolvethedependenciesintheabovecodesegment?
A. SpeculativeloadingB. PredictionC. ForwardingD. Registerrenaming
91. ConsiderthefollowingMIPSassemblylanguagecodesequence:
I1:add$s3,$s4,$s215I2:sub$s5,$s3,$s1I3:lw$s6,200($s3)I4:add$s7,$s3,$s6WhattypesofdependencyI1andI2have?
A. TruedatadependencyB. AntidependencyC. ResourceConflictD. Outputdependency
53
92. ConsiderthefollowingMIPSassemblylanguagecodesequence:I1:add$s3,$s4,$s2I2:sub$s5,$s3,$s1I3:lw$s6,200($s3)I4:add$s7,$s3,$s6WhattypesofdependencyI2andI3have?
A. TruedatadependencyB. ResourceConflictC. OutputdependencyD. NoDependency
93. ConsiderthefollowingMIPSassemblylanguagecodesequence:
I1:add$s3,$s4,$s2I2:sub$s5,$s3,$s1I3:lw$s6,200($s3)I4:add$s7,$s3,$s6WhattypesofdependencyI3andI4have?
A. TruedatadependencyB. AntidependencyC. ResourceConflictD. Outputdependency
94. ConsiderthefollowingMIPSassemblylanguagecodesequence:
I1:add$s3,$s4,$s2I2:sub$s5,$s3,$s1I3:lw$s6,200($s3)I4:add$s7,$s3,$s6Whichofthefollowingdependencywillcauseastall?
A. DependencybetweenI1&I2B. DependencybetweenI2&I3C. DependencybetweenI3&I4D. DependencybetweenI1&I3
95. ConsiderthefollowingMIPSassemblylanguagecodesequence:
I1:add$s3,$s4,$s2
54
I2:sub$s5,$s3,$s1I3:lw$s6,200($s3)I4:add$s7,$s3,$s6Whichofthefollowingdependencycanbesolvebyforwardingorbypassing?
A. DependencybetweenI1&I2B. DependencybetweenI2&I3C. DependencybetweenI3&I4D. DependencybetweenI1&I4
96. WhatarethefourexecutionunitsthatIA-64processorshave?
A. A-unit,B-unit,C-unit,D-unitB. I-unit,M-unit,B-unit,F-unitC. I-unit,C-unit,B-unit,F-unitD. I-unit,D-unit,B-unit,F-unit
97. WhatistheinstructionlengthofIA-64processors?
A. 32-bitB. 64-bitC. 128-bitD. 256-bit
98. WhatarethekeymechanismsofIA-64architecture?
A. Prediction,controlspeculation,dataspeculation,andsoftwarepipeliningB. Prediction,controlspeculation,dataspeculation,andhardwarepipeliningC. Prediction,addressspeculation,dataspeculation,andsoftwarepipeliningD. Predication,controlspeculation,dataspeculation,andsoftwarepipelining
99. _____________isatechniquesusedtooptimizeloopsinamannerthatparallels
hardwarepipelining.A. SoftwarepipeliningB. HardwarepipeliningC. ControlspeculationD. Dataspeculation
100. With_____________,allpossiblebranchpathsareexecuted,thecorrectoneis
keptandallotherarethrowaway.A. Softwarepipelining
55
B. BranchpredicationC. BranchpredictionD. Controlspeculation
56
CMPS512TheoryofComputing
1. Forthefollowingstatements:(1).IfSisafiniteset,|2s|=2|S|;(2).IfS1andS2arefinitesetswith|S1|=nand|S2|=m,then|S1US2|≤n+m;whichofthefollowingisright:(A).(1)isright.(B).(1)and(2)areright. (C).(2)isright.(D).Noneof(1)and(2)isright.
2. Whichofthefollowingstatementscanberight:(1).AgrammarGcanbeaquadruple(V,T,S,P)andtheproductionrulesaretheheartofagrammar.(2).Anautomatoncanhavethreecomponents:inputfile,controlunit,andstorage.(A).Only(1)isright. (B).Only(2)isright.(C).Both(1)and(2)areright.(D).Neither(1)nor(2)isright.
3. IfS={2,5,6,8}andT={2,4,6,8},then|SUT|+|S∩T|=(A).12.(B).9.(C).8.(D).7.
4. Whichofthefollowingstatementscanberight:(1).S1=S2isequivalenttoS1US2=S1∩S2;(2).IfS1andS2arefinitesets,then|S1×S2|=|S1||S2|.(A).(1)isright.(B).Both(1)and(2)areright.(C).(2)isright.(D).Noneof(1)and(2)isright.
5. Whichofthefollowingstatementscanberight:(1).Ifx=O(n4),y=O(n2),thenx/y=O(n2).(2).Ifx=Θ(n4),y=Θ(n2),thenx/y=Θ(n2).(A).Only(1)isright. (B).Only(2)isright.(C).Both(1)and(2)areright.(D).Neither(1)nor(2)isright.
6. Whichofthefollowingstatementscanberight:Iff(n)=O(n2),g(n)=O(n3),then(1).f(n)+g(n)=O(n3).(2).f(n)g(n)=O(n5).(A).Only(1)isright. (B).Only(2)isright.
57
(C).Both(1)and(2)areright.(D).(1)isrightand(2)iswrong.
7. Whichofthefollowingstatementsmaybetrue:(1).(wR)R=wforallw∈Σ*.(2).IfL={ab,aa,baa},thenthestringaaaabaaaaandbaaaaabaaareinL4.(A).Only(1)isright.(B).Only(2)isright.(C).Both(1)and(2)areright.(D).Noneoftheaboveisright.
8. Whichofthefollowingstatementsmaybetrue:(1).(L*)*=L*foralllanguagesL.(2).(LR)*=L*foralllanguagesL.(A).Only(1)isright.(B).Only(2)isright.(C).Both(1)and(2)areright.(D).Noneoftheaboveisright.
9. WhichofthefollowinglanguageisgeneratedbythegrammarwithproductionsSàaaA,AàbS,andSàλ:(A).L={(aa)nb:n≥0}.(B).L={aa(b)n:n≥0}.(C).L={(aab)n:n≥0}.(D).L={(a)nb:n>0}.
10. ThegrammarSàaaSbb|aSb|ab|λisequivalenttothefollowinggrammar:(A).SàaaSb|ab|λ.(B).SàaSbb|ab|λ.(C).SàaSb|ab|λ.(D).SàaSb|aabb|λ
11. Whichofthefollowingstatementsmayberight:(1).AdeterministicfiniteautomatoncanhaveonlyquadrupleM={Q,δ,q0,F};(2).LanguageL={an:n≥3}isregular.(A).Only(1)isright.(B).Both(1)and(2)areright.(C).(1)iswrongand(2)isright.(D).Noneoftheaboveisright.
12. Whichofthefollowingstatementsmayberight:(1).ThelanguageL={an:n≥0,n≠3}isregular.(2).LanguageL={an:niseitheramultipleof3oramultipleof5}isregular.(A).Only(1)isright.
58
(B).(1)iswrongand(2)isright.(C).Both(1)and(2)areright.(D).Noneoftheaboveisright.
13. Whichofthefollowingstatementsmayberight:(1).ThelanguageL={an:nisamultipleof3butnotamultipleof5}isregular.(2).ThesetofallrealnumberinCisnotaregularlanguage.(A).Only(1)isright.(B).(1)iswrongand(2)isright.(C).Both(1)and(2)areright.(D).Noneoftheaboveisright.
14. Whichofthefollowingstatementsmayberight:(1).ThelanguageL={an:nisamultipleof3butnotamultipleof5}isregular.(2).ThesetofallrealnumberinCisnotaregularlanguage.(A).Only(1)isright.(B).(1)iswrongand(2)isright.(C).Both(1)and(2)areright.(D).Noneoftheaboveisright.
15. Whichofthefollowingstatementsmayberight:(1).IflanguageLisregularthenL–{λ}isalsoregular.(2).IflanguageLisregularthenforalla∈Σ,LU{aa}isalsoregular.(A).Only(1)isright.(B).(1)iswrongand(2)isright.(C).Both(1)and(2)areright.(D).Noneoftheaboveisright.
16. Forthefollowingautomaton,whichofthefollowingstatementsmaybetrue:(1).ItisaDFA.(2).ItisaNFAthatacceptsallintegernumbersinC.(A).Only(1)isright.(B).(1)iswrongand(2)isright.(C).Both(1)and(2)areright.(D).Noneoftheaboveisright.
17. Whichofthestrings00,01001,10010,000,and0000areacceptedbythefollowingNFA?(A).00and01001.(B).01001and000.(C).10010and0000.(D).000and0000.
1 2.2
1. Construct an nfa that accepts all integer numbers in C.
Solution: Integer numbers in C have the form .A solution is
2. Prove in detail the claim made in the previous section that if in atransition graph there is a walk labeled w, there must be some walklabeled w of length no more than ⇤+ (1 + ⇤) |w|.
Solution: Suppose we have a walk labeled w = a1a2...an in a graphwith ⇤ �-transitions.Then any walk labeled w that includes �- edgescan be described by the form
u = �k1a1�k2 ...�knan�
kn+1 ,
where �ki denotes successive traversal ki �-edges and ai denotes thetraversal of an edge labeled ai . Denoting the length of u by |u| wehave
|u| = (k1 + k2 + ...+ kn+1) + (|a1|...+ |an|)= (n+ 1)⇤+ n
= ⇤+ (1 + ⇤)|w|.
3. ** Find a dfa that accepts the language defined by the nfa in Figure2.8.
1
1 2.2
1. Construct an nfa that accepts all integer numbers in C.
Solution: Integer numbers in C have the form .A solution is
2. Prove in detail the claim made in the previous section that if in atransition graph there is a walk labeled w, there must be some walklabeled w of length no more than ⇤+ (1 + ⇤) |w|.
Solution: Suppose we have a walk labeled w = a1a2...an in a graphwith ⇤ �-transitions.Then any walk labeled w that includes �- edgescan be described by the form
u = �k1a1�k2 ...�knan�
kn+1 ,
where �ki denotes successive traversal ki �-edges and ai denotes thetraversal of an edge labeled ai . Denoting the length of u by |u| wehave
|u| = (k1 + k2 + ...+ kn+1) + (|a1|...+ |an|)= (n+ 1)⇤+ n
= ⇤+ (1 + ⇤)|w|.
3. ** Find a dfa that accepts the language defined by the nfa in Figure2.8.
1
13. ** Which of the strings 00, 01001, 10010, 000, 0000 are accepted bythe following nfa?
Solution: 01001 and 000 are the only two strings accepted.
14. What is the complement of the language accepted by the nfa in Figure2.10?
Solution: It is not di�cult to see the language is L = {an : n � 1}.Therefore L̄ = {�}. The automaton below with single initial and finalstate is a solution.
15. ** Let L be the language accepted by the nfa in Figure 2.8. Find annfa that accepts L [ {a5}.
Solution: Add two states after the nfa accepts a3 with both new edgeslabeled a.
16. Find an nfa for L⇤, where L is the language in Exercise 15.
5
59
18. Whichofthefollowingstatementsmayberight:(1).IflanguageLisregularthenLRisalsoregular.(2).ANFAcanbeconvertedtoaDFA.(A).Only(1)isright.(B).(1)iswrongand(2)isright.(C).Both(1)and(2)areright.(D).Noneoftheaboveisright.
19. Whichofthefollowingstatementsmayberight:(1).Theautomatongeneratedbyprocedurereduceisdeterministic.(2).IfLisanonemptylanguagesuchthatanywinLhaslengthatleastn,thenanyDFAacceptingLmusthaveatleastn+1states.(A).Only(1)isright.(B).(1)iswrongand(2)isright.(C).Both(1)and(2)areright.(D).Noneoftheaboveisright.
20. Whichofthefollowingstatementsmayberight:(1).AregularlanguagecanbeacceptedbyaTuringmachine.(2).Aregularlanguagecanbeacceptedbyapushdownautomaton.(A).Only(1)isright.(B).(1)iswrongand(2)isright.(C).Both(1)and(2)areright.(D).Noneoftheaboveisright.
21. Aregularexpressionfortheset{anbm:n≥3,misodd}canbe:(A).aaab.(B).aaabbb.(C).aaaa*(bb)*b.(D).Noneoftheaboveisright.
22. Aregularexpressionfortheset{anbm:(n+m)isodd}canbe:(A).aaab*.(B).(aa)*(a+b)(bb)*.(C).a(aa)*bbb.(D).Noneoftheaboveisright.
23. AregularexpressionforthelanguageL={anbm:n≥3,m≤4}canbe:(A).aaaa*(λ+b+bb+bbb+bbbb).(B).aaabbb.(C).aaab.(D).Noneoftheaboveisright.
60
24. Whichofthefollowingstatementsmayberight:(1).λisaregularexpressiondenoting{λ}.(2).TheLRofL((ab+b)*b(a+ab)*)is(a+ba)*b(b+ba)*.(A).Only(1)isright.(B).(1)iswrongand(2)isright.(C).Both(1)and(2)areright.(D).Noneoftheaboveisright.
25. AregularexpressionforL={abnw:n≥4,w∈{a,b}+}canbe:(A).abbbb.(B).abbbbb*.(C).abbbbb*(a+b)(a+b)*.(D).abbbbb*(a+b).
26. AregularexpressionforL={w∈{0,1}*:whasexactlyonepairofconsecutivezeros}canbe:(A).(1+01)*00(1+10)*.(B).(1+01)*00.(C).00.(D).(1+10)*00.
27. Aregularexpressionforthelanguagewithallstringsnotendingin10on{0,1}canbe:(A).00+01+11+0+1.(B).00+01+11+0+1.(C).(0+1)*(00+01+11)+λ+0+1.(D).00+01+11+0+1+λ.
28. AregularexpressionforthelanguageL={w:na(w)mod3=0}on{a,b}canbe:(A).ab*ab*ab*.(B).(ab*ab*ab*)*.(C).(b*ab*ab*ab*)*.(D).Noneoftheaboveisright.
29. ThelanguagewhichaccepttheNFAbelowcanbewrittenas:(A).L((aab)ab).(B).L((aab)*ab).(C).L((aab)+ab).(D).Noneoftheaboveisright.
30. TheregulargrammarthatgeneratesthelanguageL(aa*(ab+a)*)canbewrittenas:
1 3.2
1. Use the construction in Theorem 3.1 to find an nfa that accepts thelanguage L (a⇤a+ ab).
Solution:
2. ** Use the construction in Theorem 3.1 to find an nfa that accepts thelanguage L ((aab)⇤ab).
Solution:
3. Use the construction in Theorem 3.1 to find an nfa that accepts thelanguage L (ab⇤aa+ bba⇤ab).
1
61
(A).SàaA,AàaA|B|λ.(B).SàaA,AàaAb|B|λ.(C).SàaA,AàaA|B,BàabB|aB|λ.(D).Noneoftheaboveisright.
31. IfL1=L(ab*aa),L2=L(a*bba*),aregularexpressionof(L1UL2)*L2is:(A).ab*aa*bba*(a*bba*).(B).ab*aa*bba*+a*bba*.(C).((ab*aa)+(a*bba*))*(a*bba*).(D).Noneoftheaboveisright.
32. Whichofthefollowingstatementsmayberight:(1).Ifalanguagefamilyisclosedunderunionandcomplementation,itmustbeclosedunderintersection.(2).WecanconstructaNFAthatacceptL(ab*a*)∩L(a*b*a).(A).Only(1)isright.(B).(1)iswrongand(2)isright.(C).Both(1)and(2)areright.(D).Noneoftheaboveisright.
33. Whichofthefollowingstatementsmayberight:(1).Thefamilyofregularlanguageisclosedunderfiniteunionandintersection.(2).SomeNFAscannotbeconvertedtoDFA.(A).Only(1)isright.(B).(1)iswrongand(2)isright.(C).(1)isrightand(2)iswrong.(D).Noneoftheaboveisright.
34. Whichofthefollowingaretrueforallregularlanguagesandallhomomorphism:(1).h(L1UL2)=h(L1)Uh(L2).(2).h(L1∩L2)=h(L1)∩h(L2).(A).Only(1)istrue.(B).(1)isfalseand(2)istrue.(C).(1)istrueand(2)isfalse.(D).Noneoftheaboveisright.
35. IfL1=L(a*baa*)andL2=L(aba*),thenL1/L2equalsto(A).a*b.(B).ba*.(C).a*.(D).Noneoftheabove.
1 3.2
1. Use the construction in Theorem 3.1 to find an nfa that accepts thelanguage L (a⇤a+ ab).
Solution:
2. ** Use the construction in Theorem 3.1 to find an nfa that accepts thelanguage L ((aab)⇤ab).
Solution:
3. Use the construction in Theorem 3.1 to find an nfa that accepts thelanguage L (ab⇤aa+ bba⇤ab).
1
1 3.2
1. Use the construction in Theorem 3.1 to find an nfa that accepts thelanguage L (a⇤a+ ab).
Solution:
2. ** Use the construction in Theorem 3.1 to find an nfa that accepts thelanguage L ((aab)⇤ab).
Solution:
3. Use the construction in Theorem 3.1 to find an nfa that accepts thelanguage L (ab⇤aa+ bba⇤ab).
1
62
36. Whichofthefollowingaretrue:(1).ForalllanguagesL1andL2,L1=L1L2/L2.(2).IfL1UL2isregularandL1isfinite,thenL2isregular.(A).Only(1)istrue.(B).(1)isfalseand(2)istrue.(C).(1)istrueand(2)isfalse.(D).Noneoftheaboveisright.
37. Whichofthefollowingaretrue:(1).IfLisaregularlanguages,thenL1={uv:u∈L,|v|=2}isalsoregular.(2).IfLisaregularlanguages,thenL1={uv:u∈L,v∈LR}isalsoregular.(A).Only(1)istrue.(B).(1)isfalseand(2)istrue.(C).(1)istrueand(2)isfalse.(D).Both(1)and(2)aretrue.
38. Whichofthefollowingaretrue:(1).Thereexistsanalgorithmtodeterminewhetherornotw∈L1–L2,foranygivenwandanyregularlanguageL1andL2.(2).ThereexistsanalgorithmfordeterminingifL1isapropersubsetofL2,foranyregularlanguageL1andL2.(A).Only(1)istrue.(B).(1)isfalseand(2)istrue.(C).(1)istrueand(2)isfalse.(D).Both(1)and(2)aretrue.
39. Whichofthefollowingaretrue:(1).Thereexistsanalgorithmfordeterminingwhetherornotλ∈LforanyregularlanguageL.(2).NoalgorithmexistsfordeterminingifL∈Σ*foranyregularlanguageL.(A).Only(1)istrue.(B).(1)isfalseand(2)istrue.(C).(1)istrueand(2)isfalse.(D).Both(1)and(2)aretrue.
40. Whichofthefollowingaretrue:(1).Thereexistsanalgorithmfordeterminingwhetherornot|L|≥5foreveryregularlanguageL.(2).ThereexistsanalgorithmfordeterminingifaregularlanguageLcontainsafinitenumberofeven-lengthstrings.(A).Only(1)istrue.(B).(1)isfalseand(2)istrue.(C).(1)istrueand(2)isfalse.(D).Both(1)and(2)aretrue.
63
41. Whichofthefollowingaretrue:(1).ThelanguageL={anbkcn:n≥0,k≥0}isnotregular.(2).ThelanguageL={anbkcn:n≥0,k≥n}isnotregular.(A).Only(1)istrue.(B).(1)isfalseand(2)istrue.(C).(1)istrueand(2)isfalse.(D).Both(1)and(2)aretrue.
42. Whichofthefollowingaretrue:(1).ThelanguageL={anbn:n≥1}U{anbm:n≥1,m≥1}isregular.(2).ThelanguageL={anbn:n≥1}U{anbn+2:n≥1}isregular.(A).Only(1)istrue.(B).(1)isfalseand(2)istrue.(C).(1)istrueand(2)isfalse.(D).Both(1)and(2)aretrue.
43. Whichofthefollowingaretrue:(1).ThelanguageL={anbn:n≥0}U{anbn+1:n≥0}U{anbn+2:n≥0}isnotregular.(2).ThelanguageL={anbn+k:n≥0,k≥1}U{an+kbn:n≥0,k≥3}isnotregular.(A).Only(1)istrue.(B).(1)isfalseand(2)istrue.(C).(1)istrueand(2)isfalse.(D).Both(1)and(2)aretrue.
44. Whichofthefollowingaretrue:(1).ThelanguageL={wwRv:v,w∈{a,b}+}isnotregular.(2).ThelanguageL={w1cw2:w1,w2∈{a,b}*,w1≠w2}isregular.(A).Only(1)istrue.(B).(1)isfalseand(2)istrue.(C).(1)istrueand(2)isfalse.(D).Both(1)and(2)aretrue.
45. Whichofthefollowingaretrue:(1).Thecontext-freegrammarforlanguageL=anbn,nisodd,isSàaaSbb|λ.(2).Thecontext-freegrammarforlanguageL=anbn,nisamultipleof3,isSàaaaSbbb|λ.(A).Only(1)istrue.(B).(1)isfalseand(2)istrue.(C).(1)istrueand(2)isfalse.(D).Both(1)and(2)aretrue.
46. Whichofthefollowingaretrue:(1).Thecontext-freegrammarforlanguageL={anbn,n≤m+3,n≥0,m≥0}is:odd,isSàaSb|A|B,Aàλ|a|aa|aaa,BàbB|b.(2).The
64
context-freegrammarforlanguageL={anbm:2n≤m≤3n}isamultipleof3,isSàaaaSb|aaaSb|λ.(A).Only(1)istrue.(B).(1)isfalseand(2)istrue.(C).(1)istrueand(2)isfalse.(D).Both(1)and(2)aretrue.
47. Whichofthefollowingaretrue:(1).Acontext-freegrammarforlanguageL={anwwRbn,:w∈Σ*,n≥1}forΣ={a,b}canbeSàaSb|S1,S1àaS1a|bS1b|λ.(2).IflanguageL={anbn:n≥0},thenL2isnotcontext-free.(A).Only(1)istrue.(B).(1)isfalseand(2)istrue.(C).(1)istrueand(2)isfalse.(D).Both(1)and(2)aretrue.
48. Whichofthefollowingaretrue:(1).ThelanguageL={uvwvR:u,v,w∈{a,b}+,|u|=|w|=2}iscontext-free.(2).ThelanguageL={w1cw2:w1,w2∈{a,b}+,w1≠w2R}withΣ={a,b,c}iscontext-free.(A).Only(1)istrue.(B).(1)isfalseand(2)istrue.(C).(1)istrueand(2)isfalse.(D).Both(1)and(2)aretrue.
49. Whichofthefollowingaretrue:(1).ThegrammarSàAB|aaaB,Aàa|Aa,andBàbisambiguous.(2).Aregularlanguagecanbeinherentlyambiguous.(A).Only(1)istrue.(B).(1)isfalseand(2)istrue.(C).(1)istrueand(2)isfalse.(D).Both(1)and(2)aretrue.
50. Whichofthefollowingaretrue:(1).It’spossibleforaregulargrammartobeambiguous.(2).ThegrammarSàaSbS|bSaS|λisambiguous.(A).Only(1)istrue.(B).(1)isfalseand(2)istrue.(C).(1)istrueand(2)isfalse.(D).Both(1)and(2)aretrue.
51. SimplifythegrammarSàaS|AB|λ,AàbA,andBàAA,weget:(1).SàaS|λ.(2).L(a*).(3).SàaS|bb|λ.(A).Only(1)isright.
65
(B).Only(2)and(3)areright.(C).Only(1)and(2)areright.(D).Allof(1),(2),and(3)areright.
52. Eliminateallλ-productionsfromSàaSSSandSàbb|λ,weget:(1).Sàa|bb|bb|bb|aandSàbb.(2).Sàa|SSS|aSS|aS|aandSàbb.(A).Only(1)isright. (B).Only(2)isright.(C).Both(1)and(2)areright.(D).Neither(1)nor(2)isright.
53. Eliminateallλ-productionsfromSàAaB|aaB,Aàλ,BàbbA|λ,weget:(1).SàaB|aaB|a|aaandSàbb.(2).Sàabb|aabbandBàbb.(A).Only(1)isright. (B).Only(2)isright.(C).Both(1)and(2)areright.(D).Neither(1)nor(2)isright.
54. EliminatethevariableBfromthegrammarSàaSB|bBandSàbb|λ,weget:(1).SàaSaA|aSb|baA|bb.(2).SàaSaA|b|baA|b.(A).Only(1)isright. (B).Only(2)isright.(C).Both(1)and(2)areright.(D).Neither(1)nor(2)isright.
55. WhichofthefollowingchoiceisrightforthegrammarSàabAB|ba,Aàaaa,BàaA|bbandSàabAaA|abAbb|ba,Aàaaa.(A).Theyarenotequivalent.(B).Theyareequivalent.(C).Thefirstiscontextfreeandthesecondiscontextsensitive.(D).Thefirstiscontextsensitiveandthesecondiscontextfree.
56. Whichofthefollowingstatementsmaybetrue:(1).BothChomskynormalformandGreibachnormalformcanbeusedtorepresentacontextfreegrammar.(2).EverycontextfreegrammarwithoutλcanbeconvertedintoGreibachnormalform.(A).Only(1)isright.(B).Only(2)isright.(C).Both(1)and(2)areright.
66
(D).Noneoftheaboveisright.
57. TheChomskynormalformofthegrammarSàaSS|a|bis:(1).SàVaVs|a|b,VsàSS,Vaàa.(2).SàVaVs|a|b,VsàSS|b,Vaàa.(A).Only(1)isright.(B).Only(2)isright.(C).Both(1)and(2)areright.(D).Neither(1)nor(2)isright.
58. TheGreibachnormalformofthegrammarSàaSb|bSa|a|b|abis:(1).SàaSb|VbSVa|a|b|VaVb,Vaàa,Vbàb.(2).SàaSVb|bSVa|a|b|aVb,Vaàa,Vbàb.(A).Only(1)isright.(B).Only(2)isright.(C).Both(1)and(2)areright.(D).Neither(1)nor(2)isright.
59. TheGreibachnormalformofthegrammarSàaSb|ab|bbis:(1).SàaSVb|aVb|bVb,Vbàb.(2).SàaSVb|aVb|VbVb,Vbàb.(A).Only(1)isright.(B).Only(2)isright.(C).Both(1)and(2)areright.(D).Neither(1)nor(2)isright.
60. Whichofthefollowingstatementscanbetrue:(1).Everylineargrammarcanbeconvertedtoaregulargrammar.(2).TheChomskynormalformofacontextfreelanguagewithoutλcanbeconvertedintoaGreibachform.(A).Only(1)isright.(B).Only(2)isright.(C).Both(1)and(2)areright.(D).Neither(1)nor(2)isright.
61. Forpushdownautomata,whichofthefollowingstatementsarecorrect:(1).Pushdownautomatadescribecontextfreelanguage,sotheyareequivalenttocontextfreegrammar.(2).Pushdownautomataincludeeveryelementoffiniteautomata.(3).Pushdownautomatafollowleftmostderivationorder,thustheyneedtouseastackastheirunboundedstorage.(A).Only(1)isright.(B).Only(2)and(3)areright.(C).Only(1)and(2)areright.(D).Allof(1),(2),and(3)areright.
67
62. Whichofthefollowingstatementsareright:(1).Pushdownautomatahaveseven
elements:M=(Q,Σ,Г,δ,q0,Z0,F),theyarepatternmodelofcontextfreelanguafeForpushdownautomata,whichofthefollowingstatementsarecorrect:(1).Pushdownautomatadescribecontextfreelanguage,sotheyareequivalenttocontextfreegrammar.(2).Pushdownautomataincludeeveryelementoffiniteautomata.(3).Pushdownautomatafollowleftmostderivationorder,thustheyneedtouseastackastheirunboundedstorage.(A).Only(1)isright.(B).Only(2)and(3)areright.(C).Only(1)and(2)areright.(D).Allof(1),(2),and(3)areright.
63. Whichofthefollowingstatementsareright:(1).Thestatesofpushdownautomatarepresentthegrammarvariablesofderivativesentencesincorrespondingregularlanguage.(2).Inapushdownautomatastack,theleftmostvariableisputontopofthestackwhiletherightmostoneonbottom.(3).Oncethestackisempty,thesentenceisgenerated.(A).Only(1)isright.(B).Only(2)and(3)areright.(C).Only(1)and(2)areright.(D).Allof(1),(2),and(3)areright.
64. Pushdownautomatahavefollowingbasiccomponents:(1).Inputfiletape.(2).Stackstorage.(3).Controlunit.(4).Readandwritetape.(A).(1)and(2).(B).(3)and(4).(C).(1),(2),and(3).(D).(2),(3),and(4).
65. ToconstructapushdownautomatonthatacceptlanguageL={w2wT|w∈{0,1}*},whichofthefollowingdesigncanberight:(1).TwostepsM1=({q0},{0,1,2},{S,A,B},δ1,q0,S,Φ)andM2=({q0,q1},{0,1,2},{S,A,B,Z0},δ2,q0,Z0,{q1}),whereZ0isthetopstacksymbol,andthenconstructthemachinebystandardmethod.(2).M=({q0,q1,q2,qf,qt},{0,1,2},{A,B,Z0},δ,q0,Z0,{qf}),whereqtisthetrapstate.(A).Only(1)isright.(B).Only(2)isright.(C).Both(1)and(2)areright.(D).Noneoftheaboveisright.
68
66. Toconstructapushdownautomatonthatacceptthelanguagedefinedbythegrammar
SàaSSSab|λ,wecandothefollowingimplementation:(1).Convertthegrammarintoaregulargrammar.(2).ConvertthegrammarintoGreibachform.SàaSSSA|λ,AàaB,andBàb.(3).Followthestandardconstructionmethodtobuildtheautomaton.Whichofthefollowingchoicesareright:(A).(1)and(2).(B).(2)and(3).(C).(1)and(3).(D).(1),(2),and(3).
67. Whichofthefollowingstatementonpushdownautomataandcontextfreelanguage/grammarareright:(1).Pushdownautomataisequivalenttocontextfreegrammar.(2).Contextfreelanguagecanbeacceptedbypushdownautomatawhichcanuseemptystacktoacceptlanguage.(3).Thepushdownautomataacceptedlanguagecanbedescribedbycontextfreegrammar.(4).Pushdownautomataisequivalenttodeterministicfiniteautomata.(A).Only(1)and(2)areright.(B).Only(2)isright.(C).(1),(2),and(3)areright.(D).All(1),(2),(3),and(4)areright.
68. Fortheequivalenceofpushdownautomatandcontextfreegrammar,whichofthefollowingstatementsareright:(1).Contextfreegrammarisequivalenttothepushdownautomatawhichcanacceptalanguagewithanemptystatestack.(2).Contextfreegrammarisequivalenttothepushdownautomatawhichcanacceptalanguagewithafinalstate.(3).(1)and(2)areequivalent.(A).Only(1)isright.(B).Only(2)isright.(C).Both(1)and(2)areright.(D).All(1),(2),and(3)areright.
69. Whichofthefollowingstatementsmaybecorrect:(1).L={anbm,n<m}isadeterministiccontextfreelanguage.(2).L={anbm,n>m}isnotadeterministiccontextfreelanguage.(A).Only(1)isright.(B).Only(2)isright.(C).Both(1)and(2)areright.(D).Noneoftheaboveisright.
69
70. Whichofthefollowingstatementsmaybecorrect:(1).IfL1isdeterministiccontextfreeandL2isregular,thenL1∩L2isnotdeterministiccontextfree.(2).IfL1isdeterministiccontextfreeandL2isregular,thentheunionofL1andL2isdeterministiccontextfree.(A).Only(1)isright.(B).Only(2)isright.(C).Both(1)and(2)areright.(D).Noneoftheaboveisright.
71. Whichofthefollowingstatementarecorrect:(1).Acontextfreelanguageisasubsetofacontextsensitivelanguage.(2).It’seasiertoprocessregulargrammarthancontextfreegrammar.(3).It’seasiertoprocesscontextfreegrammarthancontextsensitivegrammar.(A).Only(1)isright.(B).Only(2)isright.(C).Both(1)and(2)areright.(D).All(1),(2),and(3)areright.
72. Whichofthefollowingstatementsforcontextfreelanguagepumpinglemmamayberight:(1).Thepumpinglemmaisusefulinshowingthatalanguagedoesnotbelongtothefamilyofcontextfreelanguage.(2).Thesubstringthatprecedesboundedstringcanbearbitrarylong.(A).Only(1)isright.(B).Only(2)isright.(C).Both(1)and(2)areright.(D).Noneoftheaboveisright.
73. Whichofthefollowingstatementsforlinearlanguagepumpinglemmamayberight:(1).Themiddlestringcanbeofarbitrarylength.(2).Thesubstringthatprecedesmiddlestringcanbearbitrarylong.(A).Only(1)isright.(B).Only(2)isright.(C).Both(1)and(2)areright.(D).Noneoftheaboveisright.
74. Whichofthefollowingstatementsmayberight:(1).Thefamilyofcontextfreelanguageisapropersubsetofthefamilyoflinearlanguage.(2).Thefamilyoflinearlanguageisapropersubsetofthefamilyofcontextfreelanguage.(A).Only(1)isright.(B).Only(2)isright.(C).Both(1)and(2)areright.
70
(D).Noneoftheaboveisright.
75. Thefamilyofcontextfreelanguageisclosedunderthefollowingoperations:(1).Union,(2).Intersection,(3).Concatenation,(4).Star-closure,(5).Complementation.(A).(1),(2),and(3)areright.(B).(2),(3),and(4)areright.(C).(1),(3),and(4)areright.(D).(3),(4),and(5)areright.
76. Whichofthefollowingstatementsmayberight:(1).Anintersectionofacontextfreelanguageandaregularlanguageisacontextfreelanguage.(2).Thefamilyofunambiguouscontextfreelanguagesisclosedunderunionoperation.(A).Only(1)isright.(B).Only(2)isright.(C).Both(1)and(2)areright.(D).Noneoftheaboveisright.
77. Whichofthefollowingstatementscanberight:(1).Anintersectionofacontextfreelanguageandaregularlanguagemaynotbearegularlanguage.(2).Thefamilyoflinearlanguagesisnotclosedunderintersection.(A).Only(1)isright.(B).Only(2)isright.(C).Both(1)and(2)areright.(D).Noneoftheaboveisright.
78. Whichofthefollowingstatementscanberight:(1).ThelanguageL={anbn:n≥0,nisnotamultipleof5}iscontextfree.(2).IfL1isacontextfreelanguageandL2isaregularlanguage,thereexistsanalgorithmtodeterminewhetherL1andL2haveacommonelement.(A).Only(1)isright.(B).Only(2)isright.(C).Both(1)and(2)areright.(D).Noneoftheaboveisright.
79. Whichofthefollowingstatementsmayberight:(1).Thefamilyofcontextfreelanguageisnotclosedunderreversal.(2).Thereexistsanalgorithmtodetermineifacontextfreelanguagecontainsanyodd-lengthstrings.(A).Only(1)isright.(B).Only(2)isright.(C).Both(1)and(2)areright.(D).Noneoftheaboveisright.
71
80. Whichofthefollowingstatementiscorrect:(1).Thefamilyoflinearlanguagesisclosed
underconcatenationandnotclosedunderunion.(2).IfL1iscontextfreeandL2isregular,thenL1–L2iscontextfree.(A).Only(1)isright.(B).Only(2)isright.(C).Both(1)and(2)areright.(D).Noneoftheaboveisright.
81. Whichofthefollowingstatementsarecorrect:(1).ATuringmachineisanabstract“machine”thatmanipulatessymbolsonastripoftapeaccordingtoatableofrules.(2).Turingmachineisamathematicalmodelthatdefinessuchadevice.(3).Turingmachineoperatesonaninfinitememorytapedividedintocells:write,moveleft/right,andhalt.(4).InsteadoftapeusedinoriginalTuringmachine,moderncomputersuserandomaccessmemorydesigntoperformcomputation.(A).(1)and(2)arecorrect.(B).(1),(2),and(3)arecorrect.(C).(1),(3),and(4)arecorrect.(D).All(1),(2),(3),and(4)arecorrect.
82. ForaTuringmachine,whichofthefollowingstatementiscorrect:(1).ATuringmachineisdefinedbyM=(Q,Σ,Г,δ,q0,□,F),a7-tuple,andwecanthinkofaTuringmachineasasimplecomputer.(2).ThedifferencebetweenaTuringmachineandapushdownautomatonisinthetemporarymemory:arandomaccessmemoryisusedinTuringmachinewhileastackintheother.(A).Only(1)isright.(B).Only(2)isright.(C).Both(1)and(2)areright.(D).Noneoftheaboveisright.
83. ThefunctionswhicharecomputablebyaTuringMachineareknownas(A).PartialRecursiveFunctions.(B).EnumerableFunctions.(C).PartialFunctions.(D).Finite-Automata.
84. TheTuringmachineiscomputableiffinalstatecontains(A).transitionfunction.(B).notransitionfunction.(C).haltstate.(D).bothBandC.
72
85. ThelanguageL={ωω:ω∈(0,1)*}is
(A).notacceptedbyaTuringmachine.(B).acceptedbysomeTuringmachines,butbynopushdownautomaton.(C).acceptedbysomepushdownautomaton,butnotcontextfree.(D).context-free,butnotregular.
86. ForthedefinitionofastandardTuringmachine,whichofthefollowingstatementsareright:(A).TheTuringmachinehasatapethatisboundedinbothleftandrightdirections.(B).TheTuringmachineisdeterministicinthesensethatδdefinesatmostonemoveforeachconfiguration.(C).TuringmachineswithastayoptionareequivalenttoStandardTuringMachines.(D).All(A),(B),and(C).
87. ForstandardTuringmachines,whichofthefollowingstatementsareright:(A).AteachmoveofaTuringmachine,thetapeheadmaymoveeitherleftorright.(B).Wecanaugmenteachmovewitha‘stay’option,i.e.wewilladd“don’tmove”totheset{L,R}.(C).TuringmachineswithastayoptionareequivalenttoStandardTuringMachines.(D).All(A),(B),and(C).
88. WhatlanguageisacceptedbytheTuringmachinewhosetransitiongraphinthefigurebelow:(A).L=L(aabb*+bbbb*aa).(B).L=L(aab*b*+bbb*b*aa).(C).L=L(ab*+bb*a).(D).L=L(ab*λ+bb*a).
89. The“high-level”descriptionforconstructingtheTuringmachinethatacceptthelanguageL={ωωRω}on{a,b}canbe:(1).Step1:3-splitinput;Step2:reverse-compareωagainstωRfollowedbyreverse-compareωRagainstω;Accepttheinputonlywhenbothstepsaresuccessful.(2).Step1:3-splitinputintoω1xω2xω3;Step2:forward-
73
compareωagainstωRandreverse-compareωRagainstω;Accepttheinputonlywhenbothstepsaresuccessful.(A).Only(1)iscorrect.(B).Only(2)iscorrect.(C).Both(1)and(2)arecorrect.(D).Noneoftheaboveiscorrect.
90. Whichofthefollowingstatementcanbecorrect:(1).ForconstructingaTuringmachinethatcanperformadditionofpositiveintegersindecimalnotation,carryingdigit1tothehigherdigitsisdifferentfrombinarynumberaddition.(2).ATuringmachineforthemultiplicationoftwointegersmandncanbedonebyperformingmtimesofadditiontop=p+nwithp=0tostartwith.(A).Only(1)iscorrect.(B).Only(2)iscorrect.(C).Both(1)and(2)arecorrect.(D).Noneoftheaboveiscorrect.
91. WhichofthefollowingstatementsonTuringmachinemodelscanbecorrect:(1).ATuringmachinecanhaveasemi-infinitetape.(2).TheTuringmachinecanbeimplementedoff-line,readstatefrominputfile.(3).Turingmachinecanbeimplementedtohavemultidimensionalstorage.(A).(1)and(2)arecorrect.(B).(2)and(3)arecorrect.(C).(1)and(3)arecorrect.(D).(1),(2),and(3)arecorrect.
92. SupposewemaketherequirementthataTuringmachinecanhaltonlyinafinalstate,thatis,weaskthatδ(q,a)bedefinedforallpairs(q,a)withaϵΓandq∉F.Whichofthefollowingarecorrect:(1).ThiswillrestrictthepoweroftheTuringmachine.(2)ThiswillnotrestrictthepoweroftheTuringmachine.(3).Anynon-finalhaltingstatecanbeputintoaninfiniteloop.(4).δ(q,a)=(q,a,S)forallaϵΓandq∉F.(A).(1)and(3)arecorrect.(B).(2)and(3)arecorrect.(C).(1),(3),and(4)arecorrect.(D).(2),(3),and(4)arecorrect.
93. IfwemaketherestrictionthataTuringmachinemustalwayswriteasymboldifferentfromtheoneitreads,i.e.ifδ(qi,a)=(qi,b,LorR)thenaandbmustbedifferent.Whichofthefollowingareright:(1).Thiswillreducethepoweroftheautomaton.(2).Thiswill
74
notreducethepoweroftheautomaton.(3).ForeachsymbolaϵΓ,wecanintroduceapseudo-symbolA.Wheneverwe(A).(1)and(3)arecorrect.(B).(2)and(3)arecorrect.(C).Only(3)iscorrect.(D).Noneofaboveiscorrect.
94. WhichofthefollowingstatementsonnondeterministicTuringmachinearecorrect:(1).AnondeterministicTuringmachineislessusefulsinceitisnotdeterministic,i.e.wemaynotbeabletoreachafixedfinalcomputationstate.(2).Wheneverthenondeterministicmachineperformsatransitionthatinvolvesmorethanonemove,thedeterministicmachinewillsimulateitbycreatinganactiveconfigurationforeachofthecorrespondingcomputationsonthetape.(3).Thedeterministicmachinewillrepeatedlyexecuteasinglesteponeachofthesegeneratedconfigurationsinturn.(4).Ifanyofthecomputationsenterahaltstate,thedeterministicmachinewillidentifyitasinactiveandremovefromfurtherconsideration.(A).(1),(2),and(3)arecorrect.(B).(2),(3),and(4)arecorrect.(C).(1),(3),and(4)arecorrect.(D).(1),(2),(3),and(4)arecorrect.
95. Todeterminewhetherornotastringin{0,1}+representsanencodedTuringmachine,whichofthefollowingarecorrect:(1).Todetermineifagivenstringin{0,1}+representsatransitionfunctionδ(qi,ak)=(qj,al,LorR)foranencodedTurningmachine.(2).Wecancheckthattheinputisoftheform0x10x20x30x40x50,wherethexiarestringsof1's,withtherestrictionthatx5=1or11.(3).Wemustuseapredefinedpushdownmachinetoguaranteetherightgrammarimplementation.(A).(1)and(2)arecorrect.(B).(2)and(3)arecorrect.(C).(1),(2),and(3)arecorrect.(D).Noneoftheaboveiscorrect.
96. Whichofthefollowingstatementsofrecursivelyenumerablelanguagearecorrect:(1).Allrecursivelanguagesarecontextsensitive.(2).IfLisafinitelanguage,thenL+isrecursivelyenumerable.(3).Ifalanguageisnotrecursivelyenumerable,itscomplementcannotberecursive.(A).(1)and(2)arecorrect.(B).(2)and(3)arecorrect.(C).(1),(2),and(3)arecorrect.(D).Noneoftheaboveiscorrect.
75
97. Whichofthefollowingarecorrect:(1).Ifanalgorithmofatwo-tapeTuringmachinehasO(n)complexity,thenthebestofwecangetforaone-tapemachineisO(n2).(2).Anycomputationthatcanbeperformedonasingle-tape,off-lineTuringmachineintimeO(T(n))alsocanbeperformedonastandardTuringmachineintimeO(T(n)).(A).Only(1)iscorrect.(B).Only(2)iscorrect.(C).Both(1)and(2)arecorrect.(D).Noneoftheaboveiscorrect.
98. Whichofthefollowingstatementsoftheunionofrecursivelyenumerablelanguagesarecorrect:(1).Thefamilyofrecursivelyenumerablelanguagesisclosedunderunion.(2).Whenrepresentedwithaninputω,wecannondeterministicallychooseTuringmachinesM1orM2toprocessω.TheresultisaTuringmachinethatacceptstwolanguagesL1∪L2.(A).(1)iscorrect.(B).(2)iscorrect.(C).(1)and(2)arecorrect.(D).Noneoftheaboveiscorrect.
99. Forsortingefficiency,whichofthefollowingarecorrect:(1).Thechoiceofalgorithmisimportantinsorting.(2).Simplemethods,suchasabubblesort,havetime-complexityO(n2).(3).Themostefficientsortingalgorithmshavetime-complexityO(logn).(A).(1)and(2)arecorrect.(B).(2)and(3)arecorrect.(C).(1),(2),and(3)arecorrect.(D).Noneoftheaboveiscorrect.
100. WhichofthefollowingareNP-completeproblems:(1).Graphcoloringproblem.(2).Hamiltonianpathproblem.(3).Knapsackproblem.(4).Travellingsalesmanproblem.(5).Problemofnetworkshortestpathfindingbetweentworouters.(A).(1),(2),and(3).(B).(2),(3),and(4).(C).(1),(3),and(5).(D).(1),(2),(3),and(4).