好文档就是一把金锄头!
欢迎来到金锄头文库![会员中心]
电子文档交易市场
安卓APP | ios版本
电子文档交易市场
安卓APP | ios版本

2016年03月-JSD1602-月考.doc

33页
  • 卖家[上传人]:宝路
  • 文档编号:20948019
  • 上传时间:2017-11-22
  • 文档格式:DOC
  • 文档大小:790.82KB
  • / 33 举报 版权申诉 马上下载
  • 文本预览
  • 下载提示
  • 常见问题
    •  1. (单选)请看下列代码: public interface A { String DEFAULT_GREETING = "Hello World"; public void method1(); }现有接口 B,是 A接口的子接口,下列选择中 B接口的声明正确的是:o A.public interface B extends A {}o B.public interface B implements A {}o C.public interface B instanceOf A {}o D.public interface B inheritsFrom A {}正确答案:A 2.(单选题)运行 JAVA源程序,需要进行编译后再运行,可用来编译 JAVA源程序的工具是:()o A.java.exeo B.javadoc.exeo C.javac.exeo D.javag.exe正确答案:CJDK 中提供了一组 Java 开发工具,其中 javac.exe 用于编译源程序, java.exe 用于解释执行字节码文件,javac.exe 用于生成 API 帮助 文档,不存在 javag.exe 工具 3.(单选)下列关于内存回收的说明正确的是:o A.程序员必须创建一个线程来释放内存o B.内存回收程序负责释放无用内存o C.内存回收程序允许程序员直接释放内存o D.内存回收程序可以在指定的时间释放内存对象正确答案:B 4. (单选)程序的执行结果是: public class Test { public static void main(String[] args){ System.out.println(""+'a'+1); }}o A.98o B.a1o C.971o D.197正确答案:B 5. (单选)A 类中有一个方法:protected int print(String str){},B类继承 A类,以下方法能在 B类中重写 A类中 print()方法的是: ()。

      o A.public int print(String str){}o B.private int print(String str){}o C.private void print(String str){}o D.public void print(String str){}正确答案:A 6. (单选)下列代码编译和运行的结果是() public class A { public void start() { System.out.println("TestA"); } } public class B extends A { public void start() { System.out.println("TestB"); } public static void main(String[] args) { ((A) new B()).start(); }}o A.输出:TestAo B.输出:TestBo C.输出:TestA TestBo D.编译错误正确答案:B 7. (单选题)定义如下两个变量: int x = 89; int y = 98;下列选项中可以将两个变量值互换的是:()。

      o A.o x = y;y = x;o B.o int temp = 0;o temp = x;o y = x;x = temp;o C.o int temp = 0;o temp = x;o x = y;y = temp;o D.o int temp = 0;o temp = y;o x = y;y = temp;正确答案:C 选项 A、B、D 都会丢失一个变量的值 选项 C 采用中间变量的方式交换两个变量的值 8. (单选)下列代码的输出结果是: public class Blip { protected int blipvert(int x) { return 0; } } class Vert extends Blip {  }在处填入选项中的代码,使 Vert类没有编译错误的是()o A.public int blipvert(int x) { return 0; }o B.private int blipvert(int x) { return 0; }o C.private void blipvert(int x) { return 0; }o D.protected long blipvert(int x) { return 0; }正确答案:A 9. (单选)请看下列代码编译和运行的结果是()。

       interface DeclareStuff { public static final int EASY = 3; void doStuff(int t); } public class TestDeclare implements DeclareStuff { public static void main(String[] args) { int x = 5; new TestDeclare().doStuff(++x); } void doStuff(int s) { s += EASY + ++s; System.out.println("s=" + s); }}o A.s=14o B.s=16o C.s=10o D.编译失败正确答案:D 10. (单选题)下列()选项添加到空白处,可以输出乘法表的语句 for(int i=1;i>1;o D.o short s1 = 10;short s=~s1;正确答案:B 选项 A 中两个 short 类型运算结果为 int 类型 选项 B 中变量自增 1,正确 选项 C 中s1>>1,1 在 java 中为 int 类型,所以运算结果也为 int 类型 选项 D 运算结果为 int 类型,赋值给 short类型,类型错误 15. (单选)运行下面的语句: String s=""; if(s==s+0){ System.out.println("Hello World"); }编译,运行的结果是:()。

      o A.Hello Worldo B.无输出o C.编译错误o D.抛出运行时异常正确答案:B 16.(单选)运行下列代码,输出为 false的是:()o A.o String st1 = "abc";System.out.println("abc" == st1);o B.o String st2 = "abc";System.out.println(st2.equals(new String("abc")));o C.o Integer i = 100;System.out.println(100 == i);o D.o ArrayList list = new ArrayList();System.out.println(list.contains(null));正确答案:D 17. (单选)下列代码的输出结果是() boolean b=true?false:true==true?false:true;System.out.println(b);o A.trueo B.falseo C.nullo D.空字符串正确答案:B 18. (单选)运行下列代码: int[] oneArr = { 2, 11, 26, 27, 37, 44, 48, 60 }; int[] twoArr = { 19, 35, 49, 55, 58, 75, 83, 84, 91, 93 }; int[] threeArr = new int[oneArr.length + twoArr.length]; int p = 0, q = 0; while (p text"; } public static void main(String[] args) { System.out.println(new XMLMessage().getText()); }}o A.texto B.texto C.抛出运行时异常o D.代码 public class XMLMessage extends packagea.Message{行,编译错误正确答案:B 28.(单选)下列表达式中,可以得到精确结果的是()。

      o A.double d1 = 3.0 - 2.6;o B.double d4 = 2.5 * 1.5;o C.double d2 = 30/300;o D.double d3 = 1/2 + 0.5;正确答案:B 29. (单选)以下程序的输出结果是: () public class Super { public Super() { System.out.println("Super "); } } public class Sub extends Super{ public Sub() { System.out.println("Sub"); } public static void main(String[] args) { Super fc = new Super(); Sub cc = new Sub(); }}o A.o Supero SuperSubo B.o SuperSubo C.o SubSupero D.o Supero SubSub正确答案:A 30. (单选)请看下列代码: class ClassA {} class ClassB extends ClassA {} class ClassC extends ClassA {} public class Test{ public static void main(String[] args) { ClassA p0 = new ClassA(); ClassB p1 = new ClassB(); ClassC p2 = new ClassC(); ClassA p3 = new ClassB(); ClassA p4 = new ClassC();  } }可以在处,填入的代码正确的是()o A.p0 = p1;o B.p1 = p2;o C.p2 = p4;o D.p2 = (ClassC)p1;正确答案:A 31.(多选)在 Java语言中,下列说法正确的是()。

      o A.一个接口可以继承多个接口o B.一个类可以继承多个类o C.一个类可以实现多个接口o D.一个类可以有多个子类正确答案:ACD 32. (多选题)变量定义如下: int i = 128;下列赋值语句正确的是:()o A.int j = i;o B.short s = i;o C.short s = 128;o D.long l = i;正确答案:ACD 整数常量在 java 中默认是 int 类型 选项 A 将 int 类型赋值给 int 类型是合法的 选项 B i 是 int 类型变量,赋值给 short 类型的变。

      点击阅读更多内容
      关于金锄头网 - 版权申诉 - 免责声明 - 诚邀英才 - 联系我们
      手机版 | 川公网安备 51140202000112号 | 经营许可证(蜀ICP备13022795号)
      ©2008-2016 by Sichuan Goldhoe Inc. All Rights Reserved.