有函数int m( float x) {float z;z=x;return(z);}则返回值是()
第1题:
下列给定程序中,函数fun()的功能是;计算函数 F(x, y ,z)=(x+ y)/(x-y)+(z+ y)/(z-y)的值。其中x和y不相等,z和y不等。例如,当x的值为9,y的值为11,2的值为15时,函数值为-3.50。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main 函数,不得增行或删行,也不得更改程序的结构。
试题程序:
include <stdio. h>
include <math. h>
/**************found******************/
define FU(m, n) (m/n)
float fun(float a, float b, float c)
{ float value;
value=FU(a+ b, a-b)+FU(c+ b, c-b);
/*************found******************/
return(Value);
}
main()
{ float x, y, z, sum;
printf ("Input x y z:: ");
scanf("%f%f%f", &x, &y, &z);
printf("x=%f, y=%f, z=%f\n ",x, y, z);
if (x==y||y==z) {printf ("Data error! \n ");
exit (0); }
sum=fun (x, y, z);
printf("The result is:%5. 2f\n ",sum);
}
第2题:
下列函数定义中,会出现编译错误的是 ______。
A.max(int x,int y,int *z) { *z=x>y? x:y;}
B.int max(int x,y) {int z; z=x>y? x;y; return z; }
C.max(int x,int y) { int z; z=x>y? x:y; return(z); }
D.int max(int x,int y) { return(x>y?x:y);}
第3题:
下列函数定义中,会出现编译错误的是
A.max(int x,int y,int *z) { *z=x>y ? x:y; }
B.int max(int x,y) { int z; z=x>y ? x:y; return z; }
C.max(int x,int y) { int z; z=x>y?x:y; return(z); }
D.int max(int x,int y) { return(x>y?x:y); }
第4题:
设有以下变量定义,并已赋确定的值: char w; int x; float y; double z; 则表达式:w*x+z-y所求得的数据类型为( )。
A.char
B.int
C.float
D.double
第5题:
若有如下程序段; int x=3,y=4,z;float a=2.0; z=y%x/a; 则执行后,z中的值是( )
A.4
B.3
C.0
D.0.5
第6题:
若有说明:char w; int x; float y; double z; 则表达式w*x+y-z的值的数据类型是()。
第7题:
有函数int max(int x,int y){float z=2.5; return(z);则返回值是()
第8题:
给定java代码如下所示,在A处新增下列()方法,是对cal方法的重载。public class Test { public void cal(int x, int y, int z) { } //A }
第9题:
)int x,y;char z;Max(x,y,z);
)double x,y,z;Max(x,y,z);
)int x,y;float z;Max(x,y,z);
)float x;double y,z;Max(x,y,z);
第10题:
2
2.5
3
要看实参
第11题:
double
char
int
float
第12题:
void setVar (int a, int b, float c){ x = a; y = b; z = c; }
public void setVar(int a, float c, int b) { setVar(a, b, c); }
public void setVar(int a, float c, int b) { this(a, b, c); }
public void setVar(int a, float b){ x = a; z = b; }
public void setVar(int ax, int by, float cz) { x = ax; y = by; z = cz; }
第13题:
若输入1.5、2.5,则以下程序的运行结果为______。main(){ float a,b; int c; scanf("%f,%f,",&a,&b); c=max(a,b); printf("%d",c);}max(x,y)float x,y;{ float z; z=x>y?x:y; return(z);}
A.1.5
B.2.5
C.2
D.3
第14题:
执行下面程序段后,2值为( )。 int x=1,y=2,z=3; z=z/(float)(x/y);
A.编译无法通过
B.6
C.3
D.2
第15题:
下列函数定义中,会出现编译错误的是
A.max(int x,int y,int*z) {*z=x>y?xy;}
B.int max(int x,y) {int z; z=x>y?xy; return z; }
C.max(int x,int y) {int z; z=x>y?xy;return(z); }
D.int max(int x,int y) { return(x>y?xy);}
第16题:
下列函数定义不正确的是 ( )
A.int max { int x y,z; z=x>y? x: y }
B.int max(x,y) int x,y; { int z; z=x>y? x:y; return(z) }
C.int max(x,y) { int x,y z; z=x>y? x: y; return(z); }
D.int max( ) {}
第17题:
假设有函数模板定义如下,下列各选项中正确的是( )。 Template <class T> T Max(T a,T b,T c) { if(a<b) {if(b<c) return c; else return b;} else {if(a<c) return c; else return a;} }
A.float x,y,z;float max;max=Max(x,y,z);
B.float x;int y,z;float max;max=Max(x,y,z);
C.float x;double y,z;float max;max=Max(x,y,z);
D.三个选项都正确
第18题:
有函数illI m(float x){floal 2;z=。;rehJrn(z);l用n=m(3 5);调用.则返回值是()
第19题:
设有说明:char w;int x;float y;double z;则表达式w*x+z-y 值的数据类型为().
第20题:
public class MethodOver { private int x, y; private float z; public void setVar(int a, int b, float c){ x = a; y = b; z = c; } } Which two overload the setVar method?()
第21题:
3
3.5
4
实型值
第22题:
public int cal(int x,int y,float z){return 0;}
public int cal(int x,int y,int z){return 0;}
public void cal(int x,int z){}
public viod cal(int z,int y,int x){}
第23题:
整型值
X
Z
实型值