更多"How many messages "的相关试题:
[单项选择]已知下列函数定义 setw(int *b,int m,int n,int dat) { int k; for(k=0;k<m*n,k++) { *b=dat;b++;} } 则调用此函数的正确写法是(假设变量a的说明为int a[50]) ( )
A. setw(*a,5,8,1);
B. setw(&a,5,8,1);
C. setw((int*)a,5,8,1);
D. setw(a,5,8,1);
[单项选择] 考虑下面的函数: int min(int x,int y){return xint max(int x,int y){return x>y?x:y;} 对于下面的代码: t=0; for(i=max(x,y);i>=min(x,y);i--) t+=i; 假设x=1,y=100,则可以得到函数调用的次数为()
A. 200
B. 201
C. 101
D. 102
[单项选择]有以下程序
#include
int fun(int a,int b)
{ if(b==0) return a;
else return(fun(--a,--b));
}
main( )
{printf("%d/n",fun(4,2));}
程序的运行结果是
A. 1
B. 2
C. 3
D. 4
[单项选择]有以下程序:
void f(int a[ ],int i,int j)
{ int t;
if(i<j)
{ t=a[i]; a[i]=a[j];a[j]=t;
f(a,i+1,j-1); } }
main( )
{ int i,aa[5]={1,2,3,4,5};
f(aa,0,4);
for(i=0;i<5;i++) printf(“%d,”,aa[i]); printf(“/n”); }
执行后输出结果是( )。
A. 5,4,3,2,1,
B. 5,2,3,4,1,
C. 1,2,3,4,5,
D. 1,2,3,4,5,
[单项选择]执行C 程序代码“int a = 1; int b = 0; int c = 0; int d = (++a) * (c = 1);”后a, b, c, d 的值分别为 (59) 。
A. 2,0,1,2
B. 1,0,1,1
C. 2,0,1,1
D. 2,0,0,2
[单项选择]已知程序中已经定义了函数test,其原型是int test(int, int, int);,则下列重载形式中正确的是
A. char test(int,int,in;
B. double test(int,int,doubl;
C. int test(int,int,int=0);
D. float test(int,int,float=3.5;
[单项选择]函数int test(int a,int b=l,int c=0),下列调用不合法的个数是 test(0); test(0,0); test( ); test(0,0,0);
A. 0
B. 1
C. 2
D. 3
[单项选择]有以下程序
int f1(int x,int y){return x>y x:y;} int f2(int x,int y){return x>y y:x;} main( )
{
int a=4,b=3,c=5,d=2,e,f,g; e=f2(f1(a,b),f1(c,d)); f=f1(f2(a,b),f2(c,d)); g=a+b+c+d-e-f; printf("%d,%d,%d/n",e,f,g);
}
程序运行后的输出结果是______。
A. 4,3,7
B. 3,4,7
C. 5,2,7
D. 2,5,7
[单项选择]已知程序中已经定义了函数test,其原型是int test(int,int,int);,则下列重载形式中正确的是【 】
A. char test (int,int,int);
B. double test(int,int,double);
C. int test(int,int,int=0);
D. float test(int,int,float=3.5F);
[单项选择]函数int test(int a,int b=1,int c:0),下列调用不合法的个数是( )。
test(0); test(0,0); test( ); test(0,0,0);
A. 0
B. <
C. >
D. 9
[单项选择]有以下程序
fun(int X,int Y)
{static int m=0,i=2;
i+=m+1; m=i+X+Y; return m;
}
main( )
{int j=1,m=1,k;
k=fun(j,m);printf("%d,",k);
k=fun(j,m);printf("%d\n",k);
}
执行后的输出结果是【 】。
A. 5,5
B. 5,11
C. 11,11
D. 11,5
[单项选择]有以下程序:
int fa(int x)
{ return x *x;}
int fb(int x)
{ return x *x *x;}
int f(int( *f1)( ),int( *f2)( ),int x)
{ return f2(x)-f1(x);}
main( )
{ int i;
i=f(fa,fb,2);printf("%d/n",i);
}
程序运行后的输出结果是( )。
A. -4
B. 1
C. 4
D. 8
[单项选择]有以下程序:
void f(int v , int w)
{ int t;
t=v;v=w;w=t; }
main( )
{ int x=1,y=3,z=2;
if(x>y) f(x,y);
else if(y>z) f(y,z);
else f(x,z);
printf(“%d,%d,%d/n”,x,y,z);}
执行后输出结果是( )。
A. 1,2,3
B. 3,1,2
C. 1,3,2
D. 2,3,1
[单项选择]有以下程序
void f(int x,int y)
{ int t;
if(x<y){ t=x; x=y; y=t; }
}
main( )
{ int a=4,b=3,c=5;
f(a,b); f(a,c); f(b,c);
printf("%d,%d,%d/n",a,b,c);
}
执行后输出的结果是( )。
A. 3,4,5
B. 5,3,4
C. 5,4,3
D. 4,3,5