|
(21)有如下程序段 #include "stdio.h" main() {int a=10,b=50,c=30; a=a>30?1:2; b=b>30?1:2; c=c>30?1:2; printf("%d,%d,%d\n",a,b,c);} 则执行结果为 A)2,1,2 B)1,2,1 C)1,1,2 D)2,1,1 (22)阅读如下程序段 #include "stdio.h" main() { int a=45,b=40,c=50,d; d=a>30?b:c; switch(d) { case 30 : printf("%d,",a); case 40 : printf("%d,",b); case 50 : printf("%d,",c); default : printf("#");}} 则输出的结果是 A)40,50, B)50,# C)40,# D)40,50,# (23)若有定义int k=10;则下列程序的输出结果为 do{ printf("%d",k--); } while(!k); A)9 B)10 C)10987654321 D)没有输出 (24)阅读下列程序段,则程序的输出结果是 #include "stdio.h" main() { int a=10,b=10,k; for(k=0;a>8;b=++k) printf("%d,%d,",a--,--b); printf("\n");} A)10,10,10,0, B)10,9,9,0, C)10,10,9,1, D)9,9,9,1, (25)下列程序的运行结果是 #include "stdio.h" main() {int a,b,m; for(a=5;a>=1;a--) { m=0; for(b=a;b<=5;b++) m=m+a*b;} printf("%d\n",m);} A)30 B)15 C)20 D)10 (26)有字符串如下,"\n\\\407as1\"\xabc",则字符串的长度为 A)6 B)7 C)8 D)9 (27)阅读下面程序段 #include "stdio.h" main() { char c; c=(′z′-′a′)/2+′A′; putchar(c);} 输出结果为 A)M B)N C)O D)Q (28)下列说法中不正确的是 A)C语言规定,不能在一个函数的内部再定义函数 B)在没有声明函数返回值类型的情况下,C默认的函数返回值类型为int型 C)函数的类型可以是整型、实型、字符型,但不能是指针型 D)函数可以没有形参,但函数名后的一对圆括号不能省略 (29)现有如下程序,则程序的输出结果为 #include "stdio.h" int f(int a,int b) {int c; if(a>0&&a<10)c=(a+b)/2; else c=a*b/2; return c;} main() { int a=8,b=20,c; c=f(a,b); printf("%d\n",c);} A)随机数 B)80 C)28 D)14 (30)阅读如下程序段,则程序段的执行后的输出结果为 #include "stdio.h" main() { char c; int i; char count(); int p(char); for(i=0;i<30;i++)c=count(); p(c);} char count() { char str=′A′; str+=1; return(str);} p(char c) {putchar(c); putchar(′\n′);} A)A B)B C)a D)b (31)阅读如下程序段,则执行后的结果为 #include "stdio.h" main() {int a,*p,*q,**w; p=&a; q=&a; w=&p; *p=5%6; *q=5; **w=3; printf("%d\n",a);} A)无确定值 B)1 C)5 D)3 (32)现有定义int a=10,*p=&a;则不能使a的内容增1的语句是 A)*p++; B)*p=*p+1; C)++*p; D)*p+=1; (33)现有下列程序段 #include "stdio.h" void JFT(int *a,int *b,int *c,int *d,int *e) {int i,j,k,m; for(i=0;i<*a;i++) for(j=0;j<*b;j++) for(k=0;k<*c;k++) for(m=0;m<*d;m++)*e++;} main() {int a=10,b=10,c=10,d=10,e=0; JFT(&a,&b,&c,&d,&e); printf("%d\n",e);} 则程序段的输出结果是 A)10000 B)1000 C)10001 D)0 (34)已知:int c[5][6];则对数组元素引用不正确的是 A)c[0+2][2*1] B)c[1][3] C)c[4-2][0] D)c[5][2] (35)以下能对二维数组c进行正确的初始化的语句是 A)int c[3][]={{3},{3},{4}}; B)int c[][3]={{3},{3},{4}}; C)int c[3][2]={{3},{3},{4},{5}}; D)int c[][3]={{3},{},{3}};
共5页: 上一页 [1] 2 [3] [4] [5] 下一页
|