当前位置:大学生在线网大学生专栏考试计算机等级考试试题计算机二级考试试题计算机等级考试真题:2010年3月二级C语言(2)

计算机等级考试真题:2010年3月二级C语言(2)

10-27 17:47:16  浏览次数:0次  栏目:计算机二级考试试题
标签:计算机二级考试真题,计算机二级考试试题, 计算机等级考试真题:2010年3月二级C语言(2),http://www.dxs89.com

感谢大家对本系列文章的关注,本章我们将继续为正在备考计算机等级考试的同学提供《计算机等级考试真题:2009年9月二级C语言》系列内容,以下是本章的第二部分:

(21)有以下程序

#include<stdio.h> main() {int a=1,b=2;  for(;a<8;a++) { b+=a;a+=2;} printf(“%d,%d\n”,a,b); } 程序运行后的输出结果是 A)9,18 B)8,11 C)7,11 D)10,14 (22)有以下程序,其中k的初值为八进制数 #include<stdio.h> main() {int k=011; printf(“%d\n”,k++); } 程序运行后的输出结果是 A)12 B)11 C)10 D)9 (23)下列语句组中,正确的是 A)char *s;s="Olympic";      B)char s[7];s="Olympic"; C)char *s;s={"Olympic"}; D)char s[7];s={"Olympic"}; (24)以下关于return语句的叙述中正确的是 A)一个自定义函数中必须有一条return语句 B)一个自定义函数中可以根据不同情况设置多条return语句 C)定义成void类型的函数中可以有带返回值的return语句 D)没有return语句的自定义函数在执行结束时不能返同到调用处 (25)下列选项中,能正确定义数组的语句是 A)int num[0..2008]; B)int num[]; C)int N=2008      ; D)#define N 2008   int num[N];          int num[N]; (26)有以下程序 #include<stdio.h> void fun(char *c,int d) {*c=*c+1;d=d+1; printf(“%c,%c”,*c,d); }  main() {char b=‘a’,a=‘A’; fun(&b,a);printf(“%c,%c\n”,b,a); } 程序运行后的输出结果是 A)b,B,b,A B)b,B,B,A C)a,B,B,a D)a,B,a,B www.dxs89.com

(27)若有定义int(*pt)[3];,则下列说法正确的是

A)定义了基类型为int的三个指针变量 B)定义了基类型为int的具有三个元素的指针数组pt C)定义了一个名为*pt、具有三个元素的整型数组 D)定义了一个名为pt的指针变量,它可以指向每行有三个整数元素的二维数组 (28)设有定义double a[10],*s=a;,以下能够代表数组元索a[3]的是 A)(*s)[3] B)*(s+3) C)*s[3]    D)*s+3 (29)有以下程序 #include<stdio.h> main() {int a[5]={1,2,3,4,5},b[5]={0,2,1,3,0},i,s=0; for(i=1;i<3;i++) s=s+a[b[i]]; printf(“%d\n”,s); } 程序运行后的输出结果是 A)6 B)10 C)11 D)15 (30)有以下程序 #include<stdio.h> main() {int b[3][3]={0,1,2,0,1,2,0,1,2},i,j,t=1; for(i=1;i<3;i++)   for(j=1;j<=1;j++) t+=b[i][b[j][i]];  printf(“%d\n”,t); } 程序运行后的输出结果是 A)1 B)3 C)4 D)9 (31)若有以下定义和语句 char s1[10]="abcd!",s2="\n123\\"; printf("%d%d\n",strlen(s1),strlen(s2)); 则输出结果是 A)5 5 B)10 5 C)10 7 D)5 8 www.dxs89.com

(32)有以下程序

#include<stdio.h> #define N 8 void fun(int *x,int i) {*x=*x+i;} main() {int a[N]={1,2,3,4,5,6,7,8},i; fun(a,2); for(i=1;i<N/2;i++) {printf(“%d”,a[i]);} printf(“\n”); } 程序运行后的输山结果是 A)1313 B)2234 C)3234 D)1234 (33)有以下程序 #include<stdio.h> int f(int t[],int n); main() {int a[4]={1,2,3,4},s;  s=f(a,4);printf(“%d\n”,s);} int f(int t[],int n) {if (n>0)return t[n-1]+f(t,n-1); else return 0;}  程序运行后的输出结果是 A)4 B)10 C)14 D)6 (34)有以下程序 #include<stdio.h> int fun() {static int x=1;   x*=2;return x; } main() {int i,s=1; for(i=1;i<=2;i++) s=fun(); printf(“%d\n”,s); } 程序运行后的输出结果是 A)0 B)1 C)4 D)8 (35)有以下程序 #include<stdio.h> #define SUB(a) (a)-(a) main() {int a=2,b=3,c=5,d; d=SUB(a+b)*c; printf(“%d\n”,d); } 程序运行后的输山结果是 A)0 B)-12 C)-20 D)10 www.dxs89.com

(36)设有定义:

struct complex {int real,unreal;} data1={1,8},data2; 则以下赋值语句中错误的是 A)data2=data1; B)data2=(2,6); C)data2.real=data1.real; D)data2.real=data1.unreal; (37)有以下程序 #include<stdio.h> #include<string.h> struct A {int a;char b[10];double c;}; void f(struct At); main() {struct Aa={1001,“ZhangDa”,1098.0};f(a); printf(“%d,%s,%6.1f\n”,a.a,a.b,a.c);}  void f(struct At) {t.a=1002;strcpy(t.b,“ChangRong”);t.c=1202.0;} 输出结果是 A)1001,ZhangDa,1098.0 B)1002,ChangRong,1202.0 C)1001,ChangRong,10980 D)1002,ZhangDa,1202.0 (38)有以下定义和语句 struct workers {int num;char name[20];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; (39)有以下程序 #include<stdio.h> main() {int a=2,b=a,c=2; printf(“%d\n”,a/b&c); } 程序运行后的输出结果是 A)0 B)1 C)2 D)3 (40)有以下程序 #include<stdio.h> main() {FILE *fp;char str[10]; fp=open(“myfile.dat”,“w”); fputs(“abc”,pf);close(pf); fp=open(“myfile.dat”,“a+”); fprintf(pf,“%d”,28); rewind(pf); fscanf(pf,“%s”,str);puts(str); close(pf); } 程序运行后的输出结果是 A)abc B)28c C)abc28 D)因类型不一致而出错
以上就是考试百科为大家提供的《计算机等级考试真题:2009年9月二级C语言》的第二部分内容,更多关于计算机等级考试相关资讯请您继续关注考试百科。

,计算机等级考试真题:2010年3月二级C语言(2)