15,2
15,15
2,15
8,8
第1题:
有以下程序A: 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
第2题:
有以下程序
int fa(int x){return x*x;}
int fb(int x){return x*x*x;}
int f(int(*fl)(),int(*f2)(),int x}
{return f2(x)-f1(x);}
main()
{int i;i=f(fa,fb,2);printf("%d\n",i);}
程序运行后,输出结果是【 】。
第3题:
有以下程序
#include <stdio.h>
void fun(int n,int *p)
{ int f1,f2;
if(n==1||n==2) *p=1;
else
{ fun(n-1,&f1); fun(n-2,&f2);
*p=f1+f2;
}
}
main()
{ int s;
fun(3,&s); printf("%d\n",s);
}
程序的运行结果是
A)2
B)3
C)4
D)5
第4题:
A. 22
B.23
C.24
D.程序有误
第5题:
有如下程序: #include<iostream> using namespace std; class base { public: virtual void f1() { cout<<"F1Base"; } virtual void f2() { cout<<"F2Base "; } }; class derive : public base { void f1 ( ) { cout<<"F1Derive"; } void f2( int x ) { cout<<"F2 Derive"; } }; int main () { base objl, * p; derive obj2; p = & obj2; p -> f1(); p -> f2(); return 0; } 执行后的输出结果是( )。
A.F1Derive F2Base
B.F1Derive F2Derive
C.F1Base F2Base
D.F1Base F2Derive
第6题:
有以下程序: main( ) 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,e,f; d=f1(a,b); d=f1(d,c); e=f2(a,b); e=f2(e,c); f=a+b+c-d-e; printf("%d,%d,%d\n",d,f,e); } 执行后输出的结果是
A.3,4,5
B.5,3,4
C.5,4,3
D.3,5,4
第7题:
有以下程序
#include<stdi0.h>
void fun(int n,int*p)
( int f1,f2;
if(n==1|| n==2)*p=1;
else
{ fun(n-1,&f1);fun(n-2,&f2);
*p=f1+f2;
}
}
main
{ int s;
fun(3,&s);printf("%d",s);
}
程序的运行结果是( )。
A.2
B.3
C.4
D.5
第8题:
有以下程序
#include <stdio.h>
main()
{ int f,f1,f2,i;
f1=0;f2=1;
printf("%d %d ",f1,f2);
for(i=3;i<=5;i++)
{ f=f1+f2; printf("%d",f);
f1=f2; f2=f;
}
printf("\n");
}
程序运行后的输出结果是 【 1 0 】 。
第9题:
有以下程序 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),n(c,d));f=f1(f2(a,b),n(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
第10题:
有如下程序:
#include<iostream>
using namespace std;
int main(){
int f, f1=0, f2=1;
for(int i=3; i<=6; i++) {
f=f1+f2;
f1=f2; f2=f;
}
cout<<f<<end1;
return 0;
}
运行时的输出结果是( )。
A) 2
B) 3
C) 5
D) 8
A.
B.
C.
D.