15,2
15,15
2,15
8,8
第1题:
有以下程序
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);}
程序运行后,输出结果是【 】。
第2题:
有如下程序: #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
第3题:
A. 22
B.23
C.24
D.程序有误
第4题:
有以下程序 int f1[int x.int y){ return x>y?x:y; } int f2(int x, int y){ returrnx>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",c,f,g); } 程序运行后的输出结果是
A.4,3,7
B.3,4,7
C.5,2,7
D.2,5,7
第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);pfintf(“%d\n”,i); } 程序运行后的输出结果是
A.-4
B.1
C.4
D.8
第6题:
以下程序的输出结果是( )。 #include<stdio.h> int fun(int n,int *s) { int f1,f2; if(n==0||n==1) *s=1; else { fun(n-1,&f1); fun(n-2,&f2); *s=f1+f2; } } void main() { int x; fun(6,&x); printf("\n%d" ,x);}
A.7
B.13
C.9
D.10
第7题:
C 程序写运行结果。
class A
{
public:
void f1()
{
printf("A::f1\r\n");
}
virtual void f2()
{
printf("A::f2\r\n");
}
void callfunc()
{
printf("A::callfunc\r\n");
f1();
f2();
}
};
class B :public A
{
public:
void f1()
{
printf("B::f1\r\n");
}
void f2()
{
printf("B::f2\r\n");
}
void callfunc()
{
printf("B::callfunc\r\n");
f1();
f2();
}
};
int main()
{
B *pB=new B;
pB->callfunc();
A *pA=pB;
pA->callfunc();
return 0;
}
第8题:
有如下程序 #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<<"F1 Derive"; } void f2(int x) { cout<<"F2 Derive"; } }; int main() { base obj1,*p; derive obj2; p=& obj2; p->f1(); p->f2(); return (); ) 执行后的输出结果是( )。
A.F1Derive F2Base
B.F1Derive F2Derive
C.F1Base F2Base
D.F1Base F2Derive
第9题:
有以下程序: #include<stdio.h> iht fun(iht 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
第10题:
有以下程序: #include <iostream> using namespace std; int f1(int x, int y) { return x>y ? x:y; } int f2(int x, int y) { return x>y? y:x; } int 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; cout<<d<<", "<<e<<", "<<f<<end1; return 0; } 执行后的输出结果是 ( )。
A.3,4,5
B.5,3,4
C.5,4,3
D.3,5,4
第11题:
以下程序的输出结果是( )。 include<stdio.h> void 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); f2=f1;f1=f; } printf("\n"); }
第12题:
y′+P(x)y=f1(x)+f2(x)
y+P(x)y′=f1(x)-f2(x)
y+P(x)y′=f1(x)+f2(x)
y′+P(x)y=f1(x)-f2(x)
第13题:
有以下程序
#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
第14题:
有以下程序 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
第15题:
有如下程序:
#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.
第16题:
有以下程序 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
第17题:
有以下程序 int f1 (int x,inty){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; pintf("%d,%d,%d\n",e,f,g); } 程序运行后的输出结果是 ______。
A.4,3,7
B.3,4,7
C.52,7
D.2,5,7
第18题:
有以下程序: 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
第19题:
有以下程序: int f1(doubleA){return a*a;} int f2(int x,int y) {double a,b; a=f1(x); b=f1(y); return a+b; } main() {double w; w=f2(2.1,4.0); } 程序执行后,变量w的值是( )。
A.20.21
B.20
C.20.0
D.0.0
第20题:
下列程序的输出结果是( )。 int fl(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
第21题:
下列程序的输出结果是( )。
int f1(int x,inty){return x>y?x:y;}
int f2(int x,inty){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;
phntf("%d,%d,%d\n",e,f,g);
}
A.4,3,7
B.3,4,7
C.5,2,7
D.2,5,7
第22题:
下列程序的输出结果是( )。 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
第23题:
有以下程序
#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