欢迎光临
我们一直在努力

北语20春《Java语言程序设计》作业1【标准答案】

可做奥鹏国开全部院校作业论文!答案请添加qq:599792888 或 微信:1095258436

20春《Java语言程序设计》作业1

试卷总分:100  得分:100

一、单选题 (共 10 道试题,共 100 分)

1.下面程序段的输出结果是_______。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”);

A.编译错误

B.x>y

C.x=y

D.x<y

 

2.下列程序段不正确的是_______。

A.String A=”firstJava”;A-=”Java”;

B.String A=”firstJava”;A+=”Java”;

C.Integer J=new Integer(27);J-=7;

D.Integer J=new Integer(27);J–;

 

3.下面程序段的输出结果为_______。public class NewClass { public static void main(String args[]){ int x,y; x=(int)82.5; y=(int)’A’; System.out.print(“x=”+x); System.out.print(“\ty=”+y); } }

A.82 A

B.82 65

C.82.5 A

D.82.5 65

 

4.下列选项中不属于Java核心包的一项是_______。

A.javax.sound

B.javax.rmi

C.javax.naming

D.java.math

 

5.执行下列程序段,请选出正确的答案。public class Test{ public static void throwit(){ throw new RuntimeException(); } public static void main(String args[]){ try{ System.out.println(“你好吗”); throwit(); System.out.pri

A.输出“你好吗”→输出“结束”→RuntimeException异常发生

B.输出“你好吗”→RuntimeException异常发生→输出“结束”

C.输出“你好吗”→RuntimeException异常发生→输出“出错!”→输出“结束”

D.不能通过编译

 

6.下面不属于Java语句的基本数据类型的是_______。

A.浮点型

B.整型

C.数组型

D.字符型

 

7.下面程序段的输出结果为public class Test { public static void main(String args[]){ int a[]={1,2,3},b[]=new int [3]; System.arraycopy(a, 0, b, 0, 3); System.out.println(“a[0]=”+a[0]+” b[0]=”+b[0]); a[0]=10; System.out.println(“a

A.a[0]=1 b[0]=1 a[0]=10 b[0]=1

B.a[0]=1 b[0]=10 a[0]=1 b[0]=10

C.a[0]=10 b[0]=1 a[0]=10 b[0]=1

D.a[0]=10 b[0]=10 a[0]=1 b[0]=1

 

8.下面程序段的输出结果为_______。class OverMethod{ void printMeth(){ System.out.println(“There is none parameter.”); } void printMeth(String t){ System.out.println(“There is one parameter.”); } void printMe

A.There is one parameter.There is none parameter.There are two parameters.

B.There is none parameter.There is one parameter.There are two parameters.

C.There is none parameter.It’s good!There are tw

D.It’s good!There is none parameter.There are two parameters.

 

9.如果在编译Java程序时,编译结果报告说找不到编译的代码,下列哪一项不是常见的错误?

A.源文件不在当前目录下

B.没有import相应的包

C.未加.java后缀

D.文件名拼写错误

 

10.下面程序段的输出结果为_______。public class Test { public static void main(String args[]){ char c1,c2,c3; c1=’H’; c2=’\\’; c3=’\115′; System.out.print(c1); System.out.print(c2); System.out.print(c3);

A.无输出

B.H\\\115

C.H\M

D.H115

赞(0)
未经允许不得转载:奥鹏作业网 » 北语20春《Java语言程序设计》作业1【标准答案】

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址