高级语言程序设计(双语版)知到智慧树章节测试课后答案2024年秋温州医科大学_第1页
高级语言程序设计(双语版)知到智慧树章节测试课后答案2024年秋温州医科大学_第2页
高级语言程序设计(双语版)知到智慧树章节测试课后答案2024年秋温州医科大学_第3页
高级语言程序设计(双语版)知到智慧树章节测试课后答案2024年秋温州医科大学_第4页
高级语言程序设计(双语版)知到智慧树章节测试课后答案2024年秋温州医科大学_第5页
已阅读5页,还剩24页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

高级语言程序设计(双语版)知到智慧树章节测试课后答案2024年秋温州医科大学第三章单元测试

Theoperatorwiththelowestpriority(优先级)amongthefollowingoptionsis()

A:+B:<=C:||D:!=

答案:||Thefirstterm(第一项)oftheproportionalseries(等比数列)isa=1,thecommonratio(公比)q=2,andthefollowingprogramscalculatesthemaximumofthefirstntermsandlessthan100(下面程序计算前n项和小于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。运算k++后表达式的值是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(类型转换)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必须是正数B:Itcanbeanyvalidvalue可以是任意合法的数值C:Mustbealogicalvalue必须是逻辑值D:Mustbeanintegervalue必须是整数值

答案:Itcanbeanyvalidvalue可以是任意合法的数值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(下标范围)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()函数,从键盘一次读入下列三个变量。()

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不应该定义为整型B:Theformatdescriptorintheoutputstatementisinvalid.输出语句中格式描述符非法C:Thecommentstatementiswritteninthewrongplace.注释语句书写位置错误D:Illegalvariablesareusedintheassignmentstatementthatcalculatestheareaofacircle.计算圆面积的赋值语句中使用了非法变量

答案:Illegalvariablesareusedintheassignmentstatementthatcalculatestheareaofacircle.计算圆面积的赋值语句中使用了非法变量

第一章单元测试

Asuccessfulapproachoflearning

programinCdependsonlargeamountsofpractice.()

A:对B:错

答案:对Astructuredprogramconsistsofthreebasicstructures,andanalgorithmconsistingofthreebasicstructurescan()结构化程序由三种基本结构组成,三种基本结构组成的算法可以()

A:Tasksofanycomplexitycanbeaccomplished.可以完成任何复杂的任务B:Onlyafewsimpletaskscanbecompleted.只能完成一些简单的任务C:Onlytasksthatconformtothestructurecanbecompleted.只能完成符合结构化的任务D:Onlypartiallycomplextaskscanbecompleted.只能完成部分复杂的任务

答案:Tasksofanycomplexitycanbeaccomplished.可以完成任何复杂的任务Whichofthefollowingdescrpitionsiscorrect()

A:AlgorithmsimplementedwithCprogramscanhaveneitherinputnoroutput.用C程序实现的算法可以既没有输入也没有输出B:AlgorithmsimplementedinCprogramsmusthavebothinputandoutputoperations.用C程序实现的算法必须要有输入和输出操作C:AlgorithmsimplementedinCprogramscanhavenoinput,buttheymusthaveoutputs.用C程序实现的算法可以没有输入但必须要有输出D:AlgorithmsimplementedinCprogramscanhavenooutput,buttheymusthaveinputs.用C程序实现的算法可以没有输出但必须要有输入

答案:AlgorithmsimplementedinCprogramscanhavenoinput,buttheymusthaveoutputs.用C程序实现的算法可以没有输入但必须要有输出Whichlanguagerunsthefastestonthecomputer?()

A:Ittakesthesameamountoftime上述语言运行得一样快B:MachineLanguage机器语言C:AssembleyLanguage汇编语言D:AdvancedLanguage高级语言

答案:MachineLanguage机器语言Whichofthe

followingdescrpitions

iswrong?

A:computercannotdirectlyexecuteasourceprogramwritteninC.计算机不能直接执行用C语言编写的源程序

B:Binarieswiththeextensionobjandexecanberundirectly.扩展名为obj和exe的二进制文件都可以直接运行C:Afilewiththeextensionobj,andafilewiththeextensionexegeneratedbytheconnectorisabinaryfile.扩展名为obj的文件,经连接程序生成扩展名为exe的文件是一个二进制文件D:WhentheCprogramiscompiledbytheCcompiler,thefilewiththe

objextensionisabinaryfile.

C程序经C编译程序编译后,生成扩展名为obj的文件是一个二进制文件

答案:Binarieswiththeextensionobjandexecanberundirectly.扩展名为obj和exe的二进制文件都可以直接运行

第十章单元测试

Chararray[]="China";,thespaceoccupiedbyarrayis

设有数组定义"chararray[]="China";",则数组array所占的空间为()

A:5bytes(字节)B:7bytes(字节)C:6bytes(字节)D:4bytes(字节)

答案:6bytes(字节)Here,charx[]=abcdefg;chary[]={'a','b','e','d','e','f','g"};",thecorrectstatementis()

A:Arrayxisequivalenttoarrayy数组x和数组y等价B:ThelengthofarrayXislessthanthelengthofarrayy数组x的长度小于数组y的长度C:Arrayxandarrayyhavethesamelength数组x和数组y长度相等D:ThelengthofarrayXisgreaterthanthelengthofarrayy数组x的长度大于数组y的长度

答案:ThelengthofarrayXisgreaterthanthelengthofarrayy数组x的长度大于数组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.

下面程序的功能是将字符数组a中下标值为偶数的元素从小到大排列,其他元素不变。()

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*)

下列程序运行时输人“abcd<回车>”,程序的输出结果是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,有下列函数定义,当执行语句“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与参数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;”,则对数组元素的正确引用是()

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(死循环).

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(实型常量)inthefollowingoptionsis()

A:B:32.88C:.871

答案:32.88whichdescriptioniscorrect?()

A:Cprogramsarewritteninastrictformat,requiringthatonlyonesentencecanbewritteninaline.

C程序书写格式严格,要求一行内只能写一个语句B:Cprogramsarewritteninafreeformat,andasinglestatementcanbewrittenonmultiplelines.C程序书写格式自由,一个语句可以写在多行上C:CommentsinCprogramscanonlyappearatthebeginningoftheprogramandattheendofthestatement.

C程序中的注释只能出现在程序的开始位置和语句的后面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. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论