杰普 Core Java2014测试题 附最新答案

美国杰普科技公司 www.briup.com.cn

班级: 姓名: 日期:

Core Java试题

选择填空题:全部为多选题,只有全部正确才能得分。

1. 编译java程序的命令是___B_____;运行java程序的命令是____A____;产生java文挡的命令是_D_______;

查询java类型是否是serializable类型的命令是___C_____;产生java安全策略文件的命令是___E_____;产生类型归档文件.jar的命令是__F______。

A. java B. javac C. serialver D.javadoc E.policytool F.jar

2. 在一个java原文件中,import, class, package语句的顺序是_F_______。

A. import class package B. class import package C. package class import D. import package class E. class package import F. package import class

3. 下面叙述正确的有_______CDEF_____________。

A. 在一个java原文件中只能定义一个class B. 在一个java原文件中只能定义一个interface C. 在一个java原文件中可以定义多个class D. 在一个java原文件中可以定义多个interface

E. 在一个java原文件中可以定义多个class和interface F. 在一个java原文件中只能定义一个public class

4. java程序中程序运行入口方法main的签名正确的有____AB____。

A. public static void main(String args[]) B. static public void main(String[] args) C. public void static main(String[] args) D. public void main(String args[])

5. java程序中程序入口方法main的参数代表命令行输入参数,命令行参数从____A____开始。

A. 0 B. 1 C.-1 6. 以下属于正确的java注释有____ACD____。

A. //This is comment B. /*This is comment C. /**This is comment*/ D. /*This is comment*/

7. 以下能作为class, interface, method或variable有效标识符的有______ADF__________。

A. For B.boolean C.23age

D. _id E.my name F. $this_is_a_long_variable_name 8. 以下不是java关键字的有__D______。

A. super C.this D.NULL E.true 9. 以下能作为char类型的字面值的有__BD______。

A. “e” B.?f? C. ?\%u12? D.?\? 10. byte变量的取值范围是____B____。

A. 0 - 65535 B.-128 – 127 C.-256 – 255 D.0 - 32767 11. 以下正确的有_____AC___。

1

美国杰普科技公司 www.briup.com.cn

A. int i = 32; B.float f = 45.32; C. double d=3.2; 12. 以下返回true的表达式有____AC____。

A. “george” == “george” B.”george” = “george”

C. “george”.equals(new String(“george”)) D. “george” == new String(“george”) 13. 根据以下程序选择正确答案____C____:

public class Test {

static int total = 10;

public static void main (String args []) { new Test(); }

public Test () { System.out.println(\ System.out.println(this); //?????????????????????? int temp = this.total; if (temp > 5) { System.out.println(temp); } } }

A. 编译出错 B.运行时有异常 C. 编译运行都正确 14. 下面集合定义正确的有____BD____。

A. String strs[] = { ?a? ?b? ?c?}; B. String[] strs = {“a”, “b”, “c”};

C. String[] strs = new String{“a” ”b” ”c”}; D.String strs[] = new String[]{“a”, “b”, “c”}; E.String[] strs = new String[3]{“a”, “b”, “c”};

15. 分别使用for, while, do/while循环实现从1到100的累加。

1) for

sum=0;

for(int i=1;i<101;i++) {sum+=i; }

2) while int i=0; int sum = 0; while(i<101) {

Sum += I; I++; }

2

美国杰普科技公司 www.briup.com.cn

3) do-while Do { }

16. 以下switch表达语句正确的有___AC_____。

A. public void switchTest(char c){

switch(c){…} }

B. public void switchTest(long c){

switch(c){…} }

C. public void switchTest(byte c){

switch(c){…} }

D. public void switchTest(double c){

switch(c){…} }

17. 在面向对象编程中,一个类型由____C____、__D______和___F_____组成。面向对象的特性包括

___G_____、__I______和____J____。在java中访问权限的限制由严格到宽松依次是___E_____、_____H___、___B_____和__A______。 A.public B.protected C.identifier D.data E.private F.operations G.inheritance H.default(no modifier) I.encapsulation J.polymorphism

18. 以下方法申明正确的有_______AD_________。

A.public static synchronized void writeLog(String msg) B. synchronized public static writeLog(String msg) C. public final abstract void writeLog(String msg) D.final public void writeLog(String msg)

E.abstract synchronized void writeLog(String msg)

19. Java方法的参数传递对于基本数据类型如int, byte等,参数传递是__C______;对自定义数据类型,参

数传递是_____A___。

A. by reference B.by pointer C. by value D.by address 20. 如下程序:

public class ArugmentTest{

static class IntA{ private int a;

public IntA(int a){ this.a = a; } public int getA() { return a; }

public void setA(int a){ this.a = a; } }

3

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4