版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
高級(jí)語(yǔ)言程序設(shè)計(jì)(雙語(yǔ)版)知到智慧樹(shù)章節(jié)測(cè)試課后答案2024年秋溫州醫(yī)科大學(xué)第三章單元測(cè)試
Theoperatorwiththelowestpriority(優(yōu)先級(jí))amongthefollowingoptionsis()
A:+B:<=C:||D:!=
答案:||Thefirstterm(第一項(xiàng))oftheproportionalseries(等比數(shù)列)isa=1,thecommonratio(公比)q=2,andthefollowingprogramscalculatesthemaximumofthefirstntermsandlessthan100(下面程序計(jì)算前n項(xiàng)和小于100的最大n),Whichofthefollowingoptionsshouldbefilledintheblanks()。
intmain(void)
{
inta,q,n,sum;
a=1;g=2;
for(n=sum=0;sum<100;n++)
{sum+=a;
a*=g;}
————————
printf("n=%d\n",n);
return0;}
A:n-=2;B:n--;C:空行D:n++;
答案:n--;Ifkisanintvariableandavalueof11isassigned.Thevalueoftheexpressionafterk++is11,andthevalueofthevariablekis12.()若k為int型變量且賦值11。運(yùn)算k++后表達(dá)式的值是11,變量k的值是12()。
A:對(duì)B:錯(cuò)
答案:對(duì)Assumingthefollowingvariabledefinitions:
inta=5,b=4;
floatc=3.0,d;whatisthevalueofdaftereachofthefollowing?()(a)d=a/b;(b)d=(float)a/b;(c)d=c/b;(d)d=(int)c/b;(e)d=a/2;(f)d=a/2.0;(g)d=(float)a/2;(h)d=(int)c%2;
A:1.25
1.25
0.75
0
2
2.5
2.5
1B:1.0
1.25
0.75
0.0
2.0
2.52.5
1.0C:1
1.25
0.75
0
2
2.5
2.5
1D:1.0
1.25
0.0
0.0
2.0
2.52.5
1.0
答案:1.0
1.25
0.75
0.0
2.0
2.52.5
1.0Typeconversions(類(lèi)型轉(zhuǎn)換)inClanguageincludesautomaticconversionandmanualconversion.
A:對(duì)B:錯(cuò)
答案:對(duì)
第五章單元測(cè)試
intmain()
{inta;
scanf("%d",&a);
if(a>50)printf("%d",a);
if(a>40)printf("%d",a);
if(a>30)printf("%d",a);
return0;
}
Wheninput58,theoutputis()
A:585858B:5858585858C:5858D:58
答案:585858#include<stdio.h>
intmain()
{inta=1,b=2,c=3,d=0;
if(a==1)
if(b!=2)
if(c==3)d=1;
elsed=2;
elseif(c!=3)d=3;
elsed=4;
elsed=5;
printf(“%d\n”,d);
}
Theouputis()
A:2B:3C:4D:12
答案:4#include<stdio.h>
intmain()
{
inta=1,b=2,c=3,d=0;
if(a==1&&b++==2)
if(b!=2||c--!=3)
printf("%d,%d,%d\n",a,b,c);
else
printf("%d%d%d\n",a,b,c);
else
printf("%d,%d,%d\n",a,b,c);
}Theresultoftheprogramis()
A:1,3,3B:1,2,3C:3,2,1D:1,3,2
答案:1,3,3Thebasicformofanifstatementis
if(expression)
statement;
whichdescriptionof"expression"iscorrect?()
A:Mustbepositive必須是正數(shù)B:Itcanbeanyvalidvalue可以是任意合法的數(shù)值C:Mustbealogicalvalue必須是邏輯值D:Mustbeanintegervalue必須是整數(shù)值
答案:Itcanbeanyvalidvalue可以是任意合法的數(shù)值Inthefollowingconditionalstatements(條件語(yǔ)句),theoutputisdifferentfromtheotherstatements()
A:if(a)printf("%d\n",x);elseprintf("%d\n",y);B:if(a==0)printf("%d\n",y);elseprintf("%d\n",x);C:if(a!=0)printf("%d\n",x);elseprintf("%d\n",y);D:if(a==0)printf("%d\n",x);elseprintf("%d\n",y);
答案:if(a==0)printf("%d\n",x);elseprintf("%d\n",y);
第七章單元測(cè)試
Afterthefollowingprogramisrun,theoutputis3()
Theoutputofthefollowingprogramis
main()
{
intn[5]={3,3,3},i,k=2;
for(i=0;i<k;i++)n[i]=n[i]+1;
printf("%d\n",n[k]);
}
A:對(duì)B:錯(cuò)
答案:對(duì)#include<stdio.h>
#include<string.h>
intmain()
{
chars[]="abede";
s+=2;
printf("%d\n",s[0]);
}
Theresultoftheprogramis()
A:OutputcharactercB:OutputstheASCIIvalueofthecharactercC:TherewasanerrorintheprogramD:OutputstheASCIIvalueofcharactera
答案:TherewasanerrorintheprogramTheoutputofthefollowingprogramis()
main()
{inti,a[10];
for(i=9;i>=0;i--)a[i]=10-i;
printf("%d%d%d",a[1],a[6],a[9]);
}
A:941B:169C:961D:357
答案:941Whatisthesubscriptrange(下標(biāo)范圍)forthefollowingarrays?()
intarray1[6];
A:(0,5)B:[0,4]C:[0,5)D:[0,5]
答案:[0,5]Hereinta[12]={1,4,7,10,2,5,8,11,3,6,9,12};,what'sthe
valueofa[a[i]]ifi=10?()
A:6B:9C:10D:5
答案:6
第四章單元測(cè)試
#include<stdio.h>
intmain()
{
intnum;
printf("PleasetypeinanumberfollowedbyEnter");
scanf("%f",num);
printf("Thenumberyoutypedwas:%d",num);
return0;
}
Isthestatementabovecorrect?()
A:對(duì)B:錯(cuò)
答案:錯(cuò)addressoperator&isnecessaywhenusingscanf()fucntion.()
A:錯(cuò)B:對(duì)
答案:對(duì)Pleaseuseascanf()functiontoinputthreevaluesfromthekeyboard
使用一個(gè)scanf()函數(shù),從鍵盤(pán)一次讀入下列三個(gè)變量。()
intsecond,third,fourth;
A:scanf("%d%d%d",&second,&third,&fourth);B:scanf(%d%d%d,&second,&third,&fourth);C:scanf("%d%d%d",second,third,fourth);D:scanf('%d%d%d',&second,&third,&fourth);
答案:scanf("%d%d%d",&second,&third,&fourth);Writeasinglescanf()statementtoinputvaluesfromthekeyboardforthefollowingfloatprincipal,rate,time;
編寫(xiě)單個(gè)scanf()語(yǔ)句以從鍵盤(pán)輸入值floatprincipal,rate,time;()
A:scanf("%d%d%d",&principal,&rate,&time);B:scanf("%f%f%f",&principal,&rate,&time);C:scanf("%lf%lf%lf",&principal,&rate,&time);D:scanf("%c%c%c",&principal,&rate,&time);
答案:scanf("%f%f%f",&principal,&rate,&time);Thegetchar()functionisusedtoreadacharacterfromkeyboard()
A:對(duì)B:錯(cuò)
答案:對(duì)Thefunctionofthefollowingprogramistotypeintheradiusandcalculateofcalculatetheareaofthecircle(圓的面積).Theprogrammingiswrongoncompile(編譯)dueto()
intmain(void)
/*hangzhou*/
{
intr;floats;
scanf("%d",&r);
S=PI*r*r;
printf("s=%f\n",s);
}
A:Thevariablerthatholdstheradiusofacircleshouldnotbedefinedasaninteger.存放圓半徑的變量r不應(yīng)該定義為整型B:Theformatdescriptorintheoutputstatementisinvalid.輸出語(yǔ)句中格式描述符非法C:Thecommentstatementiswritteninthewrongplace.注釋語(yǔ)句書(shū)寫(xiě)位置錯(cuò)誤D:Illegalvariablesareusedintheassignmentstatementthatcalculatestheareaofacircle.計(jì)算圓面積的賦值語(yǔ)句中使用了非法變量
答案:Illegalvariablesareusedintheassignmentstatementthatcalculatestheareaofacircle.計(jì)算圓面積的賦值語(yǔ)句中使用了非法變量
第一章單元測(cè)試
Asuccessfulapproachoflearning
programinCdependsonlargeamountsofpractice.()
A:對(duì)B:錯(cuò)
答案:對(duì)Astructuredprogramconsistsofthreebasicstructures,andanalgorithmconsistingofthreebasicstructurescan()結(jié)構(gòu)化程序由三種基本結(jié)構(gòu)組成,三種基本結(jié)構(gòu)組成的算法可以()
A:Tasksofanycomplexitycanbeaccomplished.可以完成任何復(fù)雜的任務(wù)B:Onlyafewsimpletaskscanbecompleted.只能完成一些簡(jiǎn)單的任務(wù)C:Onlytasksthatconformtothestructurecanbecompleted.只能完成符合結(jié)構(gòu)化的任務(wù)D:Onlypartiallycomplextaskscanbecompleted.只能完成部分復(fù)雜的任務(wù)
答案:Tasksofanycomplexitycanbeaccomplished.可以完成任何復(fù)雜的任務(wù)Whichofthefollowingdescrpitionsiscorrect()
A:AlgorithmsimplementedwithCprogramscanhaveneitherinputnoroutput.用C程序?qū)崿F(xiàn)的算法可以既沒(méi)有輸入也沒(méi)有輸出B:AlgorithmsimplementedinCprogramsmusthavebothinputandoutputoperations.用C程序?qū)崿F(xiàn)的算法必須要有輸入和輸出操作C:AlgorithmsimplementedinCprogramscanhavenoinput,buttheymusthaveoutputs.用C程序?qū)崿F(xiàn)的算法可以沒(méi)有輸入但必須要有輸出D:AlgorithmsimplementedinCprogramscanhavenooutput,buttheymusthaveinputs.用C程序?qū)崿F(xiàn)的算法可以沒(méi)有輸出但必須要有輸入
答案:AlgorithmsimplementedinCprogramscanhavenoinput,buttheymusthaveoutputs.用C程序?qū)崿F(xiàn)的算法可以沒(méi)有輸入但必須要有輸出Whichlanguagerunsthefastestonthecomputer?()
A:Ittakesthesameamountoftime上述語(yǔ)言運(yùn)行得一樣快B:MachineLanguage機(jī)器語(yǔ)言C:AssembleyLanguage匯編語(yǔ)言D:AdvancedLanguage高級(jí)語(yǔ)言
答案:MachineLanguage機(jī)器語(yǔ)言Whichofthe
followingdescrpitions
iswrong?
A:computercannotdirectlyexecuteasourceprogramwritteninC.計(jì)算機(jī)不能直接執(zhí)行用C語(yǔ)言編寫(xiě)的源程序
B:Binarieswiththeextensionobjandexecanberundirectly.擴(kuò)展名為obj和exe的二進(jìn)制文件都可以直接運(yùn)行C:Afilewiththeextensionobj,andafilewiththeextensionexegeneratedbytheconnectorisabinaryfile.擴(kuò)展名為obj的文件,經(jīng)連接程序生成擴(kuò)展名為exe的文件是一個(gè)二進(jìn)制文件D:WhentheCprogramiscompiledbytheCcompiler,thefilewiththe
objextensionisabinaryfile.
C程序經(jīng)C編譯程序編譯后,生成擴(kuò)展名為obj的文件是一個(gè)二進(jìn)制文件
答案:Binarieswiththeextensionobjandexecanberundirectly.擴(kuò)展名為obj和exe的二進(jìn)制文件都可以直接運(yùn)行
第十章單元測(cè)試
Chararray[]="China";,thespaceoccupiedbyarrayis
設(shè)有數(shù)組定義"chararray[]="China";",則數(shù)組array所占的空間為()
A:5bytes(字節(jié))B:7bytes(字節(jié))C:6bytes(字節(jié))D:4bytes(字節(jié))
答案:6bytes(字節(jié))Here,charx[]=abcdefg;chary[]={'a','b','e','d','e','f','g"};",thecorrectstatementis()
A:Arrayxisequivalenttoarrayy數(shù)組x和數(shù)組y等價(jià)B:ThelengthofarrayXislessthanthelengthofarrayy數(shù)組x的長(zhǎng)度小于數(shù)組y的長(zhǎng)度C:Arrayxandarrayyhavethesamelength數(shù)組x和數(shù)組y長(zhǎng)度相等D:ThelengthofarrayXisgreaterthanthelengthofarrayy數(shù)組x的長(zhǎng)度大于數(shù)組y的長(zhǎng)度
答案:ThelengthofarrayXisgreaterthanthelengthofarrayy數(shù)組x的長(zhǎng)度大于數(shù)組y的長(zhǎng)度Theoutputofthefollowingprogramis()
intmain(void)
{
intk;charw[][10]={"ABCD","EFGH","IJKL","MNOP"};
for(k=1;k<3;k++)
printf("%s\n",w[k]);
return0;
}
A:ABCDFGHKLB:ABCDEFGHIJKLC:EFGJKLD:EFGHIJKL
答案:EFGHIJKLThefollowingstatementsthatdefineastringcorrectlyis
下列能正確定義字符串的語(yǔ)句是()
A:charstr="";B:charstr[]="\0";C:charstr[]={'\064'};D:charstr="kx43";
答案:charstr[]="\0";ThefollowingprogramarrangestheelementsofthecharacterarrayAwithanevensubscriptfromsmallesttolargest,leavingallotherelementsunchanged.Pleasefillintheblanks.
下面程序的功能是將字符數(shù)組a中下標(biāo)值為偶數(shù)的元素從小到大排列,其他元素不變。()
intmain(void)
{chara[]="clanguage",t;
inti,j,k;
k=strlen();
for(i=0;i<=k-2;i+=2)
for(j=i+2;j<=k;__________)
if(____________)
{t=a[i];a[i]=a[j];
a[j]=t;
}
puts();
return0;
}
A:j+=1;a[i]>a[j];B:j+=2;a[i]>=a[j];C:j+=2;a[i-1]>a[j];D:j+=1;a[i-1]>a[j];
答案:j+=2;a[i]>=a[j];TheoutputofthefollowingprogramisHELLO()
intmain(void)
{charb[]="Hello,you";
b[5]=0;
printf("%s\n",b);
return0;
}
A:對(duì)B:錯(cuò)
答案:對(duì)Thefollowingprogramisrunbytyping"abcd<enter>".Theoutputoftheprogramis(a*b*c*d*)
下列程序運(yùn)行時(shí)輸人“abcd<回車(chē)>”,程序的輸出結(jié)果是a*b*c*d()
intmain(void)
{charstr[40];inti;
scanf("%s",str);
i=strlen(str);
while(i>0)
{str[2*i]=str[i];str[2*i-1]='*';i--;}
printf("%s\n",str);
return0;
}
A:對(duì)B:錯(cuò)
答案:錯(cuò)
第十一章單元測(cè)試
Theoutputofthefollowingprogramis()
intMyFunction(int);
intmain(void)
{intentry=12345;
printf("%5d",MyFunction(entry));
return0;}
intMyFunction(intPar)
{intresult;
result=0;
do{
result=result*10+Par%10;
Par/=10;}
while(Par);
returnresult;
}
A:12345B:543C:54321D:5432
答案:54321Theoutputofthefollowingprogramis()
intfun(intx,inty)
{staticintm=0,i=2;
i+=m+1;
m=i+x+y;
returnm;
}
intmain(void)
{intj=1,m=1,k;
k=fun(j,m);printf("%d,",k);
k=fun(j,m);printf("%d\n",k);
return0;}
A:11,5B:5,5C:11,11D:5,11
答案:5,11Theoutputofthefollowingprogramis()
voidf(intv,intw)
{
intt;
t=v;v=w;w=t;}
intmain(void)
{intx=1,y=3,z=2;
if(x>y)f(x,y);
elseif(y>z)f(y,z);
elsef(x,z);
printf("%d,%d,%d\n",x,y,z);
return0;
}
A:1,3,2B:2,3,1C:3,1,2D:1,2,3
答案:1,3,2ThefollowingprogramcalculatesthevalueofthefunctionSunFun(n)=f(0)+f(1)+...+f(n),wheref(x)=x3+1.Here,x3meansthecubeofx.Theblanksshouldbefilledin
(1)s=0
(2)s=s+f(x)
(3)x*x*x+1
()
A:錯(cuò)B:對(duì)
答案:對(duì)intSunFun(intn);
intf(intx);
intmain(void)
{printf("Thesum=%d\n",SunFun(10));
return0;}
intSunFun(intn)
{intx,___________(1)__________;
for(x=0;x<=n;x++)
______(2)_______;
returns;}
intf(intx)
{return_______(3)_____________;}
()
A:對(duì)B:錯(cuò)
答案:對(duì)Thefollowingfunctionisdefinedwhenexecutingthestatement"k=f(f(1));,thevalueofthevariablekis,有下列函數(shù)定義,當(dāng)執(zhí)行語(yǔ)句“k=f(f(1));"后,變量k的值為3()
intf(intx)
{
staticintk=0;
k=k+x;
returnk;
}
A:錯(cuò)B:對(duì)
答案:錯(cuò)intfunc(inta,intb)
{intc;
c=a+b;returnc;
}
main()
{intx=6,y=7,z=8,r;
r=func((x--,y++,x+y),z--);printf("%d\n",r);
}
Theoutputis()
A:20B:11C:21D:31
答案:21voidsub(intx,inty,int*z)
{*z=y-x;
}
main()
{inta,b,c;
sub(10,5,&a);
sub(7,a,&b);
sub(a,b,&c);
printf("%d,%d,%d\n",a,b,c);
}
Theoutputis()
A:5,2,3B:-5,-12,-7C:-5,-12,-17D:5,-2,-7
答案:-5,-12,-7voidfun(float*a,float*b)
{floatw;
*a=*a+*a;
w=*a;
*a=*b;
*b=w;
}
main()
{floatx=2.0,y=3.0,*px=&x,*py=&y;
fun(px,py);
printf("%2.0f,%2.0f\n",x,y);
}
Theoutputis()
A:4,3B:3,2C:2,3D:3,4
答案:3,4voidsub(doublex,double*y,double*z)
{*y=*y-1.0;*z=*z+x;
}
main()
{doublea=2.5,b=9.0,*pa,*pb;
pa=&a;
pb=&b;
sub(b-a,pa,pa);
printf("%f\n",a);
}
Theoutputis:()
A:9.000000B:1.500000C:8.000000D:10.500000
答案:8.000000Thefollowingfunctionshavebeendefined
fff(floatx)
{printf("%f\n",x*x);}
Thetype(類(lèi)型)ofthefunctionis()
A:Can'tbesure無(wú)法確定B:Sametypeasparameterx與參數(shù)x的類(lèi)型相同C:voidtypevoid類(lèi)型D:inttypeint類(lèi)型
答案:inttypeint類(lèi)型intfun(inta,intb,intc)
{c=a*b;
}
main()
{intc;
fun(2,3,c);
printf("%d",c);
}
Theoutputis:()
A:1B:無(wú)定值C:6D:0
答案:6Theoutputofthefollowingprogramis3.()
#include<stdio.h>
#include<string.h>
#defineN5
intfun(char*s,chara,intn)
{intj;
*s=a;j=n;
while(a<s[j])j--;
returnj;
}
main()
{chars[N+1];intk;
for(k=1;k<=N;k++)s[k]='A'+k+1;
printf("%d\n",fun(s,'E',N));
}
A:錯(cuò)B:對(duì)
答案:對(duì)Iftypein3,2,1inthefollowingprogram,theoutputis2271()
voidsub(intn,intuu[])
{intt;
t=uu[n--];t+=3*uu[n];
n++;
if(t>=10){uu[n++]=t/10;uu[n]=t%10;}
elseuu[n]=t;
}
main()
{inti,n,aa[10]={0};
scanf("%d%d%d",&n,&aa[0],&aa[1]);
for(i=1;i<n;i++)sub(i,aa);
for(i=0;i<=n;i++)printf("%d",aa[i]);
printf("\n");
}
A:錯(cuò)B:對(duì)
答案:錯(cuò)TheoutputofthefollowingprogramisXYZA()
voidfun(char*a1,char*a2,intn)
{intk;
for(k=0;k<n;k++)a2[k]=(a1[k]-'A'-3+26)%26+'A';
a2[n]='\0';
}
main()
{chars1[5]="ABCD",s2[5];
fun(s1,s2,4);puts(s2);
}
A:對(duì)B:錯(cuò)
答案:對(duì)Enterqwerty<回車(chē)>abcd<回車(chē)>andtheoutputofthefollowingprogramis10()
strle(chara[],charb[]){intnum=0,n=0;
while(*(a+num)!='\0')num++;
while(b[n]){*(a+num)=b[n];num++;n++;}
returnnum;}main(){charstr1[81],str2[81],*p1=str1,*p2=str2;
gets(p1);gets(p2);printf("%d\n",strle(p1,p2));}
A:對(duì)B:錯(cuò)
答案:對(duì)
第九章單元測(cè)試
Herearesomestatementsasfollows:
intone_d[]={1,3,4,5,-1};
int*p;
p=one_d;
Whatarethevaluesof*p,*p+4and*(p+4)respectively?()
A:*p=1,*p+4=5,*(p+4)=1B:*p=2,*p+4=6,*(p+4)=-1C:*p=1,*p+4=1,*(p+4)=-1D:*p=1,*p+4=5,*(p+4)=-1
答案:*p=1,*p+4=5,*(p+4)=-1Hereisthestatement:inta[5],*p=a;”
Whichofthefollowingisthecorrectreferencetothearrayelement?
若有說(shuō)明語(yǔ)句“inta[5],*p=a;”,則對(duì)數(shù)組元素的正確引用是()
A:*(p+2)B:p+2C:a[p]D:p[a]
答案:*(p+2)Theoutputofthefollowingprogramis()
#include"stdio.h"
main()
{
inta[]={1,2,3,4,5,6,7,8,9,0},i,s,*p;
p=a;s=0;
for(i=0;i<=9;i++)
s+=*p++;
printf("%d\n",s);
}
A:45B:44C:0D:9
答案:45Ifthedefinition:inta[2][3]={1,3,5,7,9,11},whichofthefollowingdescriptionsiscorrect()
A:**(a+1)+2is11.B:a[0]isnotthesameasC:(a[1]+1)is5.D:*(a+1)istheaddress(地址)ofelement(元素)7.
答案:*(a+1)istheaddress(地址)ofelement(元素)7.Theoutputofthefollowingprogramis()#include<stdio.h>
int*f(int*s)
{
s[1]+=6;
*s=7;
s+=2;
returns;
}
intmain()
{
inta[5]={1,2,3,4,5},*p=a;
p=f(p);
printf("%d,%d,%d\n",a[0],a[1],*p);
}
A:7,8,7
B:7,8,3C:1,2,1D:9,8,9
答案:7,8,3
第六章單元測(cè)試
Theoutputaftertheprogramis()
#include<stdio.h>
intmain()
{
inta=1,b=2;
for(;a<8;a++)
{
b+=a;a+=2;
}
printf("%d,%d\n",a,b);
}
A:8,11B:9,18C:7,11D:10,14
答案:10,14Theoutputoffollowingprogramis0.()
intmain()
{inty=10;
do{y--;}
while(--y);
printf("%d\n",y--);
return0;
}
A:對(duì)B:錯(cuò)
答案:對(duì)Statementfor(;;);isequivalenttothestatementwhile(1);.()
A:錯(cuò)B:對(duì)
答案:對(duì)Theoutputoffollowingprogramis0.()
intmain()
{inti,j,w=0;
for(i=4;i;i--)
for(j=1;j<=2;j++)
w=w+i*j;w=i*j;
printf("%d\n",w);
}
A:錯(cuò)B:對(duì)
答案:對(duì)for(;;)
{
…….
}
willputstheprograminanendlessloop(死循環(huán)).
A:錯(cuò)B:對(duì)
答案:對(duì)
第十二章單元測(cè)試
Hereisthedefinitions
structss
{charname[10];
intage;charsex;}std[3],*p=std;
Whatiswronginthefollowingstatements()
A:scanf("%d",&(*p).age);B:scanf("%s",&std.name);C:scanf("%c",&(p->sex));D:scanf("%c",&std[0].sex);
答案:scanf("%s",&std.name);Theoutputofthefollowingprogramsis:()
structs{intn;inta[20];};voidf(int*a,intn){
inti;
for(i=0;i<n-1;i++)
a[i]=a[i]+i;
}
intmain(void){inti;
structss={10,{2,3,1,6,8,7,5,4,10,9}};
f(s.a,s.n);
for(i=0;i<s.n;i++)
printf("%d,",s.a[i]);
}
A:1,2,3,6,8,7,5,4,10,9,B:2,3,1,6,8,7,5,4,10,9,C:2,4,3,9,12,12,11,11,18,9,D:3,4,2,7,9,8,6,5,11,10,
答案:2,4,3,9,12,12,11,11,18,9,Theoutputofthefollowingprogramsis()
structstu{
charnum[10];
floatscore[3];};intmain(void){
structstus[3]={{"20021",90,95,85},{"20022",95,80,75},{"20023",100,95,90}};
structstu*p=s;
inti;floatsum=0;
for(i=0;i<3;i++)
sum=sum+p->score[i];
printf("%6.2f\n",sum);}
A:290.00B:280.00C:270.00D:260.00
答案:270.00Theoutputofthefollowingprogramsis:()
structSTU{charname[10];intnum;};
voidf(char*name,intnum){structSTUs[2]={{"SunDan",20044},{"Penghua",20045}};
num=s[0].num;
strcpy(name,s[0].name);}
intmain(void){
structSTUs[2]={{"YangSan",2004},{"LiSiGuo",20042}},*p;
p=&s[1];
f(p->name,p->num);
printf("%s%d\n",p->name,p->num);}
A:YangSan20041B:SunDan20044C:LiSiGuo20042D:SunDan20042
答案:SunDan20042Theoutputofthefollowingprogramsis()
structSTU{charname[10];intnum;};voidf1(structSTUc){
structSTUb={"Three",2042};
c=b;}voidf2(structSTU*c){
structSTU
b={"Two",2044};
*c=b;}
intmain(void){
structSTUa={"One",2041},b={"Two",2043};
f1(a);
f2(&b);
printf("%d%d\n",a.num,b.num);
return0;}
A:20412045B:20412046C:20412044D:20412043
答案:20412044Theoutputofthefollowingprogramsis()
structstudent{charname[10];longsno;floatscore;};intmain(void){
structstudenta={"Zhangsan",2001,95},b={"Lisi",2002,90};
structstudentc={"Ahua",2003,95},d,*p=&d;
d=a;
if(strcmp(a.name,b.name)>0)
d=b;
if(strcmp(c.name,d.name)>0)
d=c;
printf("%ld%s\n",d.sno,p->name);
return0;}
A:2002LisiB:2003AhuaC:2001ZhangsanD:Error
答案:2002LisiTheoutputofthefollowingprogramsis6.()
intmain(void){
structcmplx{
intx;
inty;}
cnum[2]={1,3,2,7};
printf("%d\n",cnum[0].y/cnum[0].x*cnum[1].x);
return0;};
A:錯(cuò)B:對(duì)
答案:對(duì)Theoutputofthefollowingprogramsis21.()
intmain(){
structs{
inta,b;}
data[2]={10,100,20,200};
structsp=data[1];
printf("%d\n",++(p.a));
return0;
}
A:對(duì)B:錯(cuò)
答案:對(duì)
第二章單元測(cè)試
Commentscannotbenested(嵌套),i.e.youcannothaveacommentwithinanothercomment.()
A:錯(cuò)B:對(duì)
答案:對(duì)Whichofthefollowingoptionsarevalidvariablenames?()
A:xyzB:money$C:X-RAYD:stock_code
答案:xyz;stock_codeThecorrectfloatingconstant(實(shí)型常量)inthefollowingoptionsis()
A:B:32.88C:.871
答案:32.88whichdescriptioniscorrect?()
A:Cprogramsarewritteninastrictformat,requiringthatonlyonesentencecanbewritteninaline.
C程序書(shū)寫(xiě)格式嚴(yán)格,要求一行內(nèi)只能寫(xiě)一個(gè)語(yǔ)句B:Cprogramsarewritteninafreeformat,andasinglestatementcanbewrittenonmultiplelines.C程序書(shū)寫(xiě)格式自由,一個(gè)語(yǔ)句可以寫(xiě)在多行上C:CommentsinCprogramscanonlyappearatthebeginningoftheprogramandattheendofthestatement.
C程序中的注釋只能出現(xiàn)在程序的開(kāi)始位置和語(yǔ)句的后面D:ProgramswritteninCcanonlybeplacedinoneprogramfile.
用C語(yǔ)言編寫(xiě)的程序只能放在一個(gè)程序文件中
答案:Cprogramsarewritteninafreeformat,andasinglestatementcanbewrittenonmultiplelines.C程序書(shū)寫(xiě)格式自由,一個(gè)語(yǔ)句可以寫(xiě)在多行上Assumingthefollowing:
inti;
charc;
whichofthefollowingstatementsarevalid?()
A:i="1";B:c='1';C:i=1;D:c='A';
答案:c='1';;i=1;;c='A';
第八章單元測(cè)試
Thestatementisasfollows:
inta[10];
whichisthecorrectdefinition(定義)andinitialization(始化)ofthepointervariable(指針變量)p?()
A:intp=*a;B:intp=&a;C:int*p
溫馨提示
- 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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 網(wǎng)絡(luò)延遲優(yōu)化-洞察分析
- 虛擬偶像慶典應(yīng)用-洞察分析
- 寫(xiě)保護(hù)動(dòng)物的演講稿(5篇)
- 《大數(shù)據(jù)存儲(chǔ)技術(shù)與應(yīng)用》 課件 項(xiàng)目三-任務(wù)五 淺析對(duì)象存儲(chǔ)系統(tǒng)
- 維護(hù)服務(wù)環(huán)境標(biāo)準(zhǔn)制定-洞察分析
- 《人與動(dòng)物的關(guān)系》課件
- 企業(yè)安全用電共筑綠色發(fā)展未來(lái)
- 產(chǎn)品設(shè)計(jì)中的創(chuàng)意激發(fā)與實(shí)現(xiàn)技巧
- 創(chuàng)新思維的跨領(lǐng)域應(yīng)用與拓展
- 從傳統(tǒng)到數(shù)字化現(xiàn)代企業(yè)實(shí)驗(yàn)室管理與安全規(guī)范探索研究
- 無(wú)線傳感器網(wǎng)絡(luò)技術(shù)與應(yīng)用 第2版習(xí)題答案
- 名師工作室成員退出流程
- “搶10”游戲(教學(xué)設(shè)計(jì))-2024-2025學(xué)年一年級(jí)上冊(cè)數(shù)學(xué)蘇教版
- 2024年度中國(guó)主要城市共享單車(chē)、電單車(chē)騎行報(bào)告-中規(guī)院+中規(guī)智庫(kù)
- 2024-2025學(xué)年高中體育 羽毛球正手發(fā)、擊高遠(yuǎn)球教學(xué)設(shè)計(jì)
- 遺傳學(xué)(云南大學(xué))智慧樹(shù)知到答案2024年云南大學(xué)
- 第13章《內(nèi)能》和第14章《內(nèi)能的利用》測(cè)試試題 -2024-2025學(xué)年人教版物理九年級(jí)全一冊(cè)
- 《建筑施工技術(shù)》復(fù)習(xí)題及答案
- 河南中考英語(yǔ)詞匯表
- 泰國(guó)課件完整版本
- 2024至2030年中國(guó)江蘇省物流行業(yè)市場(chǎng)運(yùn)行現(xiàn)狀及投資戰(zhàn)略研究報(bào)告
評(píng)論
0/150
提交評(píng)論