东北大学14秋学期《JAVA语言程序设计Ⅰ》在线作业1

所属学校:东北大学 科目:JAVA语言程序设计Ⅰ 2015-03-17 16:41:54
14秋学期《JAVA语言程序设计Ⅰ》在线作业1
试卷总分:100 奥鹏学习网(aopeng123.cn) 发布
单选题
多选题
一、单选题(共 20 道试题,共 60 分。)
V
1. 下列语句序列执行后,k的值是( )。 int j=8, k=15; for( int i=2; i!=j; i++ ) { j-=2; k++; }
A. 15
B. 16
C. 17
D. 18
需要购买答案的联系QQ:79691519满分:3 分
2. 下列语句序列执行后,j 的值是( )。 Int j=3, i=2; while( --i!=i/j ) j=j+2;
A. 2
B. 4
C. 5
D. 6
需要购买答案的联系QQ:79691519满分:3 分
3. 阅读下列代码后 public class Person{ int arr[]=new int[10]; public static void main(String args[]){ System.out.println(arr[1]); } } 正确的说法是
A. 编译时将产生错误
B. 编译时正确,运行时将产生错误
C. 输出零
D. 输出空
需要购买答案的联系QQ:79691519满分:3 分
4. 下面哪一个类可以访问foo包中的所有变量? package foo; class a{int c} class b{private int d} class c{public int e}
A. class a
B. class b
C. class c
D. 都不能
需要购买答案的联系QQ:79691519满分:3 分
5. 65. 已知有下列类的说明,则下列哪个语句是正确的? public class Test { private float f = 1.0f; int m = 12; static int n=1; public static void main(String arg[]) { Test t = new Test(); } }
A. t.f;
B. this.n;
C. Test.m;
D. Test.f;
需要购买答案的联系QQ:79691519满分:3 分
6. 为了获得参数lastname,在applet中可以写如下代码:
A. String s=getName(“lastname”);
B. String s=parameter(“lastname”);
C. String s=getParameter(“lastname”);
D.
需要购买答案的联系QQ:79691519满分:3 分
7. 下列代码中,将引起一个编译错误的行是 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. 第3行
B. 第5行
C. 第6行
D. 第10行
此题选: D 满分:3 分
8. 选择正确的叙述. class Happy extends Frame { Happy() { SetLayout(new GridLayout(2,2)); Panel p1 = new Panel(); add(p1); p1.add( new Button("One")); Panel p2 = new Panel(); add(p2); p2.add( new Button("Two")); add( new Button("Three")); add( new Button("Four")); s
A. 当frame调整大小时,按钮Three和Four 的大小也将调整。
B. 当frame调整大小时,所有按钮的大小都将调整。
C. 当frame调整大小时,按钮Two和Four 的大小也将调整。
D. 当frame调整大小时,按钮One和Two 的大小也将调整。
需要购买答案的联系QQ:79691519满分:3 分
9. 给出下面的接口: interface A{ int method1(int i); int method2(int j); } 下面那个类实现了这个接口,并且不是抽象的?
A. class B implements A{ int method1(){} int method2(){} }
B. class B { int method1(int i){} int method2(int j){} }
C. class B implements A{ int method1(int i){} int method2(int j){} }
D. class B extends A{ int method1(int i){} int method2(int j){} }
需要购买答案的联系QQ:79691519满分:3 分
10. 如果你试图编译下面的代码会发生什么事? Class MyString extends String{ }
A. 代码编译成功
B. 代码不能编译,因为没有定义一个main()方法
C. 代码不能编译,因为String是abstract类型的
D. 代码不能编译,因为String是final类型的
此题选: D 满分:3 分
11. 下面程序的输出结果是什么? class Happy { public static void main(String args[]) { int i =1; int j = 10; do { if ( i++ j--) continue; } while ( i 5 ); System.out.println ( i+" "+j ); } }
A. 5 5
B. 5 4
C. 6 4
D. 5 6
此题选: D 满分:3 分
12. 已知如下代码: boolean m = true; if ( m = false ) System.out.println("False"); else System.out.println("True"); 执行结果是什么?
A. False
B. True
C. 编译时出错
D. 运行时出错
需要购买答案的联系QQ:79691519满分:3 分
13. 下面程序的输出结果是什么? String s= "ABCD"; s.concat("E"); s.replace(C,F); System.out.println(s);
A. 编译错误,字符串是不可改变的
B. ABFDE
C. ABCDE
D. ABCD
此题选: D 满分:3 分
14. 给出下列代码,则数组初始化中哪项是不正确的? byte[] array1,array2[]; byte array3[][]; byte [][] array4;
A. array2 = array1
B. array2=array3
C. array2=array4
D. array3=array4
需要购买答案的联系QQ:79691519满分:3 分
15. 给定下面的类:  public class Example{   String str=new String(“good”);   char ch[]={a,b,c};   public static void main(String args[]){   Example ex=new Example();   ex.change(ex.str,ex.ch);   System.out.println(ex.str+”and”+ex.ch);   }   public void
A. good and abc
B. good and gbc
C. test ok and abc
D. test ok and gbc
需要购买答案的联系QQ:79691519满分:3 分
16. 下面的语句的作用是:( )。 Vector MyVector = new Vector(100,50);
A. 创建一个数组类对象MyVector,有100个元素的空间,每个元素的初值为50。
B. 创建一个向量类对象MyVector,有100个元素的空间,每个元素的初值为50。
C. 创建一个数组类对象MyVector,有100个元素的空间,若空间使用完时,以50个元素空间单位递增。
D. 创建一个向量类对象MyVector,有100个元素的空间,若空间使用完时,以50个元素空间单位递增。
此题选: D 满分:3 分
17. 下列语句序列执行后,k 的值是( )。 int x=6, y=10, k=5; switch( x%y ) { case 0: k=x*y; case 6: k=x/y; case 12: k=x-y; default: k=x*y-x; }
A. 60
B. 54
C. 0
D. 5
需要购买答案的联系QQ:79691519满分:3 分
18. 已知如下的命令执行 java MyTest a b c 请问哪个语句是正确的?
A. args[0] = "MyTest a b c"
B. args[0] = "MyTest"
C. args[0] = "a"
D. args[1]= b
需要购买答案的联系QQ:79691519满分:3 分
19. 设有下面的一个类定义: class AA { static void Show( ){ System.out.println("我喜欢Java!"); } } class BB { void Show( ){ System.out.println("我喜欢C++!"); } } 若已经使用AA类创建对象a和BB类创建对象b,则下面哪一个方法调用是正确的:( )
A. a.Show( ) b.Show( )
B. AA.Show( ) BB.Show( )
C. AA.Show( ) b.Show( )
D. a.Show( ) BB.Show( )
需要购买答案的联系QQ:79691519满分:3 分
20. 设有下面两个类的定义: class Person { long id; // 身份证号 String name; // 姓名 } class Student extends Person { int score; // 入学总分 int getScore(){ re
A. 包含关系
B. 继承关系
C. 关联关系
D. 无关系,上述类定义有语法错误
需要购买答案的联系QQ:79691519满分:3 分
14秋学期《JAVA语言程序设计Ⅰ》在线作业1
试卷总分:100 奥鹏学习网(aopeng123.cn) 发布
单选题
多选题
二、多选题(共 10 道试题,共 40 分。)
V
1. 你怎样从下面main()的调用中访问单词“kiss”? java lyrics a kiss is but a kiss
A. args[0]
B. args[1]
C. args[2]
D. args[3]
E. args[4]
F. args[5]
需要购买答案的联系QQ:79691519满分:4 分
2. 已知如下类说明: public class Test { private float f = 1.0f; int m = 12; static int n=1; public static void main(String arg[]) { Test t = new Test(); // 程序代码… } } 如下哪个使用是正确的?
A. t.f
B. this.n
C. Test.m
D. Test.n
需要购买答案的联系QQ:79691519满分:4 分
3. 在如下源代码文件Test.java中, 哪个是正确的类定义?
A. public class test { public int x = 0; public test(int x) { this.x = x; } }
B. public class Test{ public int x=0; public Test(int x) { this.x = x; } }
C. public class Test extends T1, T2 { public int x = 0; public Test (int x) { this.x = x; } }
D. public class
需要购买答案的联系QQ:79691519满分:4 分
4. 已知如下定义: String s = "story"; 下面哪些表达式是合法的?
A. s += "books";
B. char c = s[1];
C. int len = s.length;
D. String t = s.toLowerCase();
需要购买答案的联系QQ:79691519满分:4 分
5. 如果有以下代码,哪几个数字能产生输出 "Test2" 的结果? Switch(x){ case 1: System.out.println("Test1"); case 2: case 3: System.out.println("Test2"); break;} System.out.println("Test3"); }
A. 0
B. 1
C. 2
D. 3
需要购买答案的联系QQ:79691519满分:4 分
6. 给出下面的代码段: public class Base{ int w, x, y ,z; public Base(int a,int b) { x=a; y=b; } public Base(int a, int b, int c, int d) { //赋值 x=a, y=b w=d; z=c; } } 在代码说明//赋值 x=a, y=b处写入如下哪几行代码是正确的?
A. Base(a,b)
B. x=a,y=b;
C. x=a;y=b;
D. this(a,b);
需要购买答案的联系QQ:79691519满分:4 分
7. 假定文件名是“Fred.java”,下面哪个是正确的类声明。
A. public class Fred{   public int x = 0;   public Fred (int x){   this.x=x;   }   }
B. public class fred{   public int x = 0;   public Fred (int x){   this.x=x;   }   }
C. public class Fred extends MyBaseClass{   public int x = 0; }
需要购买答案的联系QQ:79691519满分:4 分
8. 针对下面的程序,那些表达式的值是true?  Class Aclass{   private long val;   public Aclass(long v){val=v;}   public static void main(String args[]){   Aclass x=new Aclass(10L);   Aclass y=new Aclass(10L);   Aclass z=y;   long a=10L;   int b=10;   }   }
A. a==b;
B. a==x;
C. y==z;
D. x==y;
E. a==10.0;
需要购买答案的联系QQ:79691519满分:4 分
9. 下面代码执行后的输出是什么? outer: for(int i=0;i 3; i++) inner: for(int j=0;j 2;j++) { if(j==1) continue outer; System.out.println(j+ “ and “+i); }
A. 0 and 0
B. 0 and 1
C. 0 and 2
D. 1 and 0
E. 1 and 1
F. 1 and 2
G. 2 and 0
H. 2 and 1
I. 2 and 2
需要购买答案的联系QQ:79691519满分:4 分
10. 已知如下代码: public class Test { public static void main(String arg[]) { int i = 5; do { System.out.println(i); } while (--i 5) System.out.println("finished"); } } 执行后的输出结果包括什么?
A. 5
B. 4
C. 6
D. finished
E. 什么都不输出
需要购买答案的联系QQ:79691519满分:4 分
版权声明

声明:有的资源均来自网络转载,版权归原作者所有,如有侵犯到您的权益 请联系本站我们将配合处理!

分享: