题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-10-20 04:54:46

[单项选择]下面程序的正确输出是( )。 public class Hello { public static void main(String args[]) { int count, xPos = 25; for ( count = 1; count <= 10; count++ ) { if ( count == 5 ) break; System.out.println(count ); xPos += 10; } } }
A. 1 2 3 4
B. 1 3 4
C. 编译错误
D. 以上都不是

更多"下面程序的正确输出是( )。 public class Hello"的相关试题:

[单项选择]下面程序的正确输出是( )。
public class Hello

public static void main(string args[])

int count,xPos=25:
for(count=1;count<=10;count++)

if(count==5)
Break:
system.out.println(count);
xPos+=10:



A. 1 2 3 4
B. 1 3 4
C. 编译错误
D. 以上都不正确
[单项选择]下面程序的输出结果是______。 public class ex5 { public static void main(String[] args) { for(int cnt=l;cnt<=10;cnt++) { if(cnt<=5) continue; System.out.print (cnt+" "); } } }
A. 6 7 8 9
B. 1 2 3 4
C. 1 2 3 4 6 7 8 9 10
D. 6 7 8 9 10
[单项选择]下面程序段的输出结果是( )。
public class Test
public static void main(String args[])
int a, b;
for(a=1, b=1; a<=100; a++)
if(b>=10) break;
if (b%2==1)
b+=-2;
continue;


System.out.println(a);


A. 5
B. 6
C. 7
D. 101
[单项选择]阅读下面程序
public class ForLoopStatement
 public static void main(String[] args)
   int i,j;
   for(i=1;i<5;i++)                       //i循环
     for(j=1;j<=i;j++)System.out.print(i+"*"+j+"="+i*j+" "); //j循环
System.out.println( );



程序完成后,i循环和J循环执行的次数分别是
A. 4,10
B. 8,9
C. 9,8
D. 10,10
[单项选择]请阅读下面程序
public class ForLoopStatement
public static void main (String[] args)
int i;j;
for(i=1;i<5;j++)//i循环
for(j=1;j<=i;j++)//j循环
System.out.print(i+"*"+j+"="+i*j+" ");
System.out.printIn( );



程序完成后,i循环和j循环执行的次数分别是______。
A. 4,10
B. 8,9
C. 9,8
D. 10, 10
[填空题]阅读下面程序
public class OperatorsAndExpressions
 String conditionalExpression(int score)
  String result;
   //如果score超过60分,则结果是passed,否则是doesn’t pass
   result=(score>=60)"passed":"doesn’t pass":
   System.out.println(result);
   return result;
 
 public static void main(String args[])
  OperatorsAndExpressions OperAndExp=new OperatorsAndExpressions( );
  //条件表达式
  OperAndExp.conditionalExpression(65);
 

程序的执行结果是______。
[单项选择]下面程序输出的结果是什么 ( )
public class Quiz2

public static void main(String args[])

try throw new MyException( );
catch(Exception e)

System.out.println("It’s caught!");
finally
System.out.println("It’s finally caught!");



class MyExeeption extends Exception
A. It’s finally caught!
B. It’s caught!
C. It’s caught!/It’sfinally caught!
D. 无输出
[填空题]将下面程序补充完整。 public class PowerCale {  public static void main(String[] args) {   double x=5.0;   System.out.println(x+"to the power 4 is"+power(x,4));   System.out.println("7.5 to the power 5 is"+power(7.5,5));   System.out.println("7.5 to the power 0 is"+power(7.5,0));   System.out.println("10 to the power -2 is"+power(10,-2));  }  static double ______ (double x,int n) {   if(n>1)return x * power(x,n-1);   else if(n<0)return 1.0/power(x,-n);   else return n==0 1.0:x:   } }
[填空题]执行下面的程序段,输出结果为______。
public class Q

public static void main(String argv[])

int anar[]=new int[5];
System.out.println(anar[0]);

[单项选择]下面程序的输出结果是
public class Test
 public static void main(String[] args)
  int[]array=2,4,6,8,10;
  int size=6;
  int result=-1:
  try
   for(int i=0;i<size&&result==-1;i++)
    if(array[i]==20)result=i;
catch(ArithmeticException e)
   System.out.println("Catch---1");
  catch(ArrayIndexOutOfBoundsException e)
   System.out.println("Catch---2");
  catch(Exception e)
   System.out.println("Catch---3");
  
 

A. Catch---1
B. Catch一--2
C. Catch---3
D. 以下都不对

我来回答:

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

订单号:

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