题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-11-01 07:20:11

[单项选择]有如下程序: class Base1 { public: int a; void b( ) { return}; void c(float) { a=float;} }; class Base2 { public: void b( ){} void c( ){} private: int a; }; class Derived:public Basel,public Base2 { public: void b( ){} }; void main( ) { Derived obj; obj.a=1; //① obj.b( ); //② obj.c(10); //③ } 下面各项对语句①②⑧的描述中,正确的是( )。
A. 语句①②③都有二义性
B. 语句①③有二义性,②没有二义性
C. 语句①有二义性,②③没有二义性
D. 语句①②有二义性,③没有二义性

更多"有如下程序: class Base1 { public: "的相关试题:

[单项选择]有如下程序:
class Base1

public:
int a;
void b( ) return;
void c(float) a=float;
;
class Base2

public:
void b( )
void c( )
private:
int a;
;
class Derived:public Basel,public Base2

public:
void b( )
;
void main( )

Derived obj;
obj.a=1; //①
obj.b( ); //②
obj.c(10); //③

下面各项对语句①②⑧的描述中,正确的是( )。
A. 语句①②③都有二义性
B. 语句①③有二义性,②没有二义性
C. 语句①有二义性,②③没有二义性
D. 语句①②有二义性,③没有二义性
[单项选择]有如下程序; public class MethTest { static int Varl=100; int Var2=200; public static void main(String args[]) { Varl=10; MethTest Obj1=new MethTest( ); MethTest Obj2=new MethTest( ); Obj1.Varl++; System.out.println(Objl.Varl); Obj2.Varl++; System.out.println(Obj2.Varl); MethTest.Varl++; System.out.println(Objl.Varl); Obj1.Var2++; System.out.println(Obj1.Var2); Obj2.Var2++; System.out.println(Obj2.Var2); } } 程序的运行结果为( )。
A. 11 12 13 201 201
B. 101 102 103 201 201
C. 11 12 13 201 202
D. 10 10 10 201 201
[单项选择]下列程序的输出结果是
public class fff
void printValue (int m)
do System.out.println("The value is" +m);

while(--m>10)

public static void main (String arg[])
int i=10;
Test t= new Test( );
t. printValue(i);


A. 8
B. 9
C. 10
D. 11
[单项选择]有如下程序: public class MethTest { static int Var1=100; int Var2=200; public static void main(String args[]) { Var1=10; MethTest Obj1=new MethTest( ); MethTest Obj2=new MethTest( ); Obj1.Var1 ++; System.out.println(Obj1.Var1); Obj2.Var1 ++; System.out.println(Obj2.Var1); MethTest.Var1 ++; System.out.println(Obj1.Var1); Obj1.Var2 ++; System.out.println(Obj1.Var2); 0bj2.Var2 ++; System.out.println(Obj2.Var2); } } 程序的运行结果为( )。
A. 11 12 13 201 201
B. 101 102 103 201 201
C. 11 12 13 201 202
D. 10 10 10 201 201
[单项选择]有如下程序
public class Sun

public static void main(String args[ ])

int x=1,a=0,b=0;
switch(x)

case 0:b++;
case 1:a++;
case 2:
a++;
b++;

System.out.println("a="+a+","+"b="+B)
该程序的输出结果是( )。
A. a=2,b=1
B. a=1,b=1
C. a=1,b=0
D. a=0,b=0
[单项选择]有如下程序
public class Sun

public static void main (String args[ ])

int a=2, b=1, c=2;
if (a<B)
if (b<0)
if (c<0)
c=0;
else
c++;
System. out.println(C) ;


上述程序的运行结果是( )。
A. 0
B. 1
C. 2
D. 3
[单项选择]执行如下程序:
public class Test
public static void main (String args[])
int x=1,a=0,b=0;
switch (x)
case 0: b++;
case 1: a++;
case 2: a++;b++;

System.out.println("a=" +a ",b=" +b);


该程序的输出结果是( )。
A. a=2,b=1
B. a=1,b=1
C. a=1,b=0
D. a=2,b=2
[单项选择]如下程序的输出结果是( )。 public class Test { void printValue(int m) { do { System.out.println("The value is"+m); } while( --m>10) } public static void main(String args[]) { int i=10; Test t=new Test( ); t.printValue(i); } }
A. The value is 8
B. The value is 9
C. The value is 10
D. The value is 11
[单项选择]如下程序的输出结果是( )。 public class Test { void printValue(int m) { do { System.out.println("The value is"+m); } while(--m > 10 ) } public static void main(String args[]) { int i=10; Test t= new Test( ); t.printValue(i); } }
A. The value is 8
B. The value is 9
C. The value is 10
D. The value is 11
[单项选择]设有如下程序:
public class Sun

public static void main(String args[ ])

int x,y;
x=4;
y=0;
if(Math.pow(x,2)==16)
y=x;
if(Math.pow(x,2)<15)
y=1/x;
if(Math.pow(x,2)>15)
y=(int)Math.pow(x,2)+1;
System.out.println(y);


程序的运行结果是( )。
A. 4
B. 17
C. 18
D. 0.25
[填空题]若有如下程序:
public class Test
public static void main (String[] args)
int x=20;
if (x>10) System.out.print(x-=5);
if (x>5) System.out.print(x--);

则程序运行后的输出结果是 【12】
[单项选择]有如下程序:
public class Sun

public static void main(String args[ ])

int s=0;
int i=1;
while (i<=100)

s=s+i;

System.out.println(s);


运行后的结果是( )。
A. 5050
B. 5051
C. 死循环,直到溢出
D. 无穷大的数

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

截图扫码使用小程序[完全免费查看答案]
请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码