好文档 - 专业文书写作范文服务资料分享网站

C语言试卷及答案

天下 分享 时间: 加入收藏 我要投稿 点赞

Pushing ahead, East, North, West development, facilitating shanty, complete xincheng West Road, stability and reconstruction of the street, Star Ding garden built century Garden District, subject public housing construction, heating the gas expansion accelerated implementation, Jing Rui River and bridge style line solid shaft, further expanded the town development. Beautiful country adhere to the advance and typical for a group to lead. According to \ogical lay based, and industry increased income, and live upgrade civilization, and culture rich connotation\caught built beautiful village, and whole village advance, and easily relocation, and \built\ct near 30 a; depth into ecological, and industry, and culture, and tourism, elements, high standards caught party original city Liu, and jade are Xia AO, model village, in province City set has benchmark. Four is equal benefits to promote sharing, coordinated development of various social undertakings. In the case of rigid spending slowing revenue growth, increase, financial 75% to the people's livelihood, the masses have more access in the sharing. Cuoban something good and benefit. Adhere to the affordable, best, carefully cuoban village oil, water and heat, cultural, city and County columns practical, developments benefit families, bring more welfare to the masses. Development of social convenience. Acceptance of balanced development of compulsory education through the national assessment, the County vocational education center was named \onal education in China\batch of national reform and development model through provincial ... Five is to deepen reform and innovation to break bottlenecks and endogenous development of effective fire. As an engine of dynamism, adding reform key to adopting reform measures stress energy and break bottlenecks and promoting development. Pay close attention to the key areas of reform. Conscientiously implement the provincial deployment and cancel, adjustment, to undertake the administrative approval items according to Regulation 347 to further improve administrative efficiency continuing deepening reform for poverty alleviation, speeding up rural land right registration certification pilot project, encouraging the orderly transfer of land management, utilize the land resources, in order to promote scale management laid the Foundation. Actively cultivate the market. Firmly establish a market-oriented, nurturing family farms, industrial users, professional cooperation organization new market management main body 456, effectively improve the industry, intensive and marketization of encouraging support social capital into the small micro-credit, urban development, culture and tourism, public services and other areas, easing development shortfall. To promote mass innovation. To support the rural sector to use new thinking and new ideas, creative work incentives such as actively promoting financial intermediation, bring added 159 in non public enterprises, individually-1540, created a《C语言程序设计》考试试卷(答案)

一、 填空题(每小空1分,共10分)

1.C语言程序的三种基本结构是 顺序结构 、选择结构 、 循环结构 。 2. 一个C程序有且仅有一个 main( ) 函数。

3. C语言描述“x和y都大于或等于z”的表达式是 x>=z && y>=z 。 4.C语言可以用来实现循环的结构化语句是 while 、 do while 、for。 5.数组名表示数组在内存的 首地址。 6.int a=3,*p=&a;*p+2的值是 5 。

二 、单项选择题(每小题2分,共70分)

1.__B___是C语言合法的常量。

(A).45 (B)078 (C)25.6e3.4 (D)‘xy’ 2.一个程序的执行是从 A 。

(A)本程序的main函数开始,到main函数结束

(B)本程序文件的第一个函数开始,到本程序文件的最后一个函数结 束。

(C)本程序的main函数开始,到本程序文件的最后一个函数结束。 (D)本程序文件的第一个函数开始,到main函数结束。 3.以下叙述正确的是 C 。

(A)在C程序中,main函数必须位于程序的最前面。 (B)C程序每行中只能写一条语句。 (C)C语言本是没有输入输出语句。

(D)在对一个C程序进行编译的过程中,可发现注释中的拼写错误。 4.以下叙述不正确的是 D 。 (A)逗号运算符的运算级最低。

(B)ABC和abc是两个不同的变量。

(C)若a和b类型相同,在执行a=b后,b的自身值不变。 (D)‘a’和“a”是完全等价的常量。

5.int x=3,y=2;则表达式x+=x*=y+8的值为 C 。 (A)28 (B)30 (C)60 (D)17 6.设x=2.7,a=8,y=4.9,算术表达式x+a%3*(int)(x+y)%5/3的值为 B 。 (A)2.7 (B)3.7 (C)4.7 (D)4.03 7.执行下面两个语句后,输出的结果为__D___。 char c1=98; printf(“%d %c”,c1,c1-32);

(A)97 66 (B)98 b (C)b 66 (D)98 B 8.执行下面语句后的结果为 C 。 y=10;x=y++;

(A)x=10,y=10 (B)x=11,y=11 (C)x=10,y=11 (D)x=11,y=10 9. Char w;int x;float y;double z;则表达式w*x+z-y值的数据类型是 A 。 (A)double (B)char (C)int (D)float 10. C语言中要求操作数必须是整数的运算符是 B 。

Pushing ahead, East, North, West development, facilitating shanty, complete xincheng West Road, stability and reconstruction of the street, Star Ding garden built century Garden District, subject public housing construction, heating the gas expansion accelerated implementation, Jing Rui River and bridge style line solid shaft, further expanded the town development. Beautiful country adhere to the advance and typical for a group to lead. According to \ogical lay based, and industry increased income, and live upgrade civilization, and culture rich connotation\caught built beautiful village, and whole village advance, and easily relocation, and \built\ct near 30 a; depth into ecological, and industry, and culture, and tourism, elements, high standards caught party original city Liu, and jade are Xia AO, model village, in province City set has benchmark. Four is equal benefits to promote sharing, coordinated development of various social undertakings. In the case of rigid spending slowing revenue growth, increase, financial 75% to the people's livelihood, the masses have more access in the sharing. Cuoban something good and benefit. Adhere to the affordable, best, carefully cuoban village oil, water and heat, cultural, city and County columns practical, developments benefit families, bring more welfare to the masses. Development of social convenience. Acceptance of balanced development of compulsory education through the national assessment, the County vocational education center was named \onal education in China\batch of national reform and development model through provincial ... Five is to deepen reform and innovation to break bottlenecks and endogenous development of effective fire. As an engine of dynamism, adding reform key to adopting reform measures stress energy and break bottlenecks and promoting development. Pay close attention to the key areas of reform. Conscientiously implement the provincial deployment and cancel, adjustment, to undertake the administrative approval items according to Regulation 347 to further improve administrative efficiency continuing deepening reform for poverty alleviation, speeding up rural land right registration certification pilot project, encouraging the orderly transfer of land management, utilize the land resources, in order to promote scale management laid the Foundation. Actively cultivate the market. Firmly establish a market-oriented, nurturing family farms, industrial users, professional cooperation organization new market management main body 456, effectively improve the industry, intensive and marketization of encouraging support social capital into the small micro-credit, urban development, culture and tourism, public services and other areas, easing development shortfall. To promote mass innovation. To support the rural sector to use new thinking and new ideas, creative work incentives such as actively promoting financial intermediation, bring added 159 in non public enterprises, individually-1540, created a (A)/ (B)% (C)!= (D)= 11. 用scanf(“%d,%d”,&a,&b)输入数据时,下面输入法中正确的是 A 。

(A)123,4 (B)123 4 (C)123;4 (D) 12. 以下关于运算符优先顺序的描述中正确的是__C______

(A)关系运算符<算术运算符<赋值运算符<逻辑与运算符

(B)逻辑与运算符 <关系运算符< 算术运算符< 赋值运算符 (C)赋值运算符< 逻辑与运算符< 关系运算符< 算术运算符 (D)算术运算符< 关系运算符< 赋值运算符< 逻辑与运算符 13. 下列程序段中,功能与其它程序段不同的是 B 。

(A)for(i=1,p=1;i<=5;i++) p*=i;

(B)for(i=1;i<=5;) { p=1;p*=i;i++;} (C)i=1;p=1;while(i<=5) { p*=i;i++;}

(D)i=1;p=1;do { p*=i;i++;} while(i<=5); 14. C语言规定else总是与 D 配对。

(A)缩进位置相同的if (B)同一行上的if (C)其之前最近的if (D)其之后最近的if 15. 以下程序的运行结果为___A___。

main( ) { int n;

for( n=1;n<=10;n++)

{ if( n%3==0) continue; printf(“%d”,n); } }

(A) (B)369 (C)12 (D) 16.设x和y均为int型变量,则语句x+=y;y=x-y;x-=y;的功能是 D 。

(A)把x和y按从大到小排列 (B)把x和y按从小到大排列 (C)无确定结果 (D)交换x和y中的值 17.变量的指针,其含义是指该变量的 _B____

(A)值 (B)地址 (C)名 (D)一个标志 18.以下函数调用语句中含有 A 个实参。

func((e1,e2),(e3,e4,e5));

(A)2 (B)3 (C)5 (D)语法错误 19.以下正确的描述是___B_____

(A)continue语句的作用是结束整个循环的执行

(B)只能在循环体内和switch语句体内使用break语句 (C)在循环体内使用break语句或continue语句的作用相同 (D)goto语句只能用于退出多层循环 20.以下程序运行的结果是 D 。

main()

{int a=2,b=3,c=2; if(a

printf(“%d\\n”,c);

Pushing ahead, East, North, West development, facilitating shanty, complete xincheng West Road, stability and reconstruction of the street, Star Ding garden built century Garden District, subject public housing construction, heating the gas expansion accelerated implementation, Jing Rui River and bridge style line solid shaft, further expanded the town development. Beautiful country adhere to the advance and typical for a group to lead. According to \ogical lay based, and industry increased income, and live upgrade civilization, and culture rich connotation\caught built beautiful village, and whole village advance, and easily relocation, and \built\ct near 30 a; depth into ecological, and industry, and culture, and tourism, elements, high standards caught party original city Liu, and jade are Xia AO, model village, in province City set has benchmark. Four is equal benefits to promote sharing, coordinated development of various social undertakings. In the case of rigid spending slowing revenue growth, increase, financial 75% to the people's livelihood, the masses have more access in the sharing. Cuoban something good and benefit. Adhere to the affordable, best, carefully cuoban village oil, water and heat, cultural, city and County columns practical, developments benefit families, bring more welfare to the masses. Development of social convenience. Acceptance of balanced development of compulsory education through the national assessment, the County vocational education center was named \onal education in China\batch of national reform and development model through provincial ... Five is to deepen reform and innovation to break bottlenecks and endogenous development of effective fire. As an engine of dynamism, adding reform key to adopting reform measures stress energy and break bottlenecks and promoting development. Pay close attention to the key areas of reform. Conscientiously implement the provincial deployment and cancel, adjustment, to undertake the administrative approval items according to Regulation 347 to further improve administrative efficiency continuing deepening reform for poverty alleviation, speeding up rural land right registration certification pilot project, encouraging the orderly transfer of land management, utilize the land resources, in order to promote scale management laid the Foundation. Actively cultivate the market. Firmly establish a market-oriented, nurturing family farms, industrial users, professional cooperation organization new market management main body 456, effectively improve the industry, intensive and marketization of encouraging support social capital into the small micro-credit, urban development, culture and tourism, public services and other areas, easing development shortfall. To promote mass innovation. To support the rural sector to use new thinking and new ideas, creative work incentives such as actively promoting financial intermediation, bring added 159 in non public enterprises, individually-1540, created a}

(A)0 (B)1 (C)2 (D)3 21.int a[4]={2,3,4},I;

i=a[0]*a[1]+a[2]*a[3]; i的值为 C 。

(A)2 (B)4 (C)6 (D)10 22.以下正确的函数定义形式是 C 。

(A)double fun(int x,int y); (B)double fun(int x;int y)

(C)double fun(int x,int y) (D)double fun(int x,y)

23.C语言允许函数值类型缺省定义,此时该函数值隐含的类型是 B 。

(A)float型 (B)int型 (C)long型 (D)double型 24.若有定义int a[4]={1,2,3};

请问a[a[a[0]]]的值是 C 。

(A)1 (B)2 (C)3 (D)4 25.以下正确的描述是____B________

(A)函数的定义可以嵌套,函数的调用不可以嵌套 (B)函数的定义不可以嵌套,函数的调用可以嵌套 (C)函数的定义和函数的调用均不可以嵌套 (D)函数的定义和函数的调用均可以嵌套 26.以下不正确的说法是_____A_______

(A)在函数内的复合语句中定义的变量在本函数范围内有效 (B)在不同函数中可以使用相同名字的变量 (C)形参是局部变量

(D)函数调用结束后,静态局部变量的值仍然保留。 27. 已有定义:int x=3,y=4,z=5;

则表达式!(x+y)+z-1&&y+z/2的值是 D 。 (A)6 (B)0 (C)2 (D)1 28. main()

{int n[4]={1,2,3,4},k; for(k=0;k<4;k++) {if(k/2) break; n[k]++; }

printf(“%d\\n”,n[++k]); }

执行后输出的结果是 C 。

(A)2 (B)3 (C)4 (D)5 29.判断字符串是否相等,应当使用 D 。

(A)if(a==b) (B)if(a=b) (C)if(strcpy(a,b)) (D)if(!strcmp(a,b)) 30.以下程序运行结果是 A 。

void sub(int x,int y,int *z) {*z=y-x;} main() {int a,b,c;

Pushing ahead, East, North, West development, facilitating shanty, complete xincheng West Road, stability and reconstruction of the street, Star Ding garden built century Garden District, subject public housing construction, heating the gas expansion accelerated implementation, Jing Rui River and bridge style line solid shaft, further expanded the town development. Beautiful country adhere to the advance and typical for a group to lead. According to \ogical lay based, and industry increased income, and live upgrade civilization, and culture rich connotation\caught built beautiful village, and whole village advance, and easily relocation, and \built\ct near 30 a; depth into ecological, and industry, and culture, and tourism, elements, high standards caught party original city Liu, and jade are Xia AO, model village, in province City set has benchmark. Four is equal benefits to promote sharing, coordinated development of various social undertakings. In the case of rigid spending slowing revenue growth, increase, financial 75% to the people's livelihood, the masses have more access in the sharing. Cuoban something good and benefit. Adhere to the affordable, best, carefully cuoban village oil, water and heat, cultural, city and County columns practical, developments benefit families, bring more welfare to the masses. Development of social convenience. Acceptance of balanced development of compulsory education through the national assessment, the County vocational education center was named \onal education in China\batch of national reform and development model through provincial ... Five is to deepen reform and innovation to break bottlenecks and endogenous development of effective fire. As an engine of dynamism, adding reform key to adopting reform measures stress energy and break bottlenecks and promoting development. Pay close attention to the key areas of reform. Conscientiously implement the provincial deployment and cancel, adjustment, to undertake the administrative approval items according to Regulation 347 to further improve administrative efficiency continuing deepening reform for poverty alleviation, speeding up rural land right registration certification pilot project, encouraging the orderly transfer of land management, utilize the land resources, in order to promote scale management laid the Foundation. Actively cultivate the market. Firmly establish a market-oriented, nurturing family farms, industrial users, professional cooperation organization new market management main body 456, effectively improve the industry, intensive and marketization of encouraging support social capital into the small micro-credit, urban development, culture and tourism, public services and other areas, easing development shortfall. To promote mass innovation. To support the rural sector to use new thinking and new ideas, creative work incentives such as actively promoting financial intermediation, bring added 159 in non public enterprises, individually-1540, created a sub(11,7,&a);sub(5,a,&b);sub(a,b,&c); printf(“%d,%d,%d\\n”,a,b,c); }

(A)-4,-9,-5 (B)-4,9,5 (C)4,-9,-5 (D)-4,9,-5 31.以下程序运行结果是 B 。

main()

{int a[2][3]={1,3,5,4,7,6},i,j,b=a[0][0]; for(i=0;i<2;i++) for(j=0;j<3;j++) if(b

(A)5 (B)7 (C)4 32.以下程序运行结果是 C 。

main()

{char s[50]=”I am a student”,c; int i,num=0,word=0; for(i=0;c=s[i];i++) if(c==’’) word=0; else if(word==0) {word=1;num++;} printf(“%d\\n”,num); }

(A)2 (B)3 (C)4 33.以下程序运行结果是 A 。

#include main()

{char s[50]=””,*p=s; int i;

i=*(p+5)-*(p+2);

printf(“%d\\n”,i*strlen(s)); }

(A)21 (B)24 (C)14 34.以下程序运行结果是 D 。

main()

{int a[]={1,2,3,4,5,6,7,8,9},i,j,k; for(i=0,j=8;i

(A)11 (B)12 (C)13 35.以下程序运行结果是 C 。

main()

{int x[]={1,2,3},s,*p=x,i; for(i=0,s=1;i<3;i++,p++) s*=*p;

printf(“%d\\n”,s); }

D)1 (D)5 (D)28 (D)14 ( Pushing ahead, East, North, West development, facilitating shanty, complete xincheng West Road, stability and reconstruction of the street, Star Ding garden built century Garden District, subject public housing construction, heating the gas expansion accelerated implementation, Jing Rui River and bridge style line solid shaft, further expanded the town development. Beautiful country adhere to the advance and typical for a group to lead. According to \ogical lay based, and industry increased income, and live upgrade civilization, and culture rich connotation\caught built beautiful village, and whole village advance, and easily relocation, and \built\ct near 30 a; depth into ecological, and industry, and culture, and tourism, elements, high standards caught party original city Liu, and jade are Xia AO, model village, in province City set has benchmark. Four is equal benefits to promote sharing, coordinated development of various social undertakings. In the case of rigid spending slowing revenue growth, increase, financial 75% to the people's livelihood, the masses have more access in the sharing. Cuoban something good and benefit. Adhere to the affordable, best, carefully cuoban village oil, water and heat, cultural, city and County columns practical, developments benefit families, bring more welfare to the masses. Development of social convenience. Acceptance of balanced development of compulsory education through the national assessment, the County vocational education center was named \onal education in China\batch of national reform and development model through provincial ... Five is to deepen reform and innovation to break bottlenecks and endogenous development of effective fire. As an engine of dynamism, adding reform key to adopting reform measures stress energy and break bottlenecks and promoting development. Pay close attention to the key areas of reform. Conscientiously implement the provincial deployment and cancel, adjustment, to undertake the administrative approval items according to Regulation 347 to further improve administrative efficiency continuing deepening reform for poverty alleviation, speeding up rural land right registration certification pilot project, encouraging the orderly transfer of land management, utilize the land resources, in order to promote scale management laid the Foundation. Actively cultivate the market. Firmly establish a market-oriented, nurturing family farms, industrial users, professional cooperation organization new market management main body 456, effectively improve the industry, intensive and marketization of encouraging support social capital into the small micro-credit, urban development, culture and tourism, public services and other areas, easing development shortfall. To promote mass innovation. To support the rural sector to use new thinking and new ideas, creative work incentives such as actively promoting financial intermediation, bring added 159 in non public enterprises, individually-1540, created a (A)2 (B)4 (C)6 (D)8

三 阅读填空(每小空2分,共20分)

1. 计算球的体积。 main()

{float r,v;

scanf(“ %f ”,&r); v=4*3.14*r*r*r/3 ; printf(“v=%6.2f\\n”,v); }

2. 判断质数。

#include main()

{int i,flag=1,n; scanf(“%d”,&n);

for(i=2;i<=sqrt(n);i++) if( n%i==0 ) {flag=0; break; }

if( found==1 )

printf(“%d是质数\\n”,n); else

printf(“%d不是质数\\n”,n); }

3. 计算数组中元素的平均值。 main()

{float average(int a[]); int a[10],i; float aver;

for(i=0;i<10;i++) scanf(“%d”,&a[i]); aver= average(a) ;

printf(“average is %6.2f”,aver); }

float average(int a[]) {

int sum=0,i; float aver;

for(i=0;i<10;i++) sum=sum+a[i] ; aver=sum/10;

return aver ; }

4. 统计字符串中字母的个数。

C语言试卷及答案

Pushingahead,East,North,Westdevelopment,facilitatingshanty,completexinchengWestRoad,stabilityandreconstructionofthestreet,StarDinggardenbuiltcenturyGardenDistrict,subjectp
推荐度:
点击下载文档文档为doc格式
3ta6q6vzdi1xkfw968ko77t6k14pg601b51
领取福利

微信扫码领取福利

微信扫码分享