C++面向?qū)ο蟪绦蛟O(shè)計(jì)考試題庫(kù)_第1頁(yè)
C++面向?qū)ο蟪绦蛟O(shè)計(jì)考試題庫(kù)_第2頁(yè)
C++面向?qū)ο蟪绦蛟O(shè)計(jì)考試題庫(kù)_第3頁(yè)
C++面向?qū)ο蟪绦蛟O(shè)計(jì)考試題庫(kù)_第4頁(yè)
已閱讀5頁(yè),還剩132頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

SHORTANSWERAsetofinstructionsthatthecomputerwillfollowiscalleda.Answer:programThecollectionofprogramsusedbythecomputerisknownas.Answer:softwareComputersthatareinterconnectedareknownasa.Answer:networkAdigitthatcanholdazerooraoneisknownasa.Answer:bitListatleasttwoinputdevices.Answer:keyboard,mouse,networkcard,fileListatleasttwooutputdevices.Answer:screen,printer,file,networkcardAvariablethatcanholdawholenumberiscalleda(n).Answer:integerWhatpunctuationsignifiestheendofaC++statement?Answer:Asemicolon.Amistakeinacomputerprogramiscalleda.Answer:bugAistheprogramthattranslatesaprogramwritteninC++intomachinelanguage.Answer:compilerErrorsinaprogramcanbeclassifiedintothreetypes,listthemAnswer:Syntax,logic,run-timeWhatdoesthefollowingstatementinC++printtothescreen?cout?”Hellostudents^);Answer:Hellostudents.Amistakethatisadirectviolationofthesyntaxruleswillgenerateacompiler.Answer:errorIfyourprogramcompilesandruns,butgivesanincorrectoutput,thisisknownasa error.Answer:logicThepartofthecomputerthatcontrolsandexecutesprogramsiscalledthe.Answer:CPUMULTIPLECHOICEWhowastheprogrammerforCharlesBabbage'sanalyticalengine?a.GraceHopperb.AdaLovelacec.LordBryand.WallerSavitchAnswer:BAnalgorithmisTheinputsandoutputsofaprogramThepartofthecomputerthatdoestheprocessingAfinitesetofstepstosolveaproblemAcompletecomputerprogram Answer:CAmemoryaddressisWhereavariableisstoredWherethecomputerislocatedAstepintheprogram.WheretheCPUisstored. Answer:AAcomputerthatisnormallyusedbyonlyonepersonatatimeiscalledaServerMainframePersonalComputerNetwork Answer:CThephysicalmachinesthatmakeupacomputeriscalledtheSoftwareNetworkDevicesCPUHardware Answer:EWhichofthefollowingisnotaphaseoftheprogram-designprocess?Problem-solvingImplementationMarketingthefinalprogram Answer:CWhichofthefollowingisnotpartoftheSoftwareLifeCycle?AnalysisDesignDataEntryImplementationTesting Answer:CFromwhichlanguagedidC++directlyevolve?AAdaCC+C- Answer:CWhatdoesthefollowinglineofcodedisplaytothescreen?cout?”Thisisthecomputer\nprogrammingbook\n”;ThisisthecomputemprogrammingbookThisisthecomputerNothingThisisthecomputerprogrammingbook Answer:D

C++statementsendwithaa.Periodb.Commac.SemicolonAnswer:Cd.Nothing11.12.Whichofthefollowingisnotanexampleofaprogrambug?Run-timeerrorOperatorerrorSyntaxerrorLogicerror Answer:BWhatdoesthefollowingcodeprinttothescreen?coutvv"hello”;HellohelloHELLONothing Answer:B6.17.ThesetofinstructionsthatacomputerwillfollowiHardwareAlgorithmProgramCPUTheanagramCPUstandsforComputerProgrammingUnitCentralProcessingUnitCentralProgramUserComputerPaperUserTheoutputofthecompileriscalledTheprogramSourcecodeLinkedcodeObjectcodeThetermOSstandsforOperatingSystemOscillatingSystemOperationsServicesNothingWhodesignedthefirstprogrammablecomputer?IBMMicrosoftIntelBabbageDellsknownas:Answer:CAnswer:BAnswer:DAnswer:AAnswer:DAfinitesequenceofpreciseinstructionsthatleadstoaproblemsolutionisa.Aprogramb.TheCPUAListofInputsandOutputsAnAlgorithm Answer:DWhodevelopedC++?BjameStroustrupKenThompsonCharlesBabbageAdaLovelace Answer:AOneofthebiggestdifferencebetweenCandC++is:Cisobject-orientedC++isobject-orientedAllC++programsarealsoCprogramsConlyrunsonUNIXcomputers Answer:Bintnumber;isanoutputstatementisaninputstatementisavariabledeclarationisaprogram Answer:Ccout?"Howmanyitemswouldyouwant?\n";isanoutputstatementisaninputstatementisavariabledeclarationisaprogram Answer: Acin?number;A isanoutputstatementB isaninputstatementC isavariabledeclarationD isaprogram Answer: BWhatdoesthefollowingprinttothescreen?cout?"HelloStudents/n”;HelloStudentshelloStudentsHELLOSTUDENTSHelloStudents/n Answer:D#include<iostream>isavariabledeclarationanexecutablestatementanincludedirectiveillegalcode Answer:CAbyteconsistsofhowmanybits?678910 Answer:CWhatiswrongwiththefollowingstatement?cout?Hellotoeveryone\n"coutshouldbecountmissingasemicolonmissinga”批注[WS1J:批注[WS1J:28and27arethesame批注fMH21:27and28aredifferent,27ismissingasemicolon,while28ismissingtheclosingdoublequote.Whatiswrongwiththefollowing(statement[?cout?"Hellotoeveryone\n;coutshouldbecountmissingasemicolonmissinga”missinga( Answer:CC++isanexampleofaMachinelanguageHigh-levellanguageLow-levellanguageAssemblylanguage Answer:BRAMstandsforReadaccessmemoryRandomaccessmemoryReallyatrociousmemoryAharddrive Answer:BTRUE/FALSEGraceHopperdiscoveredthefirstdocumentedcomputerbug.Answer:TRUEThefollowingstatementislegal:cout?"Hello,mynameisBill\n”;Answer:FALSEYbushouldwriteyourprogrambeforeyouwritethealgorithm.Answer:FALSEItisconsideredbetterstyletoputthebraces({})onseparatelines.Answer:TRUEThecompilerwillcatchallyourprogrammingmistakes.Answer:FALSEC++isalow-levellanguage.Answer:FALSEMainmemoryholdsitsdataifthecomputeristurnedoffAnswer:FALSEAnalgorithmisalwayswritteninC++ Answer:FALSE

Thereare8bytesinonebit.Answer:FALSETheprinterisanexampleofaninputdevice.Answer:FALSETRUE/FALSEInthefollowingcodefragment,x=3;ANSWER:TRUEThebodyofado-whileloopalwaysexecutesatleastonce.ANSWER:TRUEThebodyofawhileloopmayneverexecute.ANSWER:TRUETheoppositeof(x>3&&x<10)is(x<3&&x>10)ANSWER:FALSETheinteger0isconsideredtrue.ANSWER:FALSELoopsareusedwhenweneedourprogramtomakeachoicebetweentwoormorethings.ANSWER:FALSEItislegaltodeclaremorethanonevariableinasinglestatement.ANSWER:TRUEVariablenamesmaybeginwithanumber.ANSWER:FALSETheoppositeoflessthanisgreaterthanANSWER:FALSEEverylineinaprogramshouldhaveacomment.ANSWER:FALSEShortAnswer?iscalledtheoperator.ANSWER:insertionThebracesforaloopdefinetheoftheloop.ANSWER:bodyAloopthatalwaysexecutestheloopbodyatleastonceisknownasaloop.ANSWER:do-whileintmyValue;iscalleda.ANSWER:variabledeclarationWhatistheoppositeof(x<20&&x>12)?ANSWER:(x>=20IIx<=12)Whatisthecorrectconditionalstatementtodetermineifxisbetween19and99?ANSWER:(x>19&&x<99)

Eachtimealoopbodyexecutesisknownasan.ANSWER:iterationif-elsestatementsthatareinsideotherif-elsestatementsaresaidtobe.ANSWER:nested?isknownastheoperator.ANSWER:extractionIs?usedforinputoroutput?ANSWER:outputILThestreamthatisusedforinputfromthekeyboardiscalled.ANSWER:cinThestreamthatisusedforoutputtothescreeniscalled.ANSWER:coutWritetheloopconditiontocontinueawhileloopaslongasxisnegative.ANSWER:while(x<0)Whenmustweusebracestodefinethebodyofacontitionalexpression?ANSWER:Whentherearemultiplestatementsinthebody.Inacompoundlogicaland(&&)expression,theevaluationoftheexpressionstops^nce丨批注[WS31:trueonlyfor&&,notforoneofthetermsoftheexpressionisfalse.Thisisknownasevaluation. ||whereitlooksfortruenotfalseANSWER:shortY證uil[valuationL -jttft[MH4]:Iaddedthe(&&)tothequestionMultipleChoiceWhichofthefollowingisavalididentifier?3comthree_com3_com3-comdoUar$ ANSWER:CWhichofthefollowingisnotavalididentifer?returnmylntmyIntegertotaB ANSWER:AWhatisthevalueofxafterthefollowingstatements?intx,y,z;y=10;z=3;x=y*z+3;Garbage6030

d.33ANSWER:Dd.33Whatisthevalueofxafterthefollowingstatements?intx;x=0;x=x+30;03033Garbage ANSWER:BWhatisthevalueofxafterthefollowingstatements?intx;x=x+30;03033Garbage ANSWER:DWhatistheoutputofthefollowingcode?floatvalue;value=33.5;cout?value?endl;33.533valueGarbage ANSWER:AWhatistheoutputofthefollowingcode?floatvalue;value=33.5;cout?”value"?endl;33.533valueGarbage ANSWER:CWhatistheoutputofthefollowingcode?cout?"Thisisa\\"?endl;ThisisaThisisa\nothing,itisasyntaxerrorThisisa\endl ANSWER:BWhichofthefollowinglinescorrectlyreadsavaluefromthekeyboardandstoresitinthevariablenamedmyFloat?cin>>myFloat;cin?myFloat;cin?"myFloat";cin?myFloat?endl; ANSWER:A

Anotherwaytowritethevalue3452211903isa.3.452211903e09b.3.452211903e-09c.3.452211903x09d.3452211903e09ANSWER:A11.WhichofthefollowingstatementsisNOTlegal?a.charch二'b';b.charch=*0';c.charch=65;d.charch="ccM;ANSWER:D12.Whatisthevalueofxafterthefollowingstatements?floatx;x=15/4;a.3.75b.4.0c.3.0d.60ANSWER:C13.Whatisthevalueofxafterthefollowingstatements?intx;x=15/4;a.15b.3c.4d.3.75ANSWER:B14.Whatisthevalueofxafterthefollowingstatements?intx;x=15%4;a.15b.4c.3d.3.75ANSWER:C15.Whatisthevalueofxafterthefollowingstatement?floatx;x=3.0/4.0+3+2/5a.5.75b.5.75c.1.75d.3.75 ANSWER:D16.Whatisthevalueofxafterthefollowingstatement?floatx;x=3.0/4.0+(3+2)/5a.5.75b.5.75c.1.75

d.3.75 ANSWER:CWhatisthevalueofxafterthefollowingstatements?doublex;x=0;x+=3.0*4.0;x-=2.0;22.012.010.014.0 ANSWER:CGiventhefollowingcodefragmentandtheinputvalueof4.0,whatoutputisgenerated?floattax;floattotal;cout?"enterthecostoftheitem\n";cin?total;if(total>=3.0)(tax=0.10;cout?total+(total*tax)?endl;)else(cout?total?endl;)33.34.04.4 ANSWER:DGiventhefollowingcodefragmentandtheinputvalueof2.0,whatoutputisgenerated?floattax;floattotal;cout?"enterthecostoftheitem\n";cin?total;if(total>=3.0){tax=0.10;cout?total+(total*tax)?endl;}elsecout?total?endl;2.22.03.14.4ANSWER:B20.Ifxhasthevalueof3,yhasthevalueof-2,andwis10,isthefollowingconditiontrueorfalse?if(x<2&&w<y)a.trueb.FalseANSWER:BWhatisthecorrectwaytowritetheconditiony<x<z?(y<x<z)((y<x)&&z)((y>x)II(y<z))((y<x)&&(x<z)) ANSWER:DGiventhefollowingcodefragment,andaninputvalueof3,whatistheoutputthatisgenerated?intx;cout?'rEnteravalue\n";cin?x;if(x=0)!cout?"xiszero\n”;Ielsecout?"xisnotzero\n";)xiszeroxisnotzeroc.unabletodetermine23.d.xis3 ANSWER:A(noteitisan[assignmentGiventhefollowingcodefragment,andaninputvalueof5,whatistheoutput?intx;if(x<3)(cout?"smallXn";if(x<4)cout?”medium\n";批注(WS51:Buttheansweristhesameasifyouused=insteadof=.Maybeaninputof0?批注[MH6J:Ihadwittenthewronganswer!Itwillalwaysprintout*xiszero'elseif(x<6)cout?"lai^e\n";)else{cout?"giant\nH;}}}smallmediumlargeGiant ANSWER:CGiventhefollowingcodefragment,whatistheoutput?intx=5;if(x>5)cout?”xisbiggerthan5.cout?"Thatisall.coutvv"Goodbye\n";xisbiggerthan5.Thatisallxisbiggerthan5Thatisall.GoodbyeGoodbye ANSWER:CExecutingoneormorestatementsoneormoretimesisknownas:selectioniterationsequenceAlgorithm ANSWER:BGiventhefollowingcodefragment,whatisthefinalvalueofy?intx,y;x=-1;y=0;while(x<=3)1y+=2;x+=1;I210

d.8 ANSWER:同Giventhefollowingcodefragment,whatisthefinalvalueofy?intx,y;x=-1;y=0;while(x<3)V?^ー批注FWS7]:k'sV?^ー批注FWS7]:k'saninfiniteloop

批注LMH8J:Fixed.x+=1;}21068 ANSWER:回 ー批注[WS9]:anotherinfiniteloop,Whatistheoutputofthefollowingcodefragment? unlessImissedsomethingmx=°; 批注while(x<5)cout?x?endl;x++;cout?x?endk054unabletodetermine ANSWER:D(infiniteloop)Whatisthefinalvalueofxafterthefollowingfragmentofcodeexecutes?intx=0;do(x++;}while(x>0);891011infiniteloop ANSWER:同 通注[WSU]:“infiniteloop”mightGiventhefollowingcodefragment,whichofthefollowingexpressionsisalwaystrue? beclearerthan^unknown*'intx; 皿亠批注IMH12]:Fixedcin?x;if(x<3)if(x=l)if((x/3)>l)if(x=1) ANSWER:D

TRUE/FALSEAbooleanexpressionmayevaluatetomorethan2valuesANSWER:FALSEAfunctionmayreturnabooleanvalue.ANSWER:TRUEInanenumerateddatatype,differentconstantsmaynothavethesamevalue.ANSWER:FALSEThecompileralwayspairsanelsewithANSWER:thenearestpreviousifnotalreadypairedwithanelse.Allswitchstatementscanbeconvertedintonestedif-elsestatementsANSWER:TRUEAllnestedif-elsestatementscanbeconvertedintoswitchstatements.ANSWER:FALSEAbreakstatementinaswitchstopsyourprogram.ANSWER:FALSEItisillegaltomakefunctioncallsinsideaswitchstatement.ANSWER:FALSEAsemicolonbyitselfisavalidC++statement.ANSWER:TRUEThebreakstatementcausesallloopstoexit.ANSWER:FALSEShortAnswerAexpressionisanexpressionthatcanbethoughtofasbeingtrueorfalse.ANSWER:booleanisatypewhosevaluesaredefinedbyalistofconstantsoftypeint.ANSWER:enumerateddatatypeThecodefollowingthecaseisexecutedifnoneoftheothercasesarematchedinaswitchstatement.ANSWER:defaultAcompoundstatementthatcontainsvariabledeclarationsiscalleda.ANSWER:blockVariablesdefinedinsideasetofbracesaresaidtobetothatblockofcode.ANSWER:localEachrepetitionofaloopbodyiscalled.ANSWER:aniterationAloopalwaysexecutestheloopbodyatleastonce,irregardlessoftheloopcondition.ANSWER:do-whileAswitchstatementvariablemustbeANSWER:aninteger,bool,charorenumeratedtypeAloopthatiteratesonetoomanyoronetoofewtimesissaidtobeANSWER:offbyone

MultipleChoiceWhichbooleanoperationisdescribedbythefollowingtable?ABOperationTrueTrueTrueTrueFalseTrueFalseTrueTrueFalseFalseFalsea.orb.andc.notd.noneoftheabove2.Whichbooleanoperationisdescribedbythefollowingtable?ABOperationTrueTrueTrueTrueFalseFalseFalseTrueFalseFalseFalseFalseANSWER:AorANSWER:Aandnotnoneoftheabove ANSWER:BWhichofthefollowingsymbolshasthehighestprecedence?++II&&- ANSWER:AIfaprogramminglanguagedoesnotuseshort-circuitevaluation,whatistheoutputofthefollowingcodefragmentifthevalueofmylntis0?intother=3,mylnt;if(mylnt!=0&&other%mylnt!=0)cout?"otherisodd\n";elsecout?"otheriseven\n";otherisevenotherisodd0run-timeerror,nooutput ANSWER:DWhatisthevalueofthefollowingexpression?(true&&(4/3II!(6)))truefalse0illegalsyntax ANSWER:Aifxis0,whatisthevalueof(!x==0)?falsetrueunabletodetermineA ANSWER:AWhichofthefollowingareequivalentto(!(x<15&&y>=3))?(x>15&&y<=3)(x>=15&&y<3)(x>=15IIy<3)(x>15lly<3)CandD ANSWER:CWhichofthefollowingbooleanexpressionsteststoseeifxisbetween2and15(including2and15)?(x<=15IIx>=2)(2<=xllx<=15)(x>=2&&x<=15)(2<=x<=15) ANSWER:CGiventhefollowingenumerateddatatypedefinition,whatisthevalueofSAT?enummylype{SUN,MON,TUE,WED.THUR,FRI,SAT,NumDays);7685Unknown ANSWER:b1().Giventhefollowingenumerateddatatypedefinition,whatisthevalueofSAT?enummylype{SUN=3,MON=l,TUE=3,WED,THUR,FRLSATNumDays);7685Unknown ANSWER:AWhatistheoutputofthefollowingcodefragmentifxis15?if(x<20)if(x<10)coutvv"lessthan10elsecout?"large\n";lessthan10nothinglargenooutput,syntaxerror ANSWER:CWhatistheoutputofthefollowingcodefragment?inti=5;switch(i)(case0:i=15;break;casel:i=25;break;case2:i=35;break;case3:i=40;default:i=O;)cout?i?endl;1525354005 ANSWER:EWhatiswrongwiththefollowingswitchstatement?intans;cout?"lypeyforyesonnforno\n”;cin?ans;switch(ans)(case'y’:case'Y*:cout?"Ybusaidyes\n";break;case*n':caseN:cout?"Ybusaidno\n";break;default:cout?"invalidansweAn',;)ansisaintbreak;isillegalsyntaxnothingANSWER:Atherearenobreakstatementson2cases.ANSWER:AWhichofthefollowingdatatypescanbeusedinaswitchcontrollingexpression?b.charc.floatd.enume.doublefdandeaandba,banddalloftheabove ANSWER:HWhatistheoutputofthefollowingcodefragment?intx=0;{intx=13;cout?x}cout?x?endl;13,130,1313,0nothing,thereisasyntaxerror. ANSWER:CWhatistheoutputofthefollowingcodefragment?(intx=13;cout?x)cout?x?endl;13,130,1313,0nothing,thereisasyntaxerror. ANSWER:DWhatisthevalueofxafterthefollowingcodeexecutes?intx=10;if(x++>10)(x=13;11091311 ANSWER:AWhatisthevalueofxafterthefollowingcodeexecutes?intx=10;if(++x>IO)(x=13;)1091311 ANSWER:CHowmanytimesis"Hi"printedtothescreenfor(inti=0;i<14;i++);cout?"Hi\nM;1315141 ANSWER:DGiventhefollowingcode,whatisthefinalvalueofi?inti;fbr(i=O;i<=4;i++)(cout?i?endl;)3450 ANSWER:CGiventhefollowingcode,whatisthefinalvalueofi?inti,j;for(i=0;i<4;i++)(for(j=0;j<3;j++)if(i==2)break;3450 ANSWER:BWhichofthefollowingisnotagoodreasonforchoosingacertainloopcontrol?WhattheloopdoesTheminimumnumberofiterationsoftheloopTheconditionforendingtheloopIftheloopisinafunction ANSWER:DIfyouwantalooptoquititeratingifx<10andy>3,whatwouldbetheproperloopconditiontest?(x<10&&y>3)(x>10lly<3)(x>=10&&y<=3)(x>=10lly<=3) ANSWER:DIfyouneedtowriteado-whileloopthatwillasktheusertoenteranumberbetween2and5inclusive,andwillkeepaskinguntiltheuserentersacorrectnumber,whatistheloopcondition?(2<=num<=5)(2<5<number)(2<=number&&number<=5)(2<numberIInumber>5)(2>number&&number>5) ANSWER:DWhichloopstructurealwaysexecutesatleastonce?do-whilefbrwhileSentinel ANSWER:AWhichofthefollowingareallowedinthethirdsectionofthefbrloopstatement?i++i—i+=2cout?"Hello\n^^alloftheabovenoneoftheabove ANSWER:EWhichofthefollowingdatatypesmaybeusedinaswitchstatement?intcharenumlongalloftheaboveaandd ANSWER:EWhichofthefollowingarevalidcasestatementsinaswitch?case1:casex<4:c.case'ab':d.case1.5: ANSWER: AWhentestingaprogramwithaloop,whichofthefollowingtestsshouldbedone?noiterationsoftheloopsonelessthanthemaximumnumberofiterationsthemaximumnumberofiterationsonemorethanthemaximumnumberofiterationsAandBA,BandC ANSWER:FWhatiswrongwiththefollowingforloop?for(inti=0;i<10;i—)(cout?"Hello\nH;cannotuseafor-loopforthisiisnotinitializedinfiniteloopoff-by-oneerror ANSWER:CTRUEFALSEAfunctionmayreturnmorethanoneitemANSWER:FalsefunctionnamingrulesfollowvariablenamingrulesANSWER:TRUEEveryincludedirectivemustbefollowedbyusingnamespacestd;ANSWER:FalsethetypesofparametersareoptionalinthefunctiondeclarationANSWER:FalsetheparameternamesaremandatoryinthefunctionheaderANSWER:FalseitispossibletohaveafunctionthathasnoparametersANSWER:TRUEtheparameterslistedinthefunctiondeclarationareconsideredglobalvariablesANSWER:Falsevariablesthataredeclaredoutsideofanyfunctionbodyorparameterlistareconsideredglobal.ANSWER:TRUEpow(2,3)isthesameaspow(3,2).ANSWER:FalseFunctionsmayhavemultiplereturnstatements.ANSWER:TRUEFillIntheBlank#include<cmath>isknownasan.ANSWER:includedirectiveTheabsolutevaluefunctionabsislocatedinthelibrary.ANSWER:cstdlibConvertingfromonetypetoanotheriscalled.ANSWER:castingWhatisthevalueof(pow(2,sqrt(9.0)+ceil(0.99)))?ANSWER:16Writethecodetoconvertthevalueinanintegervariablenamedcounttoadouble.ANSWER:static_cast<double>(count)Inthefollowingfunctiondeclaration,thevariablesizeisknownasaintmyFunction(intsize);ANSWER:(formal)parameter

Thedescribeshowthefunctionwillwork.ANSWER:functionbodyWhenyouwanttouseafunctioninyourprogram,youwouldmakeafunctionANSWER:callorinvocationWhatistheoutputproducedbythefollowingcodefragment?inti=3;cout?"Thevalueofiis"?sqrt(pow(i,4.0))?endl;ANSWER:9.0Theblackboxanalagydemonstratestheconceptof.ANSWER:informationhidingorproceduralabstractionAproblem-solvingapproachthatstartswiththebigproblemandbreaksitdownintosmallerpiecesiscalled.ANSWER:top-downapproachAlgorithmsaretypicallydescribedin.ANSWER:psuedocodeVariblesthataredeclaredinsideafunctionaresaidtobetothatfunction.ANSWER:localTheofavariableiswherethatvariablecanbeused.ANSWER:scopeConstantvariablesthatmightbeusedindifferentfunctionsshouldbeANSWER:globalMultipleChoiceLWhatisthevalueofxafterthefollowingcodefragmentexecutes?floatx=36.0;x=sqrt(x);36.06.03.02.456 ANSWER:BWhatistheoutputofthefollowingprogramfragment?cout?pow(4,2)?endl;42816 ANSWER:DWhatistheoutputofthefollowingprogramfragment?cout?static_cast<double>(3)/4?endl;30.500.75 ANSWER:D

usingnamespacestd;tellsthecompilerwheretogetthedefinitionsofcertainobjects(variables)whereyourprogramislocatedwhatlanguagetousefbrinputandoutputNothing ANSWER:Athefabs(doublenum)functionreturnsthemostfabulousnumberreturnsthelargestwholenumber<=numreturnsthenegativevalueofnumreturnstheabsolutevalueofnum ANSWER:DWhatistheoutputofthefollowingprogramfragment?cout?static_cast<float>(3/4)?endl;30.50.00.75 ANSWER:CIfyouneedtowriteafunctionthatwillcomputethecostofsomecandy,whereeachpiececosts25cents,whichwouldbeanappropriatefunctiondeclaration?intcaIculateCost(charname);charcalculateCost(intcount);intcalculateCostintcount;intcalculateCost(intcount); ANSWER:DWhatisthevaluereturnedbythefollowingfunction?intfunction()(intvalue=35;returnvalue+5;value+=10;)35405010 ANSWER:BWhenoverloadingafunction,whatmustbetrue?Thenamesshouldbedifferentwiththesamenumberand/ortypesofparameters.Thenamesshouldbethesamewithdifferentnumberand/ortypesofparameters.Thenamesshouldbedifferentwithdifferentnumberand/ortypesofparameters.Thenamesshouldbethesamewiththesamenumberand/ortypesofparameters.ANSWER:BWhenparametersarepassedbetweenthecallingcodeandthecalledfunction,parametersandai^umentsarematchedby:theirdatatypestheirrelativepositionsintheparameterandargumentliststheirnamestheyarenotmatchedupatall.Ifyouhavethetwofunctionsasshown,intsomeFunction(intvalue);floatsomeFunction(floatvalue);andavariablex,whichisadouble,whichfunctioniscalledbythefollowingstatement?cout?someFunction(x);voidsomeFunction(intvalue);voidsomeFunction(floatvalue);Nothing,itisasyntaxerrord.bothfunctionsarecalled ANSWER:CWhichofthefollowingarevalidfunctioncallstothefabsfunction?a.fabs(3.5);cout?fabs(3.5);cin?fabs(3.5);fabs(cin?x);e.a,bandcf.aandb ANSWER:FMmase.Periods ANSWER:DThefunctionspow(),sqrt(),andfabs()arefoundinwhichincludefile?a.cstdlibb.cmathc.iostreamd.Regular ANSWER:BTheexpressionstatic_cast<double>(3)iscalledatypecastnultiplierc.doublerd.Polymorphism ANSWER:AIfthevariablexhastheoriginalvalueof3.4,whatisthevalueinxafterthefollowing?cout?static_cast<int>(x);3.44c.unknownd.3 ANSWER:DWhatisthevalueofthefollowing?floor(4.999)+ceil(2.0)a.6.999b.7.0c.6.0d.8.0ANSWER:CWhatisthevalueofthefollowing?sqrt(sqrt(pow(2,4)));12416 ANSWER:BUsingfunctionsinaprogramisknownasdataabstractionproceduralabstractionpoorprogrammingstyleCalculus ANSWER:BWhichofthefollowingarevalidfunctioncallstothepowfunction?pow(intx,inty);pow(2);pow(l.l,3.0);doublepow(l.1,3.0); ANSWER:CIfyouhavethefollowingvariabledeclarationinyourprogram,constintSIZE=34;thenwhichofthefollowingstatementsarelegal?SIZE++;x=SIZE-;cout?SIZE;cin?SIZE; ANSWER:CInthefunctiondeclarationshown,themechanismusedtocallthisfunctionisknownas:doublepow(doublebase,doubleexp);passbynamepassbyvaluepassbynamecallbynameANSWER:BWhatisthevalueofiafterthefollowingfunctioncall?//functiondefinitionintdoSomething(intvalue)(value=35;returnvalue;value=13//fragmentofmainprograminti=0;cout?doSomething(i);1335480 ANSWER:DWhichofthefollowingfunctionsisaproperlyoverloadedfunctionofthefollowing?intdoSomething(intfirst,floatsecond);floatdoSomething(intfirst,floatsecond);intdoSomething(intnext,floatlast);intdoSomething(intfirst,intsecond,floatthird);ANSWER:CintdoSome(intfirst,floatsecond)ANSWER:C25.Whatistheoutputofthefollowingcodefragement?25.doublesize,volume=16.0;size=sqrt(sqrt(volume))/3;cout.setf(ios::fixed)cout.setf(ios::showpoint);cout.precision(2);cout?size;0.670.66666670.000 ANSWER:AWhichofthefollowingarenotlegalfunctiondeclarations?ave3(inta,intb,intc);3ave(inta,intb,intc);ave3(int,int,int);ave_3(intal,inta2,inta3); ANSWER:BInformationHidingisanalogoustousinganalgorithmicdesignablack-boxmethodologyformalparametersactualparameters ANSWER:BWhenthefunctionbelowiscalled,theoftheactualparametersispassedtothefunctiondefinition.doublesqrt(doublevalue);b.valuec.addressd.Scope ANSWER:B29.Whenavariableislocaltoafunction,wesaythatithas ofthefunctiona.valueb.ConstancescopeLocality ANSWER:C30.Whatistheoutputofthefollowingfunctioncall?//functionbodyintfactorial(intn)(intproduct=0;while(n>0)(product=product*n;n—;)returnproduct;1//functioncallut?factorial(4);402448 ANSWER:BTRUE/FALSEAvoidfunctioncanreturnanyvalueANSWER:FALSEAvoidfunctioncanbeusedinanassignment.ANSWER:FALSEAvoidfunctionmaynotbeusedinanoutputstatement.ANSWER:TRUEFunctionscanreturnatmostonevalue.ANSWER:TRUEThefollowingislegalinavoidfunctionreturn;ANSWER:TRUEInafunctionwithcalI-by-referenceparameters,thevaluesoftheactuala唔umentsarepassedtothefunction.ANSWER:FALSE,Theactualvariables(ormorepreciselytheirmemoryaddresses)arepassed.Inafunctionwithcall-by-referenceparameters,anychangestotheformalparameterswillchangetheactuala喀umentspassedtothefunction.ANSWER:TRUEItisacceptabletohavebothcall-by-valueandcall-by-referenceparametersinthesamefunctiondeclaration.ANSWER:TrueItisillegaltocallotherfunctionsfrominsideafunctiondefinition.ANSWER:FALSEAstubisafunctionthatiscompletelydefinedandwelltestedANSWER:FALSESHORTANSWERAisamainprogramthatonlychecksthatfunctionsexecutecorrectly.ANSWER:driverThevaluesorvariableslistedinthefunctiondeclarationarecalledtothefunction.ANSWER:(formal)parametersGiventhefollowingfunctiondefinitionfragment,forwhichvalu

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論