版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
第1题WhichofthefollowingisnotthestandardofClanguage?
AK&RCBC89/C90,C99CISO/IEC9899:2011DNativeC第2题WhencompileaCprogram,thecommentswill
.AbecompiledandappearintheobjectcodeBbecompiled,butnotappearintheobjectcodeCnotbecompiledandnotappearintheobjectcodeDnotbecompiled,butappearintheobjectcode第3题AfilewrittenbyClanguage
.Acanbeexecutedimmediately.Bisasourceprogram.CcanbeexecutedaftercompilationDcanbeexecutedaftercompilationandinterpretation.
第4题WhichofthefollowinglanguagescanberecognizedbyCPUdirectly?AnaturelanguageBadvancedlanguageCmachinelanguageDassemblylanguage第5题ManyprogramminglanguagesborrowheavilyformClanguage,includingC++,Java,C#andPerl.第6题BywritingCcompilersforothercomputers,Cprogramcanberunindifferentplatforms.第7题OneofC’sadvantagesisefficiency.BecauseCwasintendedforapplicationswhereassemblylanguagehadtraditionallybeenused,itwascrucialthatCprogramscouldrunquicklyandinlimitedamountsofmemory.
第8题C’sweaknessesarisefromthesamesourceasmanyofitsstrengths:C’sclosenesstothemachine.第1题WhichofthefollowingisalegalCidentifier?()A1stuNPUBStu@NPUCstu-NPUD_stu_NPU第2题Whichofthefollowingprogramisright?()A#includeintmain();{/*programming*/printf("programming!\n");return0;}B#includeintmain(){/*programming*/printf("programming!\n");return0;}Cincludevoidmain(){/*programming*/printf("programming!\n");return0;}D#includeintmian(){/*programming*/printf("programming!\n");return0;}第3题Whichofthefollowingstatementiswrong?()AKeywordscanbeusedasidentifiersinClanguage.BIdentifiersinClanguagemustbeginwithaletterorunderscore.CCiscase-sensitive.DCplacesnolimitonthemaximumlengthofanidentifier.第4题TheextendedASCIIcharactersetusesonebytetorepresentcharacter,thereforethenumberofcharactersthattheextendedASCIIcharactercanrepresentis().()A1024B256C128D80第5题WhichofthefollowingisnotaconstantinClanguage?()A'AB'B012C"a"D'\n'第6题WhichofthefollowingisnotafloatconstantinClanguage?()A-2.38B.23C1.2e-2De-2第7题WhichofthefollowingisnotkeywordinClanguage?()AdoBintCvoidDmain第8题Thethreeidentifiers,weight,WeightandWEIGHT,areequalinClanguage.()Quiz3Operator&Expression第1题InClanguage,whichofthefollowingoperatorrequiresitsoperandsmustbeoftypeint?()A/B*C%D=第2题Ofwhichoperationtheprecedenceishigherthanothers’?()A()B%C++D,第3题Supposeintk=7,x=12;ofwhichexpressionthevalueis3?()Ax%=(k%=5)Bx%=(k-k%5)Cx%=k-k%5D(x%=k)-(k%=5)第4题Thevalueoftheexpression3.6-5/2+1.2+5%2is____.A4.3B4.8C3.3D3.8第5题Givenastatementf=(3.0,4.0,5.0),(2.0,1.0,0.0);,whichofthefollowingconclusionisright?()AThisstatementhassyntaxerrorBThevalueoffis5.0.CThevalueoffis0.0.DThevalueoffis2.0.第6题Supposeallvariablesinthefollowingexpressionshavebeendeclaredandinitialized,whichofthefollowingisnotalegalexpressioninClanguage?()Aa:=b+1Ba=(2,b=c+2)C(int)18.5%3Da=b+=c+b第7题Ifanexpressionisthesumoffourdataofdifferenttypes,includingint,long,doubleandchar,theexpression'stypeis____.AintBlongCdoubleDchar第8题Theexpressions++iandi++areexactlythesameas(i+=1).Quiz4FormattedInputandOutput第1题Ifcisavariableoftypechar,whichoneofthefollowingstatementsisillegal?Ai+=c;/*ihastypeint*/Bc=2*c–1;Cputchar(c);Dprintf(c);第2题Supposethatwecallscanfasfollows:scanf(“%d%f%d”,&i,&x,&j);Iftheuserenters:10.893↙
Whatwillbethevaluesofi,x,andjafterthecall?(Assumethatiandjareintvariablesandxisafloatvariable.↙isusedtorepresentEnterkey)
A100.89B1093C1193D10.893第3题Supposethatwecallscanf
asfollows:scanf(“%f%d%f”,&x,&i,&y);Iftheuserenters:12.345.6789What
willbethevaluesofx,i,andyafterthecall?(Assumethatxandyarefloat
variablesandi
isanint
variable.
↙isusedtorepresentEnterkey)A12.345789B12.345.6789C1245789D12.3450.6第4题Whichoneofthefollowingiscorrect?ATheoutputitemmustbegivenwhencallingfunctionprintf.BTheheaderfilestdio.hmustbeincludedbeforecallingfunctionputchar.CInClanguage,integerscanbeoutputinvariousforms,e.g.decimal,binary,octalandhexadecimal.DWhencallingfunctiongetchar
toreadinacharacter,wecaninputitscorrespondingASCIIcode.第5题Assumingthefollowingstatements:charc1='1',c2='2';c1=getchar();c2=getchar();putchar(c1);putchar(c2);Ifinputa└┘↙
whenrunthecode,↙isusedtorepresentEnterkey,└┘
isusedtorepresentspace,whichoneofthefollowingstatementsiscorrect?AVariable
c1isassignedthecharacter
a,andc2
isassignedthe
spacecharacter.BTheprogramwillwaitforthesecondcharacterinputbyuser.CVariable
c1isassignedthecharacter
a,andc2
remainsthecharacter2.DVariable
c1isassignedthecharacter
a,andc2
remainsuncertainvalue.第6题Giventhefollowingdeclarationsandscanf
functioncallstatements,tomakethevalueofa1,a2,c1,c2
tobe10,20,A
andB
respectively.Whichoneofthefollowinginputsiscorrect?↙isusedtorepresentEnterkeyand└┘
isusedtorepresenta1,a2;charc1,c2;scanf("%d%d",&a1,&a2);scanf("%c%c",&c1,&c2);A1020AB↙B10└┘20↙AB↙C10└┘20└┘AB↙D10└┘20AB↙第7题Assuming
thestatementscanf("a=%d,b=%d,c=%d",&a,&b,&c);
Tomakethevaluesofa,b,andctobe1,3,2respectively,whichofthefollowinginputiscorrect?↙isusedtorepresentEnterkeyand└┘isusedtorepresentspace.A132↙B1,3,2↙Ca=1└┘b=3└┘c=2↙Da=1,b=3,c=2↙第8题Ifthevariablex
isoftypedouble,whichoneofthefollowingstatementsisright?Ascanf("%f",x);Bscanf("%f",&x);Cscanf("%lf",&x);Dscanf("%5.1f",&x);第9题Whatistheoutputofthefollowingcode?└┘isusedtorepresentspace.floatx=-1023.012;printf("%8.3f,",x);printf("%10.3f",x);A1023.012,-1023.012B–1023.012,-1023.012C1023.012,└┘-1023.012D–1023.012,└┘-1023.012第10题Whatistheoutputofthefollowingcode?intx=13,y=5;printf("%d",x%=(y/=2));A3B2C1D0第11题Ifwedeclaredinta=1234;,whatistheresultwhenexecutingthestatementprintf("%2d",a);?A12B34C1234DError第12题Whatistheoutputofthefollowingcode?inta;charc=10;floatf=100.0;doublex;a=f/=c*=(x=6.5);printf("%d%d%3.1f%3.1f",a,c,f,x);A16516.5B1651.56.5C1651.06.5D2651.56.5第13题Executethefollowingstatements,ifinput12345678↙,whatistheoutput?inta,b;scanf("%2d%*2d%3d",&a,&b);printf("%d",a+b);A46B579C5690DError第14题Ccompilersare
requiredtocheckthatthenumberofconversionspecificationsinaformatstringmatchesthenumberofoutputitems.第15题Iftheformatstringis“%d\n”,scanf
willskipwhitespace,readaninteger,andthen
skiptothenextnon-white-spacecharacter.Soaformatstringlikethiscancauseaninteractiveprogramto“hang”
untiltheuserentersanonblankcharacter.Quiz5SelectionStructure第1题Aftertheexecution
ofthefollowingstatements:inta=1,b=2,c=3,d=4,m=2,n=2,
cond;
cond=(m=a>b)&&(n=c>d);,whichoneofthefollowingvalueisequaltothevalueofn?A1B2C3D4第2题Supposei
isavariable
oftypeint,anditsvalueis10,whichofthefollowingisthevalueofexpression30-i<=i<=9
?A0B1C9D20第3题Aftertheexecution
ofthefollowingstatements:
inta=0,b=0,m=0,n=0;
(m=a==b)||(n=b==a);,thevalues
ofmandn
are
and
respectively?A00B01C10D11第4题Whichofthefollowing
isequal
totheexpression
!x
?Ax==1Bx==0Cx!=1Dx!=0第5题Suppose
intx=3,y=4,z=5;,whichofthefollowingisthevalueoftheexpression!(x+y)+z-1&&y+z/2
?A6B2C1D0第6题WhichofthefollowingisnotalegalexpressioninClanguage?A0<=x<100Bi=j==0C(char)(x<100)Dx+1=x+1第7题Theexpressioninif(expression)
canbe
.Alogical
expressionBrelationalexpressionCarithmeticexpressionDanyoftheabove第8题When
executethefollowingprogram:#include<stdio.h>intmain(){
intx,y;
scanf("%d%d",&x,&y);
if(x>y)x=y;y=x;
elsex++;y++;
printf("%d,%d",x,y);
return0;}Whichoneofthefollowingiscorrect?ASyntaxerrorwhilecompilingBIf
input3and4,itoutputs4and5CIf
input4and3,itoutputs3and4DIf
input4and3,itoutputs4and5第9题InClanguage,theruleonembeddedifstatementis
that
else
isalwayspairedwith(
).AthepreviousnearestunpairedifBthefirstifCif
withthesameindentDthemostfrontif第10题Which
one
iscorrectwhen
execute
thefollowingcode?intx=0,y=0,z=0;if(x=y+z)printf("***");elseprintf("###");ASyntaxerrorwhilecompilingBItoutputs***CErrorwhilelinkingDItoutputs###第11题Ifa=1,b=3,c=5,d=4,thevalue
of
xis
when
executethefollowingprogram.if(a<b)
if(c<d)x=1;
else
if(a<c)if(b<d)x=2;elsex=3;
elsex=6;elsex=7;A1B2C3D4第12题Whichoneofthefollowingisequaltothestatement
y=(x>0?1:x<0?-1:0);
.Ay=0;if(x>=0)if(x>0)y=1;elsey=-1;Bif(x)if(x>0)y=1;elseif(x<0)y=-1;elsey=0;Cy=-1;if(x)if(x>0)y=1;elseif(x==0)y=0;
elsey=-1;Dif(x>0)y=1;elseif(x<0)y=-1;elsey=0;第13题Whatistheoutputofthefollowingprogram?#include<stdio.h>intmain(){
intx=1,y=0,a=0,b=0;
switch(x){
case1:switch(y){case0:a++;break;case1:b++;break;}
case2:a++;b++;break;
case3:a++;b++;}
printf("a=%d,b=%d",a,b);
return0;}Aa=1,b=0Ba=2,b=1Ca=1,b=1Da=2,b=2第14题Ifinti=10;thevalue
of
iwillbe
afterexecutingthefollowingcode.switch(i){
case
9:i+=1;case10:i+=1;case11:i+=1;default:i+=1;}A10B11C12D13第15题Giventhedeclaration:floatw;inta,
b;
,whichoneofthefollowingisa
legalswitch
statement?Aswitch(w){case1.0:printf("*\n");case2.0:printf("**\n");}Bswitch(a);{case1:printf("*\n");case2:printf("**\n");}Cswitch(b){case1:printf("*\n");
default:printf("\n");case1+2:printf("**\n");}Dswitch(a+b);{case1:printf("*\n");case2:printf("**\n");default:printf("\n");}第16题
Ifinti=1;thevalueofi
willbe
afterexecutingthefollowingcode.switch(i){
case
'1':i+=1;
case
'2':i+=1;
case
'3':i+=1;
default
:i+=1;}A2B3C4D5第17题Aftertheexecutionofthefollowingstatements:inti=5,j=4,k=6;floatf;f=(i<j&&j<k)?i:(j<k)?j:k;,whichoneofthefollowingvalueisequaltothevalueoff?A4.0B5.0C6.0D7.0第18题Aftertheexecutionofthefollowingstatements:intm1=5,m2=3;m1>m2?(m1=1):(m2=-1);,thevaluesofm1andm2
are
respectively?A1and3B1and-1C5and-1D5and3第19题switch
statementscanbetotallyreplacedby
ifstatementsatanytime.第20题Theexpressioninacaselabel
ofaswitchstatementmustbeconstantexpression.第21题Thestatement
ifandswitch
canbeembedded.第22题Theconditionalexpressionandif
statementcanbetotallyreplacedbyeachother.
第23题Duplicatecaselabelsaren’tallowed
inswitch
statement.第24题Inswitch
statement,severalcase
canexecutethesameprogramsegment.第25题Thecontrollingexpression
inswitch
statementcanbeanexpressionofanytype.第26题Thecase
branchinswitch
statementcanbeacompound
statementormultiplystatement
sequence.第27题Withoutbreak
(orsomeotherjumpstatement)attheendofacase,controlwillflowintothenextcase.
Quiz6LoopStructure第1题Whatistheoutputofthefollowingprogram?#include<stdio.h>intmain(){intx=0,y=5,z=3;while(z-->0&&++x<5)
y=y-1;printf("%d,%d,%d",x,y,z);
return0;}A3,2,0B3,2,-1C4,3,-1D5,-2,-5第2题Whichoneofthefollowingcontainsaninfiniteloop?A
for(i=1;;){if(i++%2==0)continue;if(i++%3==0)break;}B
for(i=1;;)if(++i<10)continue;Ci=32767;do{if(i<0)break;}while(++i);Di=1;while(i--);第3题Thefollowingcode
.
x=-1;do{
x=x*x;}while(!x);AisaninfiniteloopBloopsfor2timesCloopsfor1timeDhassyntaxerror第4题Whichoneofthefollowingstatementsiscorrect?Adostatementcannotbereplacedbytheotheriterationstatements.Bdostatementcanonlybeterminatedbybreakstatement.Cdostatementwillbeterminatedwhenitscontrollingexpressionisnon-zero.Ddostatementwillbeterminatedwhenitscontrollingexpressioniszero第5题Assumethefollowingcode:intn=0,p;do{
scanf("%d",&p);
n++;}
while(p!=12345&&n<3);Apisnotequalto12345andnislessthan3Bpisequalto12345andnisnotlessthan3Cpisnotequalto12345ornislessthan3Dpisequalto12345ornisnotlessthan3第6题Giventhefollowingforstatement:inti,k;for(i=0,k=-1;k=1;i++,k++)printf("***");Whichoneofthefollowingconclusionsiscorrect?ATheaboveforstatementcontainsillegalexpression.BTheaboveforstatementisaninfiniteloop.CTheaboveforstatementloopsfor1time.DTheaboveforstatementneverloops.第7题Thelooptimesofthefollowingforstatementare
.for(i=2;i==0;)printf("%d",i--);AinfiniteB0C1D2第8题Whatistheoutputofthefollowingprogram?#include<stdio.h>intmain(){inti,sum;for(i=1;i<6;i++)sum+=i;printf("%d",sum);
return0;}AunpredictableB0C14D15第9题Assumes,a,b,caredeclaredasintegers,anda,chavebeenassignedvalues(c>0),s=a;for(b=1;b<=c;b++)s=s+1;Whichoneofthefollowingisequaltotheabovecode?As=a+b;Bs=a+c;Cs=s+c;Ds=b+c;第10题Whatistheoutputofthefollowingprogram?#include<stdio.h>intmain(){inti=0,s=0;for(;;){
if(i==3||i==5)continue;
if(i==6)break;
i++;
s+=i;};printf("%d",s);
return0;}A10B13C21DItcontainsaninfiniteloopandwillnotoutputanything.第11题Ifthevariablesiandphavebeendeclaredandinitializedcorrectly,whichoneofthefollowingcannotcalculate5!?Afor(i=1,p=1;i<=5;i++)p*=i;Bfor(i=1;i<=5;i++){p=1;p*=i;}Ci=1;p=1;while(i<=5){p*=i;i++;}Di=1;p=1;do{p*=i;i++;}while(i<=5);第12题Inthefollowingprograms,whichonehasthedifferentoutputwiththeothers’?Ak=1while(1){s+=k;k=k+1;if(k>100)break;}printf("%d",s);Bk=1;Repeat:s+=k;if(++k<=100)
gotoRepeatprintf("%d",s);Cintk,s=0;for(k=1;k<=100;s+=++k);printf("%d",s);Dk=1;do{s+=k;}while(++k<=100);printf("%d",s);第13题Whatistheoutputofthefollowingprogram?#include<stdio.h>intmain(){intk=0,m=0,i,j;for(i=0;i<2;i++){
for(j=0;j<3;j++)k++;
k-=j;}m=i+j;printf("k=%d,m=%d",k,m);
return0;}Ak=0,m=3Bk=0,m=5Ck=1,m=3Dk=1,m=5第14题Whichoneofthefollowingisnotcorrect?AThestatementsinClanguage,exceptcompoundstatements,mustbeendedwithsemicolons.BAnemptystatementdoesnotaffecttheprograminanylocation.CCompoundstatementsareregardedasonesinglestatementinsyntax.DAnassignmentstatementcanbemadebyaddingasemicolonattheendoftheassignmentexpression.第15题Assumethefollowingprogramfragment:intk=2;while(k=0){
printf("%d",k);
k--;}Whichoneofthefollowingiscorrect?Awhilestatementloopsfor10times.BTheloopisinfinite.CTheloopneverruns.DThelooprunsforonlyonetime.第16题whileindostatementcanbeomittedsometimes.第17题Anyofthe3expressionsinforloopcanbeomitted,andsoiswhileanddostatement’scontrollingexpression.第18题Themostpowerfuliterationstatementisforstatement.第19题Theloopbodyintheforstatementwillbeexecutedatleastonce.第20题breakcanbeusedinswitchstatementsandloops(while,do,andfor),whereascontinueislimitedtoloops.Quiz7Preprocessing第1题Whichoneofthefollowingstatementsiswrong?APreprocessingdirectivemustbeginwith#.BAlinewhichbeginswith#inCprogramisapreprocessingdirective.CThepreprocessingdirectivesinCprogramareprocessedduringexecuting.DPreprocessingdirectivescanappearinanylineofaCprogram.第2题Whichoneofthefollowingstatementsaboutmacrosubstituteiswrong?AMacrosubstitutedoesnotoccupytheexecutingtime.BMacronamedoesnothavedatatypeCMacrosubstitutionisjuststringsubstitution.DMacrosmustbenamedwithcapitalletters第3题Assumingwehave#defineL(x)2*3.14*x,thusL(x)is
.AfunctionnameBfunctioninvokingCmacrowithnoargumentsDmacrowithargument第4题Assumingwehave#defineP(x)x/x,whatistheoutputafterexecutingprintf("%d",P(4+6));?A1B8.5C11D11.5第5题Assumingthemacrodefinition#defineMOD(x,y)x%y,whatistheresultofthefollowingcode?intz,a=15;floatb=100;z=MOD(b,a);printf("%d",z++);A11B10C6DSyntaxerror第6题Whichoneofthefollowingmacroforsquarecalculationwillnotcauseambiguityinanycase?A#definePOWER(x)
x*xB#definePOWER(x)
(x)*(x)C#definePOWER(x)
(x*x)D#definePOWER(x)
((x)*(x))第7题Givenamacrodefinitionasfollows:#defineN3#defineY(n)((N+1)*n)whichoneofthefollowingisthevalueoftheexpression2*(N+Y(5+1))?
AerrorB42C48D54第8题Givenamacrodefinition#definep(x,y,z)x=y*z;thesubstitutionp(a,x+5,y-3.1)willbe
Aa=x+5*y-3.1;Ba=(x+5)*(y-3.1);Ca=x+5*y-3.1Da=(x+5)*(y-3.1)第9题Inthefileincludingpreprocessingdirectives,whenthefilenameisenclosedbydoublequotesafter#include,thefilewillbesearched.AinthestandardsearchingdirectoryofsystemsettingBinthesourcefiledirectoryfirst,thenthestandarddirectorysearchingofsystemsettingConlyinthesourcefiledirectoryDonlyinthecurrentdirectory第10题Inthefileincludingpreprocessingdirectives,whenthefilenameisenclosedbyanglebracketafter#include,thefilewillbesearched.AinthestandardsearchingdirectoryofsystemsettingBinthesourcefiledirectoryfirst,thenthestandarddirectorysearchingofsystemsettingConlyinthesourcefiledirectoryDonlyinthecurrentdirectory第11题Macrosubstitutiondoesnothavetypeproblem,anditsargumentsareofnotypeeither.第12题InClanguagestandardlibraryheaderfiles,manysystemfunctionprototypearedeclared.Therefore,aslongasthesefunctionsareusedintheprogram,theseheaderfilesshouldbeincluded,forcheckingthefunctioncallingbycompilingsystem.第13题#includedirectivecanincludeaCsourcefilewithfunctiondefinition.第14题Theheaderfilesincludedby#includemusthavethesuffix.h.Quiz8Array第1题Whenindexanarrayelement,whichoneofthefollowingstatementsiswrong?AThearraysubscriptcanbeintegerconstantBThearraysubscriptcanbeintegerexpressionCThearraysubscriptcanbeintegerconstantorintegerexpressionDThearraysubscriptcanbeexpressionofanytypes第2题WhichoneofthefollowingdeclarationscandefineaonedimensionalarrayacorrectlyinC89?Ainta(10);Bintn=10,a[n];Cintn;scanf("%d",&n);inta[n];D#defineSIZE10inta[SIZE];第3题Assumeadeclarationinta[10];,whichoneofthefollowingcanreferencetheelementin
a
correctly?Aa[10]Ba[3]Ca(5)Da[-10]第4题Whichoneofthefollowingstatementsiswrong?AInC,thearrayscannotbeassignedvaluesintegrallyinanassignmentstatement.BArraynamerepresentsthestartingaddressofthisarrayinthememory,whichcannotbechanged.CIftheindexofanarrayelementexceedstherangepre-defined,systemwillgiveanerrormessage“arrayindexoutofbounds”,whileexecuting.DThelengthofanarraycanbedeterminedbyinitializer.第5题Assumethedeclaration
inta[3][4];whichoneofthefollowingcanindextheelementinacorrectly?Aa[2][4]Ba[3][3]Ca[0][0]Da[3][4]第6题Assumethedeclaration
inta[3][4]={0};whichoneofthefollowingstatementsiscorrect?AOnlytheelement
a[0][0]
isinitializedto0.BItisawrongstatement.CEachelementin
ais
initializedbutnotto0.DEachelementinaisinitializedto0.第7题Ifa2-Darrayahasmcolumns,theformulatoindextheelement
a[i][j]
is___.Ai*m+jBj*m+iCi*m+j-1Di*m+j+1第8题Whatistheoutputofthefollowingcode?intk,a[3][3]={1,2,3,4,5,6,7,8,9};for(k=0;k<3;k++)printf("%d",a[k][2-k]);A357B369C159D147第9题Whichoneofthefollowinginitializationiscorrectforthe2-Darraya?Ainta[3][3]={};Binta[2][2]={1,2,3,4,5,6};Cinta[3][3]={1,2,3,4,5,6};Dinta[2,3]={1,2,3,4,5,6};第10题Assumethedeclaration
int
b[]={1,2,[8]=3,4,5,[15]=1,6,7};thelengthofarray
b
is_____.A8B17C18DuncertainQuiz9Function第1题Whichoneofthefollowingstatementsaboutfunctionisright?AEveryfunctioncanbecalledbytheotherfunctions,includingmainfunction.BEveryfunctioncanbecompiledseparately.CEveryfunctioncanberunseparately.DAfunctioncanbedefinedinthefunctionbodyofanotherfunction.
第2题Whichoneofthefollowingstatementsisright?AFunctiondefinitionscanbenested,butfunctioncallscannotbenested.BFunctiondefinitionscannotbenested,butfunctioncallscanbenested.CBothfunctiondefinitionsandfunctioncallscannotbenested.DBothfunctiondefinitionsandfunctioncallscanbenested.第3题Whichoneofthefollowingfunctiondefinitionsisright?Adoublef(intx,inty)
{
z=x+y;
returnz;
}Bdoublef(intx,y){doublez=x+y;returnz;}Cdoublef(x,y){
intx,y;doublez;z=x+y;returnz;
}Ddoublef(intx,inty){
doublez;
z=x+y;
returnz;}第4题Ifcallafunction
intf(),whichdoesnotcontainany
return
statement,whichoneofthefollowingconclusionsisright?AThisfunctiondoesnotreturnanyvalue.BThisfunctionreturnsasystemdefaultvalue.CThisfunctionreturnsthevalue0.DThisfunctionreturnsanunpredictablevalue.第5题WhichoneofthefollowingdeterminesthereturntypeofafunctioninClanguage?ATheexpressiontypeinthereturnstatementBThecallingfunctionCCompilerDThereturntypespecifiedbyfunctiondefinition第6题Whichoneofthefollowingstatementsaboutfunctionreturntypeiswrong?AFunctionreturntypecanbeint.BFunctionreturntypecanbearray.CFunctionreturntypecanbechar.DFunctionreturntypecanbevoid.第7题Whichoneofthefollowingstatementsiswrong?AActualparametercanbeaconstant,avariableoranexpression.BFormalparametercanbeaconstant,avariableoranexpression.CFormalparametercanbeofanytype.DThedatatypesofformalparameterandactualparametercanbedifferent.第8题Whichoneofthefollowingisright?AAfunctioncallmustreturnavalue.BActualparameterandformalparametercanhavethesamename.CThedatapassedinfunctionscannotbeglobalvariables.DThecallingfunctionandthecalledfunctionmustbeinthesamefile.第9题Givenafunctiondefinitionasfollows:voidf(charch,floatx){......},whichoneofthefollowingfunctioncallstatementsisright?Af("abc",3.0);Bt=f('D',16.5);Cf('65',2.8);Df(32,32);第10题Assumeaprogramdefinesafunctionasfollows:doublef(doublea,doubleb){return(a+b);},butthedefinitioniswrittenaftercallingf.Therefore,fshouldbedeclaredbeforethecalling.Whichoneofthefollowingprototypesiswrong?Adoublef(doublea,B);Bdoublef(double,double);Cdoublef(doubleb,doubleA);Ddoublef(doublex,doubley);第11题Whichoneofthefollowingstatementsaboutfunctiondeclarationiswrong?AIfthedefinitionofafunctionprecedeitscalls,itsfunctiondeclarationisnotrequired.BAfunctionprototypedoesn’thavetospecifythenamesofthefunction’sparameters,aslongastheirtypesarepresent.CC99hasadoptedtherulethateitheradeclarationoradefinitionofafunctionmustbepresentpriortoanycallofthefunction.DFunctionprototypesofstandardCfunctionsarenotrequired.第12题Ifthearraynameisusedforanactualparameterinafunctioncalling,whichoneofthefollowingwillbedeliveredtothecorrespondingformalparameter?Athestartingaddressofthearray.Bthevalueofthe1stelementinthearray.CalltheelementvaluesinthearrayDthenumberoftheelementsinthearray.第13题Giventhefollowingcodeinthemainfunction,whichoneofthefollowingisanincorrectdeclarationoftheformalargumentinfunctionf?inta[3][4];f(a);Af(intarray[3][4])Bf(intarray[][4])Cf(intarray[3][])Df(intarray[4][3])第14题Readthefollowingprogram:intfun1(doublea){returna*=a;}intfun2(doublex,doubley){doublea=0,b=0;a=fun1(x);b=fun1(y);return(int)(a+b);}ifwisavariableoftypedouble,whatisthevalueofw,afterexecutingthestatementw=fun2(1.1,2.0);?A5.21B5C5.0D0.0第15题Bothfunctiondefinitionandfunctioncallcanbenested.第16题Afunctionmusthaveareturnvalue,otherwiseitcannotbedefinedasafunction.第17题Specifyingthatthereturntypeisvoidindicatesthatthefunctiondoesn’treturnavalue.Quiz10Pointers第1题Thepointerofavariableindicatesthe
ofthevariable.AvalueBaddressCnameDasymbol第2题Givenintk=2;int*ptr1,*ptr2;andbothptr1andptr2pointtothevariablek,whichoneofthefollowingassignmentsisnotcorrect?
Ak=*ptr1+*ptr2Bptr2=kCptr1=ptr2Dk=*ptr1*(*ptr2)第3题Givenint*p,m=5,n;whichoneofthefollowingstatementsisright?
Ap=&n;scanf("%d",&p);Bp=&n;scanf("%d",*p);Cscanf("%d",&n);
*p=n;Dp=&n;*p=m;第4题Givenint*p,a=4;andp=&a;inwhichoneofthefollowing,allitemsindicateaddresses?Aa,p,*&aB&*a,&a,*pC*&p,*p,&aD&a,&*p,p第5题Ifapointerppointstoavariablex,whichoneofthefollowingisequalto*&x?
AxBpC&xD&*p第6题Ifthepointerppointstoanintegervariablex,whichoneofthefollowingisequalto(*p)++?Ax++Bp++C*(p++)D&x++第7题Fortwopointervariablesofthesamebasetype,whichoneofthefollowingoperationscannotbedone?A<B=C+D-第8题Giventhefollowingfunctionandthevariabledeclarationinta=25;whichoneofthefollowingistheresultofthestatementprint_value(&a);?voidprint_value(int*x){printf("%d",++*x);}A23B24C25D26第9题Givenchars[10];whichoneofthefollowingisnottheaddressofs[1]?
As+1Bs++C&s[0]+1D&s[1]第10题Giveninta[5],*p=a;whichoneofthefollowingisacorrectreferencetoanelementinarraya?A*&a[5]Ba+2C*(p+5)D*(a+2)第11题Giveninta[5],*p=a;whichoneofthefollowingisacorrectreferencetotheaddressofanelementinarraya?
Ap+5B*a+1C&a+1D&a[0]第12题Givenintx[]={1,2,3,4,5,6,7,8,9,0},*p=x,k;andkislargerthanorequalto0andlessthan10,whichoneofthefollowingisawrongreferencetothearrayelementx[k]?
Ap+kB*(x+k)Cx[p-x+k]D*(&x[k])第13题Givenintx[6]={2,4,6,8,5,7},*p=x,i;whichoneofthefollowingcodecannotoutputthe6elementsinarrayxinorder?Afor(i=0;i<6;i++)printf("%2d",*(p++));Bfor(i=0;i<6;i++)printf("%2d",*(p+i));Cfor(i=0;i<6;i++)printf("%2d",*p++);Dfor(i=0;i<6;i++)printf("%2d",(*p)++);第14题Giveninta[2][3];whichoneofthefollowingisacorrectreferencetotheaddressoftheelementini-throwandj-thcolumnofarraya?A*(a[i]+j)B(a+i)C*(a+j)Da[i]+j第15题Giveninta=3,b,*p=&a;whichoneofthefollowingstatementsdoesn’tassignthevalue3tob?
Ab=*&a;Bb=*p;Cb=a;Db=*a;第16题Giveninta[4][5];whichoneofthefollowingreferencesisincorrect?
A*aB*(*(a+2)+3)C&a[2][3]D++a第17题Giveninta[2][3],(*p)[3];p=a;whichoneofthefollowingreferencestoanelementinthearrayaiscorrect?
A(p+1)[0]B*(*(p+2)+1)C*(p[1]+
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- (新)部编版三年级上册语文七篇阅读训练试题及答案
- 妇产科操作相关医疗纠纷防范策略
- 头颈癌放疗后靶向免疫联合策略
- 多重用药下康复方案的调整原则
- 德国考试题及答案
- 2025年大学艺术设计(设计创作)试题及答案
- 多组学技术在精准医疗中的精准度提升策略
- 多组学分析指导的肿瘤症状精准支持策略-1
- 2025年中职(粉末冶金技术)粉末压制工艺专项测试试题及答案
- 2026年家政服务(卫生间清洁)试题及答案
- 2026年无锡商业职业技术学院单招职业技能笔试备考试题带答案解析
- 2026年初二物理寒假作业(1.31-3.1)
- 2025秋人教版七年级上册音乐期末测试卷(三套含答案)
- 2025福建德化闽投抽水蓄能有限公司招聘4人(公共基础知识)综合能力测试题附答案
- “十五五规划纲要”解读:和美乡村宜居宜业
- 广东省广州市2026届高三年级上学期12月调研测试数学(广州零模)(含答案)
- 2025-2030中国工业硅行业市场现状供需分析及投资评估规划分析研究报告
- 手机供货协议书
- 2025年北京高中合格考政治(第二次)试题和答案
- 民俗的特征教学课件
- 山东省潍坊市2023-2024学年高一上学期期末考试地理试题(含答案)
评论
0/150
提交评论