达内jsd1412第一次月考试题及答案..

上传人:101****457 文档编号:88875419 上传时间:2019-05-12 格式:DOC 页数:16 大小:73KB
返回 下载 相关 举报
达内jsd1412第一次月考试题及答案.._第1页
第1页 / 共16页
达内jsd1412第一次月考试题及答案.._第2页
第2页 / 共16页
达内jsd1412第一次月考试题及答案.._第3页
第3页 / 共16页
达内jsd1412第一次月考试题及答案.._第4页
第4页 / 共16页
达内jsd1412第一次月考试题及答案.._第5页
第5页 / 共16页
点击查看更多>>
资源描述

《达内jsd1412第一次月考试题及答案..》由会员分享,可在线阅读,更多相关《达内jsd1412第一次月考试题及答案..(16页珍藏版)》请在金锄头文库上搜索。

1、考试场次:2015_01月月考_01月29日_JAVA 试卷名称:2015年01月_JSD_JSD14121. 运行下面的程序: int a = 100; int b = 200; a = a + b; b = a - b; a = a - b; System.out.println(a= + a + , b= + b); 输出的结果是:()。 A. a=100, b=300 B. a=100, b=200 C. a=200, b=100 D. a=300, b=200正确答案:C2. 下面关于数组的声明语句中,有编译错误的是:()。 A. int arr = new int1,2,3; B.

2、 int arr = null;arr = 1,2,3,4,5; C. int arr = new int1,2,3,4,5,6 D. int arr = new int2;正确答案:B3. 分析如下代码,输出结果为()。 public static void main(String args) int i = 0; boolean re = false; re = (+i) + i = 2) ? true : false; System.out.println(i= + i + ,re=+re); A. i=1,re=true B. i=0,re=true C. i=1,re=false D

3、. i=0,re=false正确答案:A4. 请看下列代码:interface Foo int bar();public class Sprite public int fubar(Foo foo) return foo.bar(); public void testFoo() fubar( ); 使类Sprite编译通过,在处应填入的代码是: A. Foo public int bar() return 1; B. new Foo public int bar() return 1; C. new Foo() public int bar()return 1; D. new class Fo

4、o public int bar() return 1; 正确答案:C 5. 程序的执行结果是:public class Test public static void main(String args) String str1= new String(abc); String str2 = new String(abc); String str3=str1; if(str1.equals(str2) System.out.println(true); else System.out.println(false); if(str1=str3) System.out.println(true);

5、 else System.out.println(false); A. true true B. truefalse C. false true D. false false正确答案:A6. 下列代码的输出结果是:()。 public class StaticFoo int num; static int x; public static void main(String args) StaticFoo foo1 = new StaticFoo (); foo1.num+; foo1.x+; StaticFoo foo2 = new StaticFoo (); foo2.num+; foo2.

6、x+; StaticFoo foo3 = new StaticFoo (); foo3.num+; foo3.x+; StaticFoo.x+; System.out.print(foo3.num+,); System.out.println(foo3.x); A. 3,3 B. 1,3 C. 3,4 D. 1,4 正确答案:D7. 运行下面的程序:Calendar c = Calendar.getInstance();c.set(Calendar.YEAR, 2012);c.set(Calendar.MONTH, Calendar.SEPTEMBER);c.set(Calendar.DATE

7、, 31);SimpleDateFormat sdf = new SimpleDateFormat(yyyy-MM-dd);System.out.println(sdf.format(c.getTime(); 输出的结果是:()。 A. 2012-10-1 B. 2012-10-01 C. 2012-09-30 D. 2012-9-30正确答案:B8. 下列关于JVM说法,错误的是()。 A. JVM通过专门的线程实现内存的回收。 B. 使用java命令时,可以通过参数来设置分配JVM的内存大小。 C. JRE包括JVM及Java核心类库。 D. 目前主流版本JVM通过纯解释的方式运行Java

8、字节码。正确答案:D9. 请看下列代码:public class Plant private String name; public Plant(String name) this.name = name; public String getName() return name; class Tree extends Plant public void growFruit() public void dropLeaves() 下列说法正确的是: A. 在Tree类中添加代码:public Tree() Plant(); ,编译将通过 B. 在Plant类中添加代码:public Plant()

9、 Tree(); ,编译将通过 C. 在Plant类中添加代码:public Plant() this(”fern”); ,编译将通过 D. 在Plant类中添加代码:public Plant() Plant(”fern”); ,编译将通过正确答案:C10. 运行下列程序: String str = *java*java*java*; String str1 = java; int index = 0; while (index = str.indexOf(str1, index) != -1) System.out.print(index+”); index += str1.length()

10、; 控制台输出的结果是:()。 A. 1 8 17 B. 2 9 18 C. 5 12 21 D. 6 13 22正确答案:B11. 下列语句创建对象的总个数是:()。 String s=”a”+”b”+”c”+”d”+”e”; A. 1 B. 2 C. 3 D. 4 正确答案:A 12. 下列代码的输出结果是()。 int j=0; for(int i=0;i100;i+) j=j+; System.out.println(j); A. 0 B. 99 C. 100 D. 101 正确答案:A13. 下列代码编译和运行的结果是() public class Foo public static

11、 void main(String args) java.util.List list = new java.util.ArrayList(); list.add(new B(); list.add(new C(); for (A a : list) a.x(); a.y(); interface A void x(); class B implements A public void x() public void y() class C extends B public void x() A. 代码运行没有输出 B. 运行时抛出异常 C. 代码a.y();行,编译错误 D. 代码java.

12、util.List list = new java.util.ArrayList();行,编译错误正确答案:C14. 下面的程序可以输出1100内前10个3的倍数: for (int i = 1, count = 0; i = 10) break; B. if (+count = 10) break; C. if (count+ = 10) continue; D. if (+count = 10) continue;正确答案:B 15. 请看下列代码: public class Person private String name; public Person(String name) this.name = name; public boole

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 中学教育 > 其它中学文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号