【我自己在达内培训时候总结的】达内经典笔试题集(带答案)

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

1

JAVASE 部分

1、Choose the three valid identifiers from those listed below. (Choose three)?

A.IDoLikeTheLongNameClass

B.$byte

C.const

D._ok

E.3_case

答:ABD

2、Which of the following lines of code will compile without error (Choose two)?

A.

int i=0;

if (i) {

System.out.println(“Hi”);

}

B.

boolean b=true;

boolean b2=true;

if(b==b2) {

Sy stem.out.println(“So true”);

}

C.

int i=1;

int j=2;

if(i==1|| j==2)

System.out.println(“OK”);

D.

int i=1;

int j=2;

if (i==1 &| j==2)

System.out.println(“OK”);

答:BC

3、Which two demonstrate a "has a" relationship(Choose two)?

A. public interface Person { }

public class Employee extends Person{ }

B. public interface Shape { }

public interface Rectandle extends Shape { }

C.public interface Colorable { }

public class Shape implements

Colorable { }

D.public class Species{ }

Copyright Tarena Corporation,2009.All rights reserved

2

public class Animal{private Species species;}

E. interface Component{ }

class Container implements

Component{ private Component[]

children;

}

答:DE

4、What will happen when you attempt to compile and run the

following code? public class Static{

static {

int x = 5;

}

static int x,y;

public static void main(String

args[]){ x--;

myMethod(); System.out.println(x

+ y + ++x);

}

public static void

myMethod(){ y = x+++++x;

}

}

piletime

error B.prints: 1

C.prints: 2

D.prints: 3

E.prints: 7

F.prints: 8

答:D

5 、 What is the correct ordering for the import, class and package

declarations when found in a single file?

A.package, import, class

B.class, import, package

C.import, package, class

D.package, class, import

答:A

6、What will happen when you attempt to compile and run the

following code. public class Pvf{

static boolean Paddy;

public static void main(String

argv[]){ System.out.println(Paddy);

}

}

Copyright Tarena Corporation,2009.All rights reserved

3

A. Compile time error

B. compilation and output of false

C. compilation and output of true

D. compilation and output of null 答:B

7、Given the folowing classes which of the following will compile without error?

interface IFace{}

class CFace implements IFace{}

class Base{}

public class ObRef extends Base{

public static void main(String

argv[]){ ObRef ob = new ObRef();

Base b = new Base();

Object o1 = new Object();

IFace o2 = new CFace();

}

}

A. o1=o2;

B. b=ob;

C. ob=b;

D. o1=b;

答:ABD

8、下面那几个函数是 public void method(){...}的重载函数?

A)public void method( int m){...}B)public int method(){...}

C)public void method2(){...}D)public int method(int m,float f ){...} 答:AD

9、给出如下声明:

String s = “Example”;

合法的代码有哪些?

A)s>>>=3B)s[3]= “X”C)int i = s.length()D)s = s + 10

答:CD

10、如下哪些不是 java 的关键字?

A)const B)NULL C) false D)this E) native

答:B

11、关于垃圾收集的哪些叙述是对的A)程序开发者必须自

己创建一个线程进行内存释放的工作B)垃圾收集将检查并

释放不在使用的内存C)垃圾收集允许程序开发者明确指定

并立即释放该内存D)垃圾收集能够在期望的时间释放被

java 对象使用的内存答:B

相关文档
最新文档