声明一个委托类型public delegate int myCallBack(int x); 则以下语句可以和委托myCallBack绑定的方法是()
第1题:
若有以下程序: #include<iostream> usingnamespacestd; classA { private: int x; public: int x; void setx(int i) { x=i; } int getx() { return x; } }; class B:public A { private: int m; public: int p; void setvalue (int a,int b,int C) { setx(A) ; z=b; m=c; } void display() { cout<<getx()<<","<<z<<","<<m<<end1; } }; int main() { B obj; obj.setvalue(2,3,4); obj.display(); return 0; } 程序运行以后的输出结果是
A.产生语法错误
B.2,3,4
C.2,2,2
D.4,3,2
第2题:
以下程序的执行结果是______。
include<iostream.h>
class A
{
int a:
public:
void seta(int x) {a=x;}
void showa() {cout<<a<<end1;}
};
class B
{
int b;
public:
void setb(int x) {b=x;}
void showb(){cout<<b<<end1;}
};
第3题:
有如下类定义: class Test { private int x; public int y; public void setX (int m) {x=m;} public int getX( ) {return x;} }现用Test t=new Text();生成一个对象t,则如下语句中,错误的是( )。
A.t.x=10;
B.t.y=10;
C.t. setX(10);
D.int m=t.getX( );
第4题:
下面程序段中的错误语句是 ______。 class M{ int i; public: void ~AA(int); AA *p; void AA(); void AA(int x){i=x;}; };
A.AA *p;
B.void ~AA(int);
C.void AA(int);
D.void AA(int x){i=x;};
第5题:
若有以下程序: #include<iostream> using namespace std; class A { private: int a; public: void seta(int x) { a=x; } void showa() { cout<<a<<","; } }; class B { private: int b; public: void setb(int x) { b=x; } void showb() { cout<<b<<",”; } }; class C:pUblic A,private B { private: int c; public: void setc(int x,int y,int z) { c=z; seta(x); setb(y); } void showc() { showa(); showb(); cout<<c<<end1; } }; int main() { Cc; c.setc(1,2,3); c.showc(); retrun 0; } 程序执行后的输出结果是
A.1,2,3
B.1,1,1
C.2,2,2
D.3,3,3
第6题:
A.publicgetSort(float x)
B.doublegetSort(intx,int y)
C.int getSort(int y)
D.voidget(intx,int y)
第7题:
下面是类MyChss的定义,对定义中语句描述正确的是( )。class MyClass{public:void MyClass(int a){X=a;) //①int f(int a, int b) //②{X=a;Y=b;}int f(int a,int b,int c=0) //③{X=a;Y=b;Z=c;stahc void g (){X=10;) //④private:int X,Y,Z;};
A.语句①是类MyClass的构造函数定义
B.语句②和语句③实现类成员函数的重载
C.语句④实现对类成员变量X的更新操作
D.语句①②③和④都不正确
第8题:
给定java代码如下所示,在A处新增下列()方法,是对cal方法的重载。public class Test { public void cal(int x, int y, int z) { } //A }
第9题:
public class Parent{ public void change(int x){} } public class Child extends Parent{ //覆盖父类change方法 } 下列哪个声明是正确的覆盖了父类的change方法?()
第10题:
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?()
第11题:
protected void change (int x){}
public void change(int x, int y){}
public void change (int x){}
public void change (String s){}
第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题:
有一个类A,以下为其构造函数的声明,其中正确的是( )。
A.void A (int x){...}
B.A (int x){...}
C.a(int x){...}
D.void a (int x){…}
第14题:
若有以下函数首部: int fun(double x[10],int *n) 则下面针对此函数的函数声明语句中正确的是( )。
A.int fun(double x, int *n);
B.int fun(double, int);
C.int fun(double *x, int n);
D.int fun(double*, int*);
第15题:
若有以下函数首部 int fun(double x[lO],int *n) 则下面针对此函数的函数声明语句中正确的是______。
A.int fun(double x, int *n);
B.int fun(double, int);
C.int fun(double *x, int n);
D.iht fun(double*,int*);
第16题:
有一个类A,下列为其构造方法的声明,其中正确的是
A.void A(int x){…}
B.A(int x){…}
C.a(int x){…}
D.void a(int x){…}
第17题:
以下程序执行后的输出结果是 #include <iostream> using namespace std; void try(int,int,int,int); int main () { int x,y,z,r; x =1 ; y = 2; try(x,y,z,r); cout<<r<<endl; return 0; } void try(int x,int y,int z,int r) { z = x+y; x = x*x; y = y*y; r = z+x+y; }
A.18
B.9
C.10
D.不确定
第18题:
若有以下程序:#include<iostream>using namespace std;class A {private: int x;public: int z; void setx(int i) { x=i; } int getx () { return x; }}:class B : public A{private: int m;public: int p; void setvalue(int a, int b, int c) { setx(a) ; z=b; m=c; } void display{) { cout<<getx ()<<", "<<z<<", "<<m<<end1; }};int main(){ B obj; obj. setvalue(2,3,4); obj.display(); return 0;} 程序运行以后的输出结果是
A.产生语法错误
B.2,3,4
C.2,2,2
D.4,3,2
第19题:
以下程序执行后的输出结果是 #include<iostream>. using namespace std; void try(int,int,int,int); int main() { int x,y,z,r; x=1; y=2; try(x,y,z,r); cout<<r<<end1; return 0; } void try(int x,int y, int z,int r) { z = x+y; x = x*x; y = y*y; r = z+x+y; }
A.18
B.9
C.10
D.不确定
第20题:
有一个类Demo,对与其构造方法的正确声明是()
第21题:
public class ConstOver { public ConstOver (int x, int y, int z) { } } Which two overload the ConstOver constructor?()
第22题:
void myCallBack(int x)
int receive(int num)
string receive(int x)
不确定的
第23题:
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){}