![高級語言程序設(shè)計(jì)(雙語版)知到智慧樹章節(jié)測試課后答案2024年秋溫州醫(yī)科大學(xué)_第1頁](http://file4.renrendoc.com/view12/M00/1F/0D/wKhkGWdqyIqAIzlyAAFTFG0TAho578.jpg)
![高級語言程序設(shè)計(jì)(雙語版)知到智慧樹章節(jié)測試課后答案2024年秋溫州醫(yī)科大學(xué)_第2頁](http://file4.renrendoc.com/view12/M00/1F/0D/wKhkGWdqyIqAIzlyAAFTFG0TAho5782.jpg)
![高級語言程序設(shè)計(jì)(雙語版)知到智慧樹章節(jié)測試課后答案2024年秋溫州醫(yī)科大學(xué)_第3頁](http://file4.renrendoc.com/view12/M00/1F/0D/wKhkGWdqyIqAIzlyAAFTFG0TAho5783.jpg)
![高級語言程序設(shè)計(jì)(雙語版)知到智慧樹章節(jié)測試課后答案2024年秋溫州醫(yī)科大學(xué)_第4頁](http://file4.renrendoc.com/view12/M00/1F/0D/wKhkGWdqyIqAIzlyAAFTFG0TAho5784.jpg)
![高級語言程序設(shè)計(jì)(雙語版)知到智慧樹章節(jié)測試課后答案2024年秋溫州醫(yī)科大學(xué)_第5頁](http://file4.renrendoc.com/view12/M00/1F/0D/wKhkGWdqyIqAIzlyAAFTFG0TAho5785.jpg)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
高級語言程序設(shè)計(jì)(雙語版)知到智慧樹章節(jié)測試課后答案2024年秋溫州醫(yī)科大學(xué)第三章單元測試
Theoperatorwiththelowestpriority(優(yōu)先級)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:對B:錯
答案:對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(類型轉(zhuǎn)換)inClanguageincludesautomaticconversionandmanualconversion.
A:對B:錯
答案:對
第五章單元測試
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(條件語句),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);
第七章單元測試
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:對B:錯
答案:對#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
第四章單元測試
#include<stdio.h>
intmain()
{
intnum;
printf("PleasetypeinanumberfollowedbyEnter");
scanf("%f",num);
printf("Thenumberyoutypedwas:%d",num);
return0;
}
Isthestatementabovecorrect?()
A:對B:錯
答案:錯addressoperator&isnecessaywhenusingscanf()fucntion.()
A:錯B:對
答案:對Pleaseuseascanf()functiontoinputthreevaluesfromthekeyboard
使用一個scanf()函數(shù),從鍵盤一次讀入下列三個變量。()
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;
編寫單個scanf()語句以從鍵盤輸入值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:對B:錯
答案:對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.輸出語句中格式描述符非法C:Thecommentstatementiswritteninthewrongplace.注釋語句書寫位置錯誤D:Illegalvariablesareusedintheassignmentstatementthatcalculatestheareaofacircle.計(jì)算圓面積的賦值語句中使用了非法變量
答案:Illegalvariablesareusedintheassignmentstatementthatcalculatestheareaofacircle.計(jì)算圓面積的賦值語句中使用了非法變量
第一章單元測試
Asuccessfulapproachoflearning
programinCdependsonlargeamountsofpractice.()
A:對B:錯
答案:對Astructuredprogramconsistsofthreebasicstructures,andanalgorithmconsistingofthreebasicstructurescan()結(jié)構(gòu)化程序由三種基本結(jié)構(gòu)組成,三種基本結(jié)構(gòu)組成的算法可以()
A:Tasksofanycomplexitycanbeaccomplished.可以完成任何復(fù)雜的任務(wù)B:Onlyafewsimpletaskscanbecompleted.只能完成一些簡單的任務(wù)C:Onlytasksthatconformtothestructurecanbecompleted.只能完成符合結(jié)構(gòu)化的任務(wù)D:Onlypartiallycomplextaskscanbecompleted.只能完成部分復(fù)雜的任務(wù)
答案:Tasksofanycomplexitycanbeaccomplished.可以完成任何復(fù)雜的任務(wù)Whichofthefollowingdescrpitionsiscorrect()
A:AlgorithmsimplementedwithCprogramscanhaveneitherinputnoroutput.用C程序?qū)崿F(xiàn)的算法可以既沒有輸入也沒有輸出B:AlgorithmsimplementedinCprogramsmusthavebothinputandoutputoperations.用C程序?qū)崿F(xiàn)的算法必須要有輸入和輸出操作C:AlgorithmsimplementedinCprogramscanhavenoinput,buttheymusthaveoutputs.用C程序?qū)崿F(xiàn)的算法可以沒有輸入但必須要有輸出D:AlgorithmsimplementedinCprogramscanhavenooutput,buttheymusthaveinputs.用C程序?qū)崿F(xiàn)的算法可以沒有輸出但必須要有輸入
答案:AlgorithmsimplementedinCprogramscanhavenoinput,buttheymusthaveoutputs.用C程序?qū)崿F(xiàn)的算法可以沒有輸入但必須要有輸出Whichlanguagerunsthefastestonthecomputer?()
A:Ittakesthesameamountoftime上述語言運(yùn)行得一樣快B:MachineLanguage機(jī)器語言C:AssembleyLanguage匯編語言D:AdvancedLanguage高級語言
答案:MachineLanguage機(jī)器語言Whichofthe
followingdescrpitions
iswrong?
A:computercannotdirectlyexecuteasourceprogramwritteninC.計(jì)算機(jī)不能直接執(zhí)行用C語言編寫的源程序
B:Binarieswiththeextensionobjandexecanberundirectly.擴(kuò)展名為obj和exe的二進(jìn)制文件都可以直接運(yùn)行C:Afilewiththeextensionobj,andafilewiththeextensionexegeneratedbytheconnectorisabinaryfile.擴(kuò)展名為obj的文件,經(jīng)連接程序生成擴(kuò)展名為exe的文件是一個二進(jìn)制文件D:WhentheCprogramiscompiledbytheCcompiler,thefilewiththe
objextensionisabinaryfile.
C程序經(jīng)C編譯程序編譯后,生成擴(kuò)展名為obj的文件是一個二進(jìn)制文件
答案:Binarieswiththeextensionobjandexecanberundirectly.擴(kuò)展名為obj和exe的二進(jìn)制文件都可以直接運(yùn)行
第十章單元測試
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的長度小于數(shù)組y的長度C:Arrayxandarrayyhavethesamelength數(shù)組x和數(shù)組y長度相等D:ThelengthofarrayXisgreaterthanthelengthofarrayy數(shù)組x的長度大于數(shù)組y的長度
答案:ThelengthofarrayXisgreaterthanthelengthofarrayy數(shù)組x的長度大于數(shù)組y的長度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
下列能正確定義字符串的語句是()
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:對B:錯
答案:對Thefollowingprogramisrunbytyping"abcd<enter>".Theoutputoftheprogramis(a*b*c*d*)
下列程序運(yùn)行時輸人“abcd<回車>”,程序的輸出結(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:對B:錯
答案:錯
第十一章單元測試
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:錯B:對
答案:對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:對B:錯
答案:對Thefollowingfunctionisdefinedwhenexecutingthestatement"k=f(f(1));,thevalueofthevariablekis,有下列函數(shù)定義,當(dāng)執(zhí)行語句“k=f(f(1));"后,變量k的值為3()
intf(intx)
{
staticintk=0;
k=k+x;
returnk;
}
A:錯B:對
答案:錯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(類型)ofthefunctionis()
A:Can'tbesure無法確定B:Sametypeasparameterx與參數(shù)x的類型相同C:voidtypevoid類型D:inttypeint類型
答案:inttypeint類型intfun(inta,intb,intc)
{c=a*b;
}
main()
{intc;
fun(2,3,c);
printf("%d",c);
}
Theoutputis:()
A:1B:無定值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:錯B:對
答案:對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:錯B:對
答案:錯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:對B:錯
答案:對Enterqwerty<回車>abcd<回車>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:對B:錯
答案:對
第九章單元測試
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?
若有說明語句“inta[5],*p=a;”,則對數(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
第六章單元測試
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:對B:錯
答案:對Statementfor(;;);isequivalenttothestatementwhile(1);.()
A:錯B:對
答案:對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:錯B:對
答案:對for(;;)
{
…….
}
willputstheprograminanendlessloop(死循環(huán)).
A:錯B:對
答案:對
第十二章單元測試
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:錯B:對
答案:對Theoutputofthefollowingprogramsis21.()
intmain(){
structs{
inta,b;}
data[2]={10,100,20,200};
structsp=data[1];
printf("%d\n",++(p.a));
return0;
}
A:對B:錯
答案:對
第二章單元測試
Commentscannotbenested(嵌套),i.e.youcannothaveacommentwithinanothercomment.()
A:錯B:對
答案:對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程序書寫格式嚴(yán)格,要求一行內(nèi)只能寫一個語句B:Cprogramsarewritteninafreeformat,andasinglestatementcanbewrittenonmultiplelines.C程序書寫格式自由,一個語句可以寫在多行上C:CommentsinCprogramscanonlyappearatthebeginningoftheprogramandattheendofthestatement.
C程序中的注釋只能出現(xiàn)在程序的開始位置和語句的后面D:ProgramswritteninCcanonlybeplacedinoneprogramfile.
用C語言編寫的程序只能放在一個程序文件中
答案:Cprogramsarewritteninafreeformat,andasinglestatementcanbewrittenonmultiplelines.C程序書寫格式自由,一個語句可以寫在多行上Assumingthefollowing:
inti;
charc;
whichofthefollowingstatementsarevalid?()
A:i="1";B:c='1';C:i=1;D:c='A';
答案:c='1';;i=1;;c='A';
第八章單元測試
Thestatementisasfollows:
inta[10];
whichisthecorrectdefinition(定義)andinitialization(始化)ofthepointervariable(指針變量)p?()
A:intp=*a;B:intp=&a;C:int*p
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025北京市汽車購買合同范本
- 新生入學(xué)自我介紹范文(15篇)
- 春節(jié)員工感謝信(集合15篇)
- 堅(jiān)韌與毅力主題班會
- 招聘專場活動方案
- 拔河比賽活動總結(jié)范文15篇
- 小學(xué)數(shù)學(xué)教師教學(xué)反思的實(shí)踐與啟示
- 科技引領(lǐng)下的小學(xué)勞動教育創(chuàng)新實(shí)踐
- 科技改變生活科技與小學(xué)科學(xué)實(shí)驗(yàn)的融合
- 科技發(fā)展與青少年近視問題的關(guān)系探討
- 商標(biāo)法基礎(chǔ)知識
- 2025年高考物理一輪復(fù)習(xí)之機(jī)械振動
- (2024)甘肅省公務(wù)員考試《行測》真題及答案解析
- 醫(yī)院醫(yī)務(wù)人員醫(yī)德考評標(biāo)準(zhǔn)
- 小紅書種草營銷師(初級)認(rèn)證考試真題試題庫(含答案)
- 癲癇病人的護(hù)理(課件)
- 2024年WPS計(jì)算機(jī)二級考試題庫350題(含答案)
- 2024年6月浙江省高考地理試卷真題(含答案逐題解析)
- 企業(yè)年金基金管理機(jī)構(gòu)基本服務(wù)和收費(fèi)標(biāo)準(zhǔn)規(guī)范規(guī)范行業(yè)自律公約
- 小學(xué)二年級部編人教版上冊語文期末整理復(fù)習(xí)題
- DB5106∕T 16-2021 機(jī)插水稻育秧基質(zhì)制備技術(shù)規(guī)程
評論
0/150
提交評論