网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
若有类Z说明class Z{staticint a;public:static void fStatic(Z&);};int Z::a=0;Z objZ;,则函数fStatic中访问数据a错误的是()。
- A、void Z::fStatic(){obj Z.a=1;}
- B、void Z::fStatic(){a=1;}
- C、void Z::fStatic(){this->a=0;}
- D、void Z::fStatic(){Z::a=0;}
参考答案
更多 “若有类Z说明class Z{staticint a;public:static void fStatic(Z);};int Z::a=0;Z objZ;,则函数fStatic中访问数据a错误的是()。A、void Z::fStatic(){obj Z.a=1;}B、void Z::fStatic(){a=1;}C、void Z::fStatic(){this-a=0;}D、void Z::fStatic(){Z::a=0;}” 相关考题
考题
以下程序的运行结果为( )。 public class Sun { public static void main(String args[]) { String x="A",y="B",z="C"; for(int m=1;m<=2;m++) { x=y; y=z; z=x; } System.out.println(x+y+z); } }A.ABCB.BCAC.BCBD.CBC
考题
以下程序执行后的输出结果是( )。include usingnamespacestd;void try(int,int,int,in
以下程序执行后的输出结果是( )。 #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.18B.9C.10D.不确定
考题
下面程序的结果【】。 include int f(int); void main() { int x=1,i; for (i=0; i
下面程序的结果【 】。include<iostream.h>int f(int);void main() {int x=1, i;for (i=0; i<3; i++)cout<<f(x)<<‘ ’ ;cout<<end1;}int f(int x){int y=1;static int z=3y++;z++;return (x+y+z);}
考题
若有以下程序:includeusingnamespacestd;classA{private:int x; public:int x;void s
若有以下程序: #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,4C.2,2,2D.4,3,2
考题
执行下列代码段之后,变量z的值为______。 Public class Test8 { public static void main(String[] args) { int x=2; int y=3; int z=4; z-....= y-x--; System.out.println(z); }A.1B.2C.3D.4
考题
若有以下程序:include using namespace std;class A{private:int x;public:int z;voi
若有以下程序:#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,4C.2,2,2D.4,3,2
考题
以下程序输出结果是 ______。includevoid fun(int x,int y,int z){z=x+y;}void main
以下程序输出结果是 ______。 #include<iostream.h> void fun(int x,int y,int z){z=x+y;} void main() { int a=10; fun (2,2,a); cout<<a; }A.0B.4C.10D.无定值
考题
若有以下程序:include using namespace std;class A{private: int x;protected: int
若有以下程序: #include <iostream> using namespace std; class A { private: int x; protected: int y; public: int z; void setx(int i) { x=i; } int getx () { return x; }; class B : protected A { public: void setvalue(int a, int b, int c) { setx (a); y=b; z=c; } void display() { cout<<getx ( ) <<", "<<y<<", "<<z<<", "<<end1; } }; int main () { B obj; obj.setvalue(5, 6, 7); obj.display ( ); return 0; } 程序运行后的输出结果是( )。A.产生语法错误B.7,6,5C.5,6,7D.7,5,6
考题
若有以下程序: #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,4C.2,2,2D.4,3,2
考题
以下程序执行后的输出结果是includeusing namcspace std;void try(int,int,int,int);
以下程序执行后的输出结果是 #include<iostream> using namcspace 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.18B.9C.10D.不确定
考题
若有以下程序:includeusing namespace std;class A{private:int x;public:int z;void
若有以下程序:#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,4C.2,2,2D.4,3,2
考题
以下程序的输出结果为:public class test {public static void main(String args[]) {int x=1,y=1,z=1;if (x--==1}}
A. x=0,y=2,z=1B. x=1,y=2,z=1C. x=0,y=1,z=1D. x=0,y=2,z=2
考题
阅读以下C++代码,填充(1)~(5)的空缺,将解答填入答题纸的对应栏内。 【说明】在下面程序横线处填上适当的字句,使其输出结果为:x=5x=6y=7x=8z=9【程序】#include<iostream.h>class X1{int x;(1):X1(int xx=0){x=xx;}(2)void Output()(cout<<"x="<<x<<end;}};(3)Y1:public X1{int y;public:Y1(int xx=0,int yy=0):X1(xx){y=yy;}(2)void Output(){(4)Output();cout<<"y="<<y<<end1;}};class Z1:pubtic X1{int z:(5):Z1(int xx=0,int zz=0):X1(xx){z=zz;}②void Output(){X1::Output();cout<<"z="<<z<<end1;}};void main(){X1 a(5);Y1 b(6,7);Z1 c(8,9);X1*p[3]={For(int i=0;i<3;i++){p[i]-->Output();cout<<end1;}}
考题
给定java代码如下所示,在A处新增下列()方法,是对cal方法的重载。public class Test { public void cal(int x, int y, int z) { } //A } A、public int cal(int x,int y,float z){return 0;}B、public int cal(int x,int y,int z){return 0;}C、public void cal(int x,int z){}D、public viod cal(int z,int y,int x){}
考题
In which two cases does the compiler supply a default constructor for class A?() A、 class A{}B、 class A { public A(){} }C、 class A { public A(int x){} }D、 class Z {} class A extends Z { void A(){} }
考题
现有: class Test2 f public static void main (String [] args) { boolean X= true; boolean y=false; short Z=20; if((x==true) & (y=true)) z++; if((y==true) || (++z==22)) z++; System. out .println( "z="+z); } 结果是什么?() A、Z=21B、Z=22C、Z=23D、Z= 24
考题
现有: class Test4 { public static void main (String [] args) { boolean X=true; boolean y=false; short Z=42; if((z++==42) && (y=true))z++; if((x=false) || (++z==45)) z++; System. out.println(¨z=”+z); } } 结果为:() A、 Z=42B、 z=44C、 Z= 45D、 z= 46
考题
class Foo { public static void main(String [] args) { int x = 0; int y = 4; for(int z=0; z 〈 3; z++, x++) { if(x 〉 1 ++y 〈 10) y++; } System.out.println(y); } } 结果是什么?() A、6B、7C、8D、10
考题
现有: class Foo { public static void main (String [] args) { int x=O; int y=4; for (int z=0; z3; Z++; X++) { if(x1++y10) y++; } System. out .println (y); } } 结果是什么?() A、7B、8C、10D、12
考题
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?()A、 void setVar (int a, int b, float c){ x = a; y = b; z = c; }B、 public void setVar(int a, float c, int b) { setVar(a, b, c); }C、 public void setVar(int a, float c, int b) { this(a, b, c); }D、 public void setVar(int a, float b){ x = a; z = b; }E、 public void setVar(int ax, int by, float cz) { x = ax; y = by; z = cz; }
考题
abstract class A { abstract void al(); void a2() { } } class B extends A { void a1() { } void a2() { } } class C extends B { void c1() { } } and: A x = new B(); C y = new C(); A z = new C(); Which four are valid examples of polymorphic method calls?()A、 x.a2();B、 z.a2();C、 z.c1();D、 z.a1();E、 y.c1();F、 x.a1();
考题
public class Yikes { public static void go(Long n) {System.out.println(”Long “);} public static void go(Short n) {System.out.println(”Short “);} public static void go(int n) {System.out.println(”int “);} public static void main(String [] args) { short y= 6; long z= 7; go(y); go(z); } } What is the result?() A、 int LongB、 Short LongC、 Compilation fails.D、 An exception is thrown at runtime.
考题
class Test4 { public static void main(String [] args) { boolean x = true; boolean y = false; short z = 42; if((z++ = = 42) (y = true)) z++; if((x = false) || (++z = = 45)) z++; System.out.println("z = " + z); } } 结果为:() A、z = 42B、z = 44C、z = 45D、z = 46
考题
多选题给定java代码如下所示,在A处新增下列()方法,是对cal方法的重载。public class Test { public void cal(int x, int y, int z) { } //A }Apublic int cal(int x,int y,float z){return 0;}Bpublic int cal(int x,int y,int z){return 0;}Cpublic void cal(int x,int z){}Dpublic viod cal(int z,int y,int x){}
考题
单选题若有类Z说明class Z{staticint a;public:static void fStatic(Z);};int Z::a=0;Z objZ;,则函数fStatic中访问数据a错误的是()。A
void Z::fStatic(){obj Z.a=1;}B
void Z::fStatic(){a=1;}C
void Z::fStatic(){this-a=0;}D
void Z::fStatic(){Z::a=0;}
考题
单选题现有: class Foo { public static void main (String [] args) { int x=O; int y=4; for (int z=0; z1++y10) y++; } System. out .println (y); } } 结果是什么?()A
7B
8C
10D
12
考题
多选题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?()Avoid setVar (int a, int b, float c){ x = a; y = b; z = c; }Bpublic void setVar(int a, float c, int b) { setVar(a, b, c); }Cpublic void setVar(int a, float c, int b) { this(a, b, c); }Dpublic void setVar(int a, float b){ x = a; z = b; }Epublic void setVar(int ax, int by, float cz) { x = ax; y = by; z = cz; }
热门标签
最新试卷