题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2024-01-13 05:37:26

[单项选择]下列程序执行后,j的值是( )。
public class Test

public static void main(String args[])

int j=1;
for(int i=7; i>0; i-=2)
j*=2;
System.out.println(j);


A. 15
B. 1
C. 32
D. 16

更多"下列程序执行后,j的值是( )。 public class Tes"的相关试题:

[单项选择]下面程序执行后,输出的结果是( )。
public class Test
public static void main (String[] )args)
boolean m=true;
if(m==false) System.out.println("假");
else
if(m====true) System.out.println("真");
else System.out.println ("错误");


A. 真
B. 假
C. 错误
D. 编译出错
[单项选择]下列程序执行后,j的值是( )。
public class Test

public static void main(String args[])

int j=1;
for(int i=7;i>0;i-=2)
j*=2;
System.out.println(j);


A. 15
B. 1
C. 32
D. 16
[单项选择]下面的程序执行后,屏幕上应显示______。
public class Test
public static void main(String[ ]args)
char char1[ ]=’t’,’e’,’s’,’t’;
char char2[ ]=’t’,’e’,’s’,’t’,’1’;
String s1=new String(char1);
String s2=new String(char2,0,4);
System.out.println(s1.equals(s2));


A. true
B. false
C. test
D. 编译错误
[填空题]请阅读下面程序
public class Test
public static void main (String[] args)
int i,j;
for (i=1;i<5;i++)
for (j=1;j<=i;j++)
system.out.print (i+"X"+j+"="+i*j+" ");
System.out.println( );



程序执行完后,i循环和j循环执行的次数分别是 【12】
[单项选择]执行如下程序:
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
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 Test4
public static void main (String args[])
int i=10, j=3;
float m=213.5f,n=4.0f
System.out.printIn (i%j);
System.out.printIn (m%n);


程序运行的结果是______。
A. 1.0和1.5
B. 1和1.5
C. 1.0和2.5
D. 1和2.5
[单项选择]阅读下面程序
public class Test1
public static void main(String[] args)
 System.out.println(34+56-6);
 System.out.println(26*2-3);
 System.out.println(3*4/2);
 System.out.println(5/2);
 

程序运行的结果是
A. 84
B. 90
C. 84
D. 68
[单项选择]下面程序的输出结果是
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. 以下都不对
[单项选择]下面程序段的输出结果是
public class Test
public static void main(Stringargs[])
int x,y;
x=(int)Math.sqrt(5)/2+(int)Math.random( )*5/2;
y=(int)Math.sqrt(3)/2+(ht)Math.random( )*3/2;
if(x>y)
System.out.println(”x>y”);
else if(x=y)
System.out.println(”x=y”);
else
System.out.Println(”x<y”);


A. x>y
B. x=y
C. x<y
D. 编译错误
[单项选择]下面程序段的输出结果为
public class Test

public static void main(String args[])

boolean a,b,c;
a=(3<5);
b=(a==true);
System.out.printin( "a="+a+"b="+b) ;
c-(b==false);
System.out.println(b="+b+"e="+c) ;


A. a=true b=false
B. a=true b=false
C. a=true b=true
D. a=false b=false
[单项选择]阅读下面程序
public class Test implements Runnable
 private int x=0;
 private int y=0;
 boolean flag=true;
 public static void main(String[]args)
  Test r=new Test( );
  Thread t1=new Thread(r);
  Thread t2=new Thread(r);
  t1.start( );
  t2.start( );
 
 public void run( )
  while(flag)
  x++;y++;
   System.out.println("("+x+","+y+")");
  if(x >=10) flag=false;
  
 

下列对程序运行结果描述的选项中,正确的是
A. 每行的(x,y)中,可能有x≠Y;每一对(x,y)值都出现两次
B. 每行的(x,y)中,可能有x≠y;每一对(x,y)值仅出现一次
C. 每行的(x,y)中,x=y;每一对(x,y)值都出现两次
D. 每行的(x,y)中,x=y;每一对(x,y)值都出现一次
[单项选择]下面程序段的输出结果为
public class Test

public static void main(String args[])

boolean a,b,c;
a=(3<5);
b=(a==true);
System.out.println("a="+a+"b="+b);
c=(b==false);
System.out.println("b="+b+"c="+c);


A. a=true b=false
B. a=true b=false
C. a=true b=true
D. a=false b=false
[单项选择]下面程序段的输出结果是
public class Test
public static void main(String args[])
int x,y;
x=(int)Math.sqrt(5)/2+(int)Math.random( )*5/2;
y=(int)Math.sqrt(3)/2+(int)Math.random( )*3/2;
if(x>y)
System.out.println("x>y");
else if(x==y)
System.out.println("x=y");
else
System.out.println("x<y");


A. x>y
B. x=y
C. x<y
D. 编译错误

我来回答:

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

订单号:

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