收藏 分销(赏)

江苏省计算机二级C语言试题及答案.doc

上传人:a199****6536 文档编号:10820963 上传时间:2025-06-18 格式:DOC 页数:8 大小:45.05KB 下载积分:6 金币
下载 相关 举报
江苏省计算机二级C语言试题及答案.doc_第1页
第1页 / 共8页
江苏省计算机二级C语言试题及答案.doc_第2页
第2页 / 共8页


点击查看更多>>
资源描述
relationship, established equivalent relationship 14, and subject: application problem (4)--scores and percentage application problem review content overview answers scores, and percentage application problem of key is: according to meaning, (1) determine standard volume (units "1") (2) find associate "volume rate corresponds to" relationship, Then in-line solution. Category fraction multiplication word problem score Division applications engineering problem problem XV, a subject: review of the measurement of the amount of capacity, measurement and units of measurement of common units of measurement and their significance in rate 1, currency, length, area, volume, unit size, volume, weight and rate. (Omitted) 2, commonly used time units and their relationships. (Slightly) with a measurement units Zhijian of of poly 1, and of method 2, and poly method 3, and of method and poly method of relationship measurement distance of method 1, and tool measurement 2, and estimates 16, and subject: geometry preliminary knowledge (1)--line and angle review content line, and segment, and Ray, and vertical, and parallel, and angle angle of classification (slightly) 17, and subject: geometry preliminary knowledge (2)--plane graphics review content triangle, and edges shaped, and round, and fan axisymmetric graphics perimeter and area combination graphics of area subject : Preliminary knowledge (3)-review of solid content category 1-d shapes are divided into: cylinder and cone 2, column is divided into: cuboid, square 3, cone cone of the features of cuboids and cubes relationship between characteristics of circular cone is slightly solid surface area and volume 1, size 2, table ...和 江苏省计算机2级考试 - 学年 第 学期 c程序设计 试卷( ) 题号 一 二 三 四 五 六 七 八 九 总 分 得分 一、选择题(本题共20道小题,共40分。) 1. 表示关系x≤y≤z的c语言表达式为A A) (X<=Y)&&(Y<=Z) B) (X<=Y)AND(Y<=Z) C) (X<=Y<=Z) D) (X<=Y)&(Y<=Z) 2. 以下程序的输出结果是D main( ) { int a=12,b=12; printf("%d %d\n",--a,++b); } A)10 10 B)12 12 C)11 10 D)11 13 3. 以下的for循环 for(x=0,y=0; (y!=123)&&(x<4); x + + );C A) 是无限循环 B)循环次数不定 C)执行4次 D)执行3次 4. 有以下程序 main( ` ) { char a[]="programming",b[]="language"; char *p1,*p2; int i; p1=a;p2=b; for(i=0;i<7;i++) if(*(p1+i)==*(p2+i)) printf("%c",*(p1+i)); } 输出结果是D A)gm B)rg C)or D)ga 5. 以下说法中正确的是D A) #define和printf都是C语句 B) #define是C语句,而printf不是 C) printf是C语句,但#define不是 D) #define和pri ntf都不是C语句 6. 下面的程序 main() { int x=3; B do { printf("%d\n",X-=2); }while(!(--x));} A) 输出的是1 B) 输出的是1和-2 C) 输出的是3和0 D) 是死循环 7. 下面能正确进行字符串赋值操作的语句是 A)char s[5]={"ABCDE"}; B)char s[5]={'A'、'B'、'C'、'D'、'E'}; C C) char *s;s="ABCDEF"; D)char *s; scanf("%s",s); 8. 以下程序的输出结果是 main( ) { int i,x[3][3]={9,8,7,6,5,4,3,2,1},*p=&x[1][1]; C for(i=0;i<4;i+=2)printf("%d ",p[i]); } A) 5 2 B) 5 1 C) 5 3 D) 9 7 9. 若要求在if后一对圆括号中表示a不等于0的关系,则能正确表示这一关系的表达式为 A) a<>0 B) !a C) a=0 D) a 10. 下面各语句行中,能正确进行赋字符串操作的语句行是 C A) char st[4][5]={"ABCDE"}; B) char s[5]={'A','B','C','D','E'}; C) char *s; s="ABCDE"; D) char *s; scanf("%s",s); 11. 若fp是指向某文件的指针,且已读到该文件的末尾,则C语言函数feof(fp)的返回值是 A) EOF B) -1 C) 非零值 D) NULL 12. 设p1和p2是指向同一个int型一维数组的指针变量,k为int型变量,则不能正确执行的语句是 A)k=*p1+*p2; B)p2=k; C)p1=p2; D)k=*p1 *(*p2); 13. 下面程序的输出是 main() { int a=-1, b=4,k; k=(a++<=0)&&(!(b--<=0)); printf("%d %d %d\n",k,a,b);} A) 0 0 3 B) 0 1 2 C) 1 0 3 D) 1 1 2 14. 若x是整型变量,pb是基类型为整型的指针变量,则正确的赋值表达式是 A) pb=&x B) pb=x; C) *pb=&x; D) *pb=*x 15. 设有 static char str[ ]="Beijing"; 则执行 printf("%d\n", strlen(strcpy(str,"China"))); 后的输出结果为 A) 5 B) 7 C) 12 D) 14 16. 以下程序的输出结果是 A) 10 1 9 2 B) 9 8 7 6 C) 10 9 9 0 D) 10 10 9 1 main( ) { int x=10,y=10,I; for(i=0;x>8;y=++i) printf("%d,%d ",x--,y); } 17. 设有如下函数定义: int f(char *s) { char *p=s; while(*p!='\0') p++; return(p-s); } 如果在主程序中用下面的语句调用上述函数,则输出结果为 printf("%d\n",f("goodbey!")); A) 3 B) 6 C) 8 D) 0 18. 若执行下面的程序时从键盘上输入3和4,则输出是 main() { int a,b,s; scanf("%d %d",&a,&b); s=a; if(a<b)s=b; s=s*s; printf("%d\n",s);} A) 14 B) 16 C) 18 D) 20 19. 下面四个选项中,均是C语言关键字的是: A. auto enum include B swith typedef continue C signed union scanf D if struct type 20. 有以下程序 viod fun (int a,int b,int c) {a=456;b=567;c=678;} main() { int x=10,y=20,z=30; fun (x,y,z); printf("%d,%d.%d",x,y,z); } 输出结果是 A)30,20,10 B)10,20,30 C)456,567,678 D)678,567,456 二、填空题(每空1分,共10分。) 1. 为表示关系:x≤y≤z ,应使用的C语言表达式是_____________。 2. 字符串是以__________为结束标志的一维字符数组。有定义:char a[]="";则a数组的长度是____________。 3. 设int a; float f; double i ;则表达式10+'a'+i*f值的数据类型是___________。 4. 设有说明语句"int a[3][4]={{1,2},{3,4,5},{6,7,8}};"则a[0][2]的初始化值为_____________,a[2][2]的初始化值为______________。 5. 假定p所指对象的值为25,p+1所指对象的值为46,则执行"(*p)++;"语句后,p所指对象的值为___________ 6. 程序由主要由__________、_________组成。 7. 有函数调用fun1(x+y,(y,z),10,fun((x,y―1)));函数fun1有_______ 个参数 三、判断题(本题共10道小题,共10分。) 1. 在C中,外部变量的隐含类别是自动存储类别( ) 2. 实参和与其对应的形参共占用一个存储单元( ) 3. 在不得已的情况下(例如提高程序运行效率),才使用goto语句( ) 4. 条件表达式可以取代if语句,或者用if语句取代条件表达式( ) 5. 函数中的静态变量在函数每次调用时,都会重新设置初值( ) 6. 全局变量都是静态存储( ) 7. 如果在所有函数定义之前,在函数外部已做了声明,则各个主调函数不必再做函数原型声明( ) 8. 系统不允许用户重新定义标准库函数( ) 9. 若调用一个函数,且此函数中没有return语句,则该函数没有返回值( ) 10. 函数调用:strcat(strcpy(str1,str2),str3)的功能是将串str2连接到串str1之后再将串str1复制到串str3中( ) 四、程序填空(本题共5道小题,每题4分,共20分。) 1. 以下fun函数把ch中的大写字母转换成字母序列中的下一个大写字母,字母Z转换成字母A,其它字符不变,返回转换后的字母或其它字符。请填空。 char fun(char ch) { if(ch= ='Z') ch=__________; else if(ch>='A'&&ch<='Y') ch=__________; return ch; } 2. 以下sstrcpy( )函数实现字符串复制,即将t所指字符串复制到s所指向内存空间中,形成一个新的字符串s。请填空。 void sstrcpy(char *s,char *t) { while(*s++=_____________);} main( ) { char str1[100],str2[]="abcdefgh"; sstrcpy(str1,str2); printf("%s\n",str1); } 3. 以下程序段用于构成一个简单的单向链表。 struct STRU { int x, y ; float rate; ____________p; } a, b; a.x=0; a.y=0; a.rate=0; a.p=&b; b.x=0; b.y=0; b.rate=0; b.p=NULL; 4. 电话990拨号上网费率白天是每小时4.20元,夜间是每小时2.70元。使用的分钟(整数minute)和费率(含小数fei)变量由键盘输入,请补上语句。 main() { int minute; float fei; scanf(______________ ); printf("上网费=%8.2f元\n", _____________ ); } 5. 以下程序中, for循环体执行的次数是______________。 #define N 2 #define M N+1 #define K M+1*M/2 main() { int i; for(i=1;i<K;i++) { ... } ... } 五、编程题(本题共2道小题,共20分。) 1. 打印出所有的“水仙花数”,所谓“水仙花数”是指一个三位数,其各位数字立方和等于该数本身。例如:153是一个“水仙花数”,因为153=1的三次方+5的三次方+3的三次方。 2. 请编写函数fun,函数的功能是:在字符串中所有数字字符前加一个$字符。 例如,输入:A1B23CD45,则输出为:A$1B$2$3CD$4$5。 江苏省计算机等级考试 - 学年 第 学期 c程序设计 试卷(参考答案) 题号 一 二 三 四 五 六 七 八 九 总 分 得分 一、选择题(本题共20道小题,共40分。) 1. A 2. D 3. C 4. D 5. D 6. B 7. C 8. C 9. D 10. C 11. D 12. B 13. C 14. A 15. A 16. D 17. C 18. B 19. B 20. A 二、填空题(每空1分,共10分。) 1. (x<=y)&&(y<=z) 2. '\0' , 0 3. double 4. 0 , 8 5. 26 6. 数据结构 ,算法 7. 4 三、判断题(本题共10道小题,共10分。) 1. 对 2. 错 3. 错 4. 错 5. 错 6. 错 7. 对 8. 对 9. 错 10. 四、程序填空(本题共5道小题,每题4分,共20分。) 1. 'A' , ch+1 2. *t++ 3. Struct STRU * 4. "%d %f",&minute, &fei fei*minute/60 5. 4 五、编程题(本题共2道小题,共20分。) 1. main() { int i,j,k,n; printf("'water flower'number is:");  for(n=100;n<1000;n++)  {   i=n/100;/*分解出百位*/ j=n/10%10;/*分解出十位*/   k=n%10;/*分解出个位*/   if(i*100+j*10+k==i*i*i+j*j*j+k*k*k)    {    printf("%-5d",n);    }  } printf("\n"); } 2. #include <stdio.h> void fun( char *s) {char a[100]; int i=0; while(*s) if(*s>='0'&&*s<='9') {a[i++]='$';a[i++]=*s++;} else a[i++]=*s++; a='\0'; strcpy(s,a); } main() { char s[80]; printf("enter a string:"); scanf("%s", s); fun(s); printf("the result: %s\n", s); } 和平与发展是当今世界发展的主题,中国作为屹立在世界东方的大国,要担负起重要的责任。从“亚太自由贸易区”到“亚投行”、“一带一路”,再到G20峰会,都体现出中国一个负责任的大国形象。
展开阅读全文

开通  VIP会员、SVIP会员  优惠大
下载10份以上建议开通VIP会员
下载20份以上建议开通SVIP会员


开通VIP      成为共赢上传

当前位置:首页 > 考试专区 > 其他

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2025 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服