题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2024-07-08 21:14:22

[单项选择]执行以下的循环后输出的值为( )。
public class Sun

public static void main (String args[ ])

int m=1000, s=0, n=0;
do
n=n+l;
s=s+(int)Math.pow(2,n);
while (s<=m);
System.out.println("n="+n+","+"s="+s);


A. n=9, s=1000
B. n=8, s=1022
C. n=9, s=1022
D. n=8, s=1000

更多"执行以下的循环后输出的值为( )。 public class "的相关试题:

[单项选择]执行以下的循环后输出的值为( )。
public class Sun

public static void main(String args[ ])

int m=1000,s=0,n=0;
do
n=n+1;
s=s+(int)Math.pow(2,n);
while(s<=m);
System.out.println("n="+n+","+"s="+s);


A. n=9,s=1000
B. n=8,s=1022
C. n=9,s=1022
D. n=8,s=1000
[单项选择]执行以下的循环后输出的值为( )。 public class Sun { public static void main (String args[ ]) { int m=1000, s=0, n=0; do{ n=n+l; s=s+(int)Math.pow(2,n); }while (s<=m); System.out.println("n="+n+","+"s="+s); } }
A. n=9, s=1000
B. n=8, s=1022
C. n=9, s=1022
D. n=8, s=1000
[单项选择]设x和y均为int型变量,则执行下面的循环后,y值为( )。 public class Sun { public static void main(String args[ ]) { int x, y; for (y=1, x=1; y<=50; y++) { if(x>=10) break; if (x%2==1) { x+=5; continue; } x-=3; } System. out.println (y); } }
A. 2
B. 4
C. 6
D. 8
[单项选择]有以下程序
public class Sun

public static void main(string args[ ])

int a, b;
for(a=1, b=1; a<=100; a++)

if(b>=10
break;
if (b%3 1)

b+=3;
continue;


System.cut.println(
A. ;
B. 6
C. 5
D. 4
[单项选择]下面程序的输出结果是( )。
public class Sun

public static void main(String args[])

int[]a=1,2,3,4;
int j=1,s=0;
for(int i=3;i>=0;i--)

s=s+a[i]*j;
j=j*10;

System.out.println(s);


A. 1234
B. 21
C. 43
D. 4321
[单项选择]下面程序的输出结果是( )。
public class Sun

public static void main(String args[ ])

int i = 1;
switch (i)

case 0:
System.out.println("zero");
break;
case 1:
System.out.println("one");
case 2;
System.out.println("two");
default:
System.out.println("default");



A. one
B. one,default
C. one,two,default
D. default
[单项选择]有以下程序 public class Sun { public static void main(string args[ ]) { int a, b; for(a=1, b=1; a<=100; a++) { if(b>=10} break; if (b%3 1) { b+=3; continue; } } System.cut.println(A) ; } } 执行后的输出结果是( )。
A. 101
B. 6
C. 5
D. 4

我来回答:

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

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码