首页 > 计算机应用技术
题目内容 (请给出正确答案)
[单选题]

int x=3;if(1<=2)if(0)x=4;else x=5;else x=6;执行上述语句后x的值是()。

A.3

B.4

C.5

D.6

查看答案
答案
收藏
如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“int x=3;if(1<=2)if(0)x=4;else …”相关的问题
第1题
若有如下语句:int x=3; do { printf(" %d\n",x-=2);} while(!(--x));则上面程序段()。

A.输出的是3和0

B.输出的是1和-2

C.输出的是1

D.是死循环

点击查看答案
第2题
执行以下程序段后,y的值是()。 int a[ ]={1,3,5,7,9}; int x=0,y=1, *ptr; ptr=&a[1]; while(!x) { y+=*(ptr+x); x++; }

A.1

B.2

C.4

D.24

点击查看答案
第3题
若a和b均为int型变量,则执行以下程序断后x的输出是()。 x=15;y=15;printf("%d\n",x%=(y%=2));

A.6

B.12

C.1

D.0

点击查看答案
第4题
已知程序段:int a[3][4],*p[3]={a[0], a[1], a[2]},**pp=p,i;for (i=0; i12; i++)a[i/4][i%4]=i;则pp[1][2]的值是()。

A.3

B.4

C.5

D.6

点击查看答案
第5题
class A {public int getNumber(int a){return a+1;}} class B extends A {public int get
Number(int a, char c){return a+2;} public static void main(String[] args) {B b=new B();System.out.println(b.getNumber(0));} } what is the result?

A.compilation succeeds and 3 is printed

B.compilation succeeds and 2 is printed

C.compilation succeeds and 1 is printed

D.An error at this program cause compilation to fail

点击查看答案
第6题
已知随机变量X的密度为当0

A.1

B.1/2

C.1/3

D.2

点击查看答案
第7题
下列代码中,将引起一个编译错误的行是() 1)public class Test 2)int m,n; 3)public Test()
下列代码中,将引起一个编译错误的行是()

1)public class Test

2)int m,n;

3)public Test()

4)public Test(int a)m=a;

5)public static void main(String args[])

6)Test t1,t2;

7)int j,k;

8)j=0; k=0;

9) t1=new Test();

10)t2=new Test(j,k);

11)

12)

A.第6行

B.第5行

C.第3行

D.第10行

点击查看答案
第8题
publiclass X implements Runnable {publistativoimain(String[] args){3) //在这插入代码} publivoirun() {int x=0, y=0; for (;;) {x++; Y++; System.out.println(“x=”+x+“, y=”+y);}}} 下面哪些代码加在第3行可以使run()运行?()
A.X x=new X(); x.run()

B.X x=new X(); new Thread(x).run()

C.X x=new X(); new Thread(x).start()

D.Threat=new Thread(x).run()

点击查看答案
第9题
下列程序的输出结果是()。 #include void fun(); void main() { int x=1; if(x= =1) { int x=2; printf(“%d”,++x); } void fun() { printf(“%d”,x++);}

A.2,1,1

B.1,2,1

C.2,2,2

D.2,2,1

点击查看答案
第10题
下面程序的输出结果为()。 main() { int a=1,b=0; switch(a) { case 1: switch (b) { case 0: printf("**0**"); break; case 1: printf("**1**"); break; } case 2: printf("**2**"); break; }}

A.有语法错误

B.**0****2**

C.**0****1****2**

D.**0**

点击查看答案
第11题
下列程序的输出结果是()。 #include void fun(); void main() { int x=1; if(x= =1) { int x=2; printf(“%d”,++x); } void fun() { printf(“%d”,x++);}

A.2,2,2

B.2,2,1"

C.2,1,1

D.1,2,1

点击查看答案
退出 登录/注册
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改