国家计算机二级c语言考试题库.docx
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_05.gif)
《国家计算机二级c语言考试题库.docx》由会员分享,可在线阅读,更多相关《国家计算机二级c语言考试题库.docx(17页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、国家计算机二级c语言考试题库 在国家计算机二级的考试题库中,有哪些C语言的题目呢?下面是学习啦我给大家整理的国家计算机二级c语言考试题库及答案,供大家参阅! 国家计算机二级c语言考试题库 一、选择题 1.若有以下定义和语句: char s 10="abcd!",*s2="nl23" Drintf("%d%dn",strlen(sl),strlen(s2); 则输出结果是()。 A.5 5 B.10 5 C.10 7 D.5 8 2.有以下程序: #include #define N 8 void fun(int*x,int i) *x
2、=*(x+i);) main() int aN=1,2,3,4,5,6,7,8,i; fun(a,2); for(i=0;iprintf("Ha",ai); printf("n"); ) 程序运行后的输出结果是()。 A.1313 B.2234 C.3234 D.1234 3.有以下程序: #include int f(int t,int n); main() int a4=1,2,3,4,s; s=f(a,4);printf("%dn",s); int f(int t,int n) if(n>0)return tn-1+f(t
3、,n-1); else return 0; ) 程序运行后的输出结果是()。 A.4 B.10 C.14 D.6 4.有以下程序: #include int fun() static int x=1; X*=2;return X; main() int i,S=1; for(i=1;i<=2;i+)s=fun(); printf¨%dn",s); ) 程序运行后的输出结果是()。 A.0 B.1 C.4 D.8 5.有以下程序: #include #define SUB(a)(a)-(a) main() int a=2,b=3,c=5,d; d=SUB(a+b)*C;
4、printf("%dn",d); ) 程序运行后的输出结果是()。 A.0 B.-l2 C.-20 D.10 6.设有定义: struet complex int real,unreal;)datal=1,8,data2; 则以下赋值语句中错误的是()。 A.data2=datal; B.data2=2,6; C.data2.real=datal.real; D.data2.real=datal.unreal; 7.有以下程序: #include #include struct A int a;char b10;double C;); void f(struct A t);
5、 main() struct A a="1001,"ZhangDa",l098,0; f(a);printf("%d,%S,%6.1fn",a.a,a.b,a.c); void f(struct A t) t.a=1002;strcpy(t.b,"ChangRon9");t.c=1202.0; 程序运行后的输出结果是()。 A.1001,ZhangDa,1098.0 B.1002,ChangRong,1202.0 C.1001,ChangRong,1098.0 D.1002,ZhangDa,1202.0 8.有以下定义和语句
6、: struct workers int num;char name20;char C; struct (int day;int month;int year;)S; ; struct workers w,*pw; pw=&w; 能给w中year成员赋1980的语句是()。 A.*pw.year=1980; B.w.year=1980; C.pw->year=1980 D.w.S.year=1980; 9.有以下程序: #include main() int a=2,b=2,C=2; print("%dn",a/b&c); 程序运行后的输出结果是()。
7、 A.0 B.1 C.2 D.3 10.有以下程序: #include main() FILE*fp;char str10; fp=fopen("myfile,dat",""); puts("abe",ip);fclose(fp); fp=fopen("myfile.dat","a*"); fprintf(fp,"%d",28); rewind(fp); fscanf(fp,"%S",str);puts(str); fclose(fp); 程序运行后的输出
8、结果是()。 A.abc B.28c C.abc28 D.内类型不一样而出错 二、程序改错题 给定程序中,函数proc()的功能是:使数组中的元素的值缩小5倍。 请修改程序中的错误,使它能得出正确的结果。 留意:不要改动main()函数,不得增行或删行,也不得更改程序的结构。 试题程序: #include #include #include float mlO; /*found* int proc(void) int j; printf("In subfunc after callingn"); for(j=0;j<10;j+) /*found* printf(&qu
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 国家 计算机 二级 语言 考试 题库
![提示](https://www.taowenge.com/images/bang_tan.gif)
限制150内