{ printf(\,fun(7));} 执行后的输出结果是( C )。
A) 7 B) 3 C) 2 D) 0
19.已有定义:char c;,程序前面已在命令行中包含ctype.h文件,不能用于判断c中的字符是否为
大写字母的表达式是( B )。 A) isupper(c)
B) 'A'?<=c<=?'Z'
C) 'A'?<=c&&c<=?'Z'
D) c<=(?'z''?-32)&&(?'a'?-32)<=c
20.设有定义int a;float b;,执行scanf(\-%f\,&a,&b);语句时,若从键盘输入876<空格> 854.0<
回车>,a和b的值分别是( B )。 A) 876和543.000000 B) 87和6.000000 C) 87和543.000000 D) 76和543.000000
21.有以下定义:int a;long b;double x,y;则以下选项中正确的表达式是( A) a%(int)(x-y) B) a=x!=y; C) (a*y)%b
D) y=x+y=x
22.运行下面程序时,从键盘输入字母H,则输出结果是(
B )。
C )。
#include
{ char ch; ch=getchar(); switch(ch)
{case ?H?:printf(\!\\n\; case ?G?:printf(\!\\n\; default:printf(\ Bye!\\n\; } }
A) Hello! B) Hello! Good Moring! C) Hello!
Good morning! Bye Bye! D) Hello! Bye Bye!
23.有以下程序:
#include
char s[]=\; int i,n=0;
for(i=0;s[i]!=0;i++)
if(s[i]>=?'0'?&& s[i]<=?'9'?)n++; printf(\,n); }
程序运行后的输出结果是( C )。
A) 0 B) 3 C) 4 D) 7
24.有以下程序:
main() {
int a=0,b=0,c=0,d=0; if(a=1) b=1;c=2; else d=3;
printf(\%d,%d,%d,%d\\n\,a,b,c,d); }
程序输出结果是( D )。 A) 0,1,2,0 B) 0,0,0,3 C) 1,1,2,0 D) 编译有错
25.定义如下变量和数组:
int i;
int x[3][3]={1,2,3,4,5,6,7,8,9}; 则下面语句的输出结果是( C )。
for(i=0; i<3; i++)
printf(\,x [2-i] [i]); A) 9 5 1 B) 7 4 1 C) 7 5 3 D) 9 6 3
26.在C语言中,只有在使用时才占用内存单元的变量,其存储类型是( A) auto和register B) extern和register C) auto和static D) static和register
27.有以下程序:
#include
A )。
if(b==0)return a;
else return(fun(--a,--b)); }
main(){
printf(\,fun(4,2)); }
程序的运行结果是( B )。
A) 1 B) 2 C) 3 D) 4
28.有以下程序:
point(char *p){p+=3;}
main(){char a[4]={?'1'?,?'2'?,?'3'?,?'4'?},*p=a; point(p);
printf(\,*p); }
程序运行后的输出结果是( A )。
A) 1 B) 2 C) 3 D) 4
29.阅读下列程序段,程序的输出结果为(
A )。
#include \
#define M(X,Y)(X)*(Y) #define N(X,Y)(X)/(Y) main()
{ int a=5,b=6,c=8,k; k=N(M(a,b),c); printf(\,k);}
A) 3 B) 5 C) 6 D) 8
30.设有以下函数:
void fun(int n,char *s){ …… }
则下面对函数指针的定义和赋值均正确的是( A )。 A) void (*pf)(); pf=fun; B) void *pf(); pf=fun; C) void *pf(); *pf=fun;
D) void(*pf)(int,char); pf=&fun;
31.有以下程序:
#include
void fun(int *s,int n1,int n2){ int i,j,t; i=n1;j=n2;
while(i main(){ int a[10]={1,2,3,4,5,6,7,8,9,0},k; fun(a,0,3); fun(a,4,9); fun(a,0,9); for(k=0;k<10;k++)printf(\,a[k]); printf(\; } 程序的运行结果是( C )。 A) 0987654321 B) 4321098765 C) 5678901234 D) 0987651234 32.下面结构体的定义语句中,错误的是( B )。 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;}a; D) struct {int x;int y;int z;}a; 33.有以下程序: void f(int *q){ int i=0; for( ;i<5;i++)(*q)++; } main(){ int a[5]={1,2,3,4,5},i; f(a); for(i=0;i<5;i++)printf(\,\,a[i]); } 程序运行后的输出结果是( B )。 A) 2,2,3,4,5, B) 6,2,3,4,5, C) 1,2,3,4,5, D) 2,3,4,5,6, 34.有以下程序: #include void fun(char *a,char *b){ while(*a==' * '?)a++; while(*b=*a){b++;a++;} } main(){ char *s=\,t[80]; fun(s,t); puts(t); } 程序的运行结果是( C )。 A) *****a*b B) a*b C) a*b**** D) ab 35.有以下程序: #include { int x,y;}data[2]={1,10,2,20}; main(){ struct st *p=data; printf(\,\,p->y); printf(\,(++p)->x); } 程序的运行结果是( C )。 A) 10,1 B) 20,1 C) 10,2 D) 20,2 36.有以下程序: int fun(int x[],int n) {static int sum=0,i; for(i=0;i main() { int a[]={1,2,3,4,5},b[]={6,7,8,9},s=0; s=fun(a,5)+fun(b,4);printf(\,s); } 程序执行后的输出结果是( C)。 A) 45 B) 50 C) 60 D) 55 37.有以下程序: int add(int a,int b){return(a+b); } main() { int k,(*f)(),a=5,b=10; f=add; … } 则以下函数调用语句错误的是( C )。 A) k=(*f)(a,b); B) k=add(a,b); C) k=*f(a,b); D) k=f(a,b); 38.有以下程序段: struct st { int x;int *y;} *pt; int a[]={1,2},b[]={3,4}; struct st c[2]={10,a,20,b}; pt=c; 以下选项中表达式的值为11的是( C )。 A) *pt->y B) pt->x C) ++pt->x D) (pt++)->x