【计算机类职业资格】二级C语言真题2013年09月-(3)及答案解析.doc
《【计算机类职业资格】二级C语言真题2013年09月-(3)及答案解析.doc》由会员分享,可在线阅读,更多相关《【计算机类职业资格】二级C语言真题2013年09月-(3)及答案解析.doc(30页珍藏版)》请在麦多课文档分享上搜索。
1、二级 C 语言真题 2013 年 09 月-(3)及答案解析(总分:100.00,做题时间:90 分钟)一、选择题(总题数:40,分数:40.00)1.设栈的顺序存储空间为 S(0:49),栈底指针 bottom=49,栈顶指针 top=30(指向栈顶元素)。则栈中的元素个数为_。(分数:1.00)A.30B.29C.20D.192.某二叉树的前序序列为 ABCDEFG,中序序列为 DCBAEFG,则该二叉树的深度(根节点在第 1 层)为_。(分数:1.00)A.2B.3C.4D.53.下列叙述中正确的是_。(分数:1.00)A.存储空间连续的数据结构一定是线性结构B.存储空间不连续的数据结构
2、一定是非线性结构C.没有根节点的非空数据结构一定是线性结构D.具有两个根节点的数据结构一定是非线性结构4.下列叙述中正确的是_。(分数:1.00)A.带链队列的存储空间可以不连续,但队头指针必须大于队尾指针B.带链队列的存储空间可以不连续,但队头指针必须小于队尾指针C.带链队列的存储空间可以不连续,且队头指针可以大于也可以小于队尾指针D.带链队列的存储空间一定是不连续的5.某系统结构图如下图所示: (分数:1.00)A.2B.3C.4D.n6.下面不能作为软件需求分析工具的是_。(分数:1.00)A.PAD 图B.数据字典(DD)C.数据流程图(DFD 图)D.判定树7.下面不属于对象基本特点
3、的是_。(分数:1.00)A.标识唯一性B.可复用性C.多态性D.封装性8.据库设计中,描述数据间内在语义联系得到 E-R 图的过程属于_。(分数:1.00)A.逻辑设计阶段B.需求分析阶段C.概念设计阶段D.物理设计阶段9.两个关系 R,S 如下,由关系 R 和 S 得到关系 T,则所使用的操作为_。 R B C D a 0 k1 S B C D f 3 k2 n 2 x1 T B C D a 0 k1 f 3 k2 n 2 x1 (分数:1.00)A.并B.自然连接C.差D.交10.关系数据模型_。(分数:1.00)A.只能表示实体间 1:1 联系B.只能表示实体间 1:m 联系C.可以表
4、示实体间 m:n 联系D.能表示实体间 1:n 联系而不能表示实体间 n:1 联系11.以下选项中叙述正确的是_。(分数:1.00)A.C 程序中的语句要经过编译才能转换成二进制机器指令B.算法需要包含所有三种基本结构C.有些算法不能用三种基本结构来表达D.简单算法的操作步骤不能超过 20 步12.以下选项中叙述正确的是_。(分数:1.00)A.复杂任务可以分解成简单子任务B.C 语言程序中的所有函数必须保存在同一个源文件中C.全部三种基本结构都包含的才是结构化程序D.C 语言程序可以定义多个不同内容的 main 函数13.以下选项中,合法的数值型常量是_。(分数:1.00)A.3.1415B
5、.“A“C.092D.0xDH14.以下选项中,合法的实数是_。(分数:1.00)A.4.5E2B.E1.3C.7.11ED.1.2E1.215.若有定义 int a,b,c;以下选项中的赋值语句正确的是_。(分数:1.00)A.a=(b=c)+1;B.(a=b)=c=1;C.a=(b=c)=1;D.a+b=c;16.有如下程序: #include stdio.h main() int x=0x13; printf(“%d/n“,x+1); 程序运行后的输出结果是_。(分数:1.00)A.12B.14C.20D.1317.对于 if(表达式)语句,以下叙述正确的是_。(分数:1.00)A.“表
6、达式”的值可以是任意合法的数值B.在“表达式”中不能出现变量C.在“表达式”中不能出现常量D.“表达式”的值必须是逻辑值18.以下程序段中,不能实现条件“如果 ab 则 x=10,否则 x=-10”的是_。(分数:1.00)A.x=(a=b)?-10:10;B.if(ab)x=10;else x=-10;C.x=-10;if(ab)x=10;D.if(ab)x=10;if(ba)x=-10;19.以下能够实现计算 5!的程序段是_。(分数:1.00)A.int fac=1,k=0;dok+;fac*=k; while(k5);B.int fac=0,k=1;dofac*=k;k+; while
7、(k5);C.int fac=1,k=1;dok+;fac*=k; while(k=5);D.int fac=1,k=0;dofac*=k;k+; while(k5);20.有以下程序: #include stdio.h main() int x=0,y=6; do while(-y)x+; while(y-); printf(“%d,%din“,x,y); 程序的运行结果是_。(分数:1.00)A.5,0B.6,0C.5,-1D.6,-121.有以下程序: #include stdio.h main() char*s=“120119110“; int n0,n1,n2,nn,i; n0=n1
8、=n2=nn=i=0; do switch(si+) default: nn+; case“0“: n0+; case“1“: n1+; case“2“: n2+; while(si); printf(“n0=%d,n1=%d,n2=%d,nn=%d/n“,n0,n1,n2,nn); 程序的运行结果是_。(分数:1.00)A.n0=3,n1=8,n2=9,nn=1B.n0=2,n1=5,n2=1,nn=1C.n0=2,n1=7,n2=10,nn=1D.n0=4,n1=8,n2=9,nn=122.有以下程序: #include stdio.h int m1(int x, int y) retur
9、n x=y?x:y; int m2(int x,int y) return x=y?y:x; int fun(int a,int b) return a+b; main() int x=2,y=3,z=1; printf(“%d/n“,fun(m1(x,y),m2(y,z); 程序的运行结果是_。(分数:1.00)A.6B.5C.4D.323.有如下程序: #include stdio.h int sub(double a,double b) return(int)(a-b); main() printf(“%d/n“,sub(3.8,2.1); 程序运行后的输出结果是_。(分数:1.00)A
10、.2.0B.1.7C.2D.124.有如下程序: #include stdio.h main() char*p1=0; int*p2=0; double*p3=0; printf(“%d,%d,%d/n“,sizeof(p1),sizeof(p2),sizeof(p3); 程序运行后的输出结果是_。(分数:1.00)A.4,4,4B.1,4,8C.0,0,0D.1,2,425.有如下程序: #include stdio.h main() int a = 0,*ptr; ptr = *ptr = 3; a = (*ptr)+; printf(“%d,%d/n“,a,*ptr); 程序运行后的输出
11、结果是_。(分数:1.00)A.4,4B.0,1C.1,4D.0,426.有如下程序: #include stdio.h main() int i,k; int array42 = 1,2,4,9,6; for(i=0;i2;i+) for(k=0;k4;k+) printf(“%d,“,arrayki); printf(“/n“); 程序运行后的输出结果是_。(分数:1.00)A.1,2,4,9,6,B.1,4,6,0,2,9,0,0,C.2,9,0,0,1,4,6,0,D.2,9,6,1,4,27.有如下程序: #include stdio.h main() int i,*ptr; int
12、 array3 = 8,2,4; for(ptr=array,i=0; i2; i+) printf(“%d,“,*ptr+); printf(“/n“); 程序运行后的输出结果是_。(分数:1.00)A.8,2,B.8,8,C.2,4,D.4,8,28.有如下程序: #include stdio.h main() int i,*ptr; int array5 = 5,3,1; for(ptr=array, i=0; i5; i+, ptr+) if (*ptr = 0) putchar(“X“); else putchar(“A“+*ptr); printf(“/n“); 程序运行后的输出结
13、果是_。(分数:1.00)A.FDBXXB.FFFXXC.FDBBBD.ABCDE29.有如下程序: #include stdio.h #include string.h main() char name10= “c-book“; char*str = name; printf(“%d,%d,%d,%d/n“, sizeof(name), strlen(name), sized(str), strlen(str); 程序运行后的输出结果是_。(分数:1.00)A.10,6,4,6B.11,6,11,6C.11,6,1,6D.10,7,1,730.有如下程序: #include stdio.h
14、main() char name10=“S“,“T“,“R“,“I“,“N“,“G,; name3=“E“;name5 = 0; printf(“%s/n“,name); 程序运行后的输出结果是_。(分数:1.00)A.STRENGB.STRIEGC.STREND.STRENO31.有如下程序: #include stdio.h int disp(char*str) while(*str)putchar(*str+); return*str; main() printf(“%d/n“, disp(“NAME“); 程序运行后的输出结果是_。(分数:1.00)A.NAME0B.NAMEEC.NA
15、MED.NAME/032.有如下程序: #include stdio.h main() char*p,old_str10=“wind“; int password; scanf(“%d“, p = old_str; while(*p) printf(“%c“,*p + password); p+; printf(“/n“); 程序运行时,从键盘输入 2回车,输出结果是_。(分数:1.00)A.ykpfB.windC.xjoeD.222233.有如下程序: #include stdio.h int sum(int*array,int len) if(len = 0) return array0;
16、 else return array0+sum(array+1, len-1); main() int array5 = 1,2,3,4,5; int res = sum(array,4); printf(“%d/n“,res); 程序运行后的输出结果是_。(分数:1.00)A.15B.10C.8D.134.有如下程序: #include stdio.h int*sum(int data) static int init = 0; init += data; return main() int i,*p; for(i=1; i=4; i+) sum(i); p = sum(0); printf
17、(“%d/n“,*p); 程序运行后的输出结果是_。(分数:1.00)A.15B.0C.1D.1035.有如下程序: #include stdio.h #define D(x)4*x+1 main() int i = 2,j = 4; printf(“%d/n“, D(i+j); 程序运行后的输出结果是_。(分数:1.00)A.25B.13C.9D.1236.有如下程序: #include stdio.h struct S int x,y; ; main() struct S data2 = 4,3,1,9; int i; for(i=0; i2; i+) printf(“%d,%d;“,da
18、tai.x,datai.y1); printf(“/n“); 程序运行后的输出结果是_。(分数:1.00)A.4,1;1,4;B.4,1;2,4;C.4,3;1,9;D.4,3;2,3;37.有如下程序: #include stdio.h #include string.h struct S char name10; ; void change(struct S *data, int value) strcpy(data-name,“*“); value = 13; main() struct S input; int num = 4; strcpy(input.name,“THIS“); c
19、hange( printf(“%s,%d/n“,input.name,num); 程序运行后的输出结果是_。(分数:1.00)A.*,4B.*,13C.THIS,4D.THIS,1338.有如下程序: #include stdio.h #include string.h struct S char name10; ; main() struct S s1,s2; strcpy(s1.name,“12345“); strcpy(s2.name,“ABC“); s1 = s2; printf(“%s/n“,s1.name); 程序运行后的输出结果是_。(分数:1.00)A.ABC12B.ABC45
20、C.12345D.ABC39.有如下程序: #include stdio.h main() int i, array5 = 3,5,10,4; fbr(i=0; i5; i+) printf(“%d,“,arrayi printf(“/n“); 程序运行后的输出结果是_。(分数:1.00)A.3,1,2,0,0,B.3,5,10,4,0,C.3,3,3,3,0,D.3,2,2,2,0,40.有如下程序: #include stdio.h main() int i; FILE* fp; for(i=0; i5; i+) fp = fopen(“output.txt“,“w“); fputc(“A
21、“+i,fp); fclose(fp); 程序运行后,在当前目录下会生成一个 output.txt 文件,其内容是_。(分数:1.00)A.EB.EOFC.ABCDED.A二、程序填空题(总题数:1,分数:20.00)41.程序通过定义学生结构体数组,存储若干名学生的学号、姓名和三门课的成绩。函数 fun 的功能是:将存放学生数据的结构体数组,按姓名的字典序(从小到大)排序。 请在程序的下画线处填入正确的内容,使程序得出正确的结果。 注意:部分源程序给出如下。 不得增行或删行,也不得更改程序的结构! 试题程序: #include stdio.h #include string.h struct
22、 student long sno; char name10; float score3; ; void fun(struct student a, int n) /*found*/ 1t; int i, j; /*found*/ for(i=0; i 2; i+) for(j=i+1; jn; j+) /*found*/ if(strcmp( 3)0) t = ai; ai = aj; aj = t; main() struct student s4=10001,“ZhangSan“,95,80,88,10002,“LiSi“,85,70,78,10003,“CaoKai“,75,60,88
23、,10004,“FangFang“,90,82,87; int i,j; printf(“/n/nThe original data:/n/n“); for(j=0; j4; j+) printf(“/nNo:%ld Name:%-8s Scores: “,sj.sno,sj.name); for(i=0; i3; i+) printf(“%6.2f“,sj.scorei); printf(“/n“); fun(s,4); printf(“/n/nThe data after soring:/n/n“); for(j=0; j4; j+) printf(“/nNo:%td Name:%-8s
- 1.请仔细阅读文档,确保文档完整性,对于不预览、不比对内容而直接下载带来的问题本站不予受理。
- 2.下载的文档,不会出现我们的网址水印。
- 3、该文档所得收入(下载+内容+预览)归上传者、原创作者;如果您是本文档原作者,请点此认领!既往收益都归您。
下载文档到电脑,查找使用更方便
5000 积分 0人已下载
下载 | 加入VIP,交流精品资源 |
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 计算机 职业资格 二级 语言 2013 09 答案 解析 DOC
