时间:2011-09-20 13:27:16
switch(i%2)
{ case 0:
switch(a%2)
{ case 0:a++;break;
case 1:a--;
} break;
case 1:a=0;
}
for(i=0;i<4;i++)
printf("%d ",a);
printf("n");
}
程序运行后的输出结果是
A)3 3 4 4
B)2 0 5 0
C)3 0 4 0
D)0 3 0 4
(30)有以下程序
#include
#include
main()
{ char a[10]="abcd";
printf("%d,%dn",strlen(a),sizeof(a));
}
程序运行后的输出结果是
A)7,4
B)4,10
C)8,8
D)10,10
(31)下面是有关C语言字符数组的描述,其中错误的是
A)不可以用赋值语句给字符数组名赋字符串
B)可以用输入语句把字符串整体输入给字符数组
C)字符数组中的内容不一定是字符串
D)字符数组只能存放字符串
(32)下列函数的功能是
fun(char *a,char *b)
{ while((*b=*a)!=' '){a++;b++;} }
A)将a所指字符串赋给b所指空间
B)使指针b指向a所指字符串
C)将a所指字符串和b所指字符串进行比较
D)检查a和b所指字符串中是否有' '
(33)设有以下函数:
void fun(int n,char *s){……}
则下面对函数指针的定义和赋值均正确的是
A)void (*pf)(); pf=fun;
B)void *pf(); pf=fun;
C)void *pf(); *pf=fun;
D)void (*pf)(int,char);pf=&fun;
(34)有以下程序
#include
int f(int n);
main()
{ int a=3,s;
s=f(a);s=s+f(a);printf("%dn",s);
}
int f(int n)
{ static int a=1;
n+=a++;
return n;
}
程序运行后的输出结果是
A)7
B)8
C)9
D)10
(35)有以下程序
#include
#define f(x) x*x*x
main()
{ int a=3,s,t;
s=f(a+1);t=f((a+1));
printf("%d,%dn",s,t);
}
程序运行后的输出结果是
A)10,64
B)10,10
C)64,10
D)64,64
(36)下面结构体的定义语句中,错误的是
A)struct ord {int x;int y;int z;};struct ord a;
B)struct ord {int x;int y;int z;} struct ord a;
C)struct ord {int x;int y;int z;} n;
D)struct {int x;int y;int z;} a;
(37)设有定义: char *c;以下选项中能够使字符型指针C正确指向一个字符串的是
A) char str[]="string";c=str;
B) scanf("%s",c);
C) c=getchar();
D) *c="string";
(38)有以下程序
#include
#include
struct A
{ int a;char b[10];double c;};
struct A f(struct A t);
main()
{ struct A a={1001,"ZhangDa",1098.0};
a=f(a); printf("%d,%s,%6.1fn",a.a,a.b,a.c);
}
struct A f(struct A t)
{ t.a=1002;strcpy(t.b,"ChangRong");t.c=1202.0;return t;}
程序运行后的输出结果是
A)1001,ZhangDa,1098.0
B)1002,ZhangDa,1202.0
C)1001,ChangRong,1098.0
D)1002,ChangRong,1202.0
(39)有以下程序
int r=8;
printf("%dn",r>>1);
输出结果是
A)16 B)8 C)4 D)2
(40)下列关于C语言文件的叙述中正确的是
A)文件由一系列数据一次排列组成,只能构成二进制文件