分享
 
 
 

Java认证经典模拟题

王朝java/jsp·作者佚名  2008-05-31
窄屏简体版  字體: |||超大  

Java认证经典模拟题(only for trainning)

一. 真实考试说明

1.考试形式:网络计算机

2.考题形式:多选,单选,简答

3.题量:60

4.考试时间:120分钟

5.更新考试记忆或其它认证知识请登陆www.javaunion.org

6.本模拟题相对经典陈旧,是北京网畅创总裁胡德平1997SCJP模拟版本地扩充

二.模拟题

1.Which statement about the garbage collection mechanism are true?

A.Garbage collection require additional program code in cases where multiple threads are running.

B.The programmer can indicate that a reference through a local variable is no longer of interest.

C.The programmer has a mechanism that eXPlicit and immediately frees the memory used by Java objects.

D.The garbage collection mechanism can free the memory used by Java Object at expectable time.

E.The garbage collection system never reclaims memory from objects while are still Accessible to running user threads.

2. Give the following method:

1)public void method( ){

2) String a,b;

3) a=new String(“hello world”);

4) b=new String(“game over”);

5) System.out.println(a+b+”ok”);

6) a=null;

7) a=b;

System.out.println(a);

9) }

In the absence of compiler optimization, which is the earliest point the object a referred is definitely hand to be garbage collection.

A. before line 3 B.before line 5 C. before line 6 D.before line 7 E. Before line 9

3. Which statement about listener is true?

A.Most component allow multiple listeners to be added.

B.If multiple listener be add to a single component, the event only affected one listener.

C.Component don’t allow multiple listeners to be add.

D.The listener mechanism allows you to call an addXXXListener method as many times as is needed, specifying as many different listeners as your design require.

4.Give the following code:

public class Example{

public static void main(String args[] ){

int l=0;

do{

System.out.println(“Doing it for l is:”+l);

}while(--l0)

System.out.println(“Finish”);

}

}

Which well be output:

A. Doing it for l is 3B. Doing it for l is 1C. Doing it for l is 2

D. Doing it for l is 0E. Doing it for l is –1F. Finish

5. Give the code fragment:

1)switch(x){

2) case 1: System.out.println(“Test 1”);break;

3) case 2:

4) case 3: System.out.println(“Test 2”);break;

5) default: System.out.println(“end”);

6) }

which value of x would cause “Test 2” to the output:

A. 1B. 2C. 3D. default

6. Give incompleted method:

1)

2){if(unsafe()){//do something…}

3)else if(safe()){//do the other…}

4)}

The method unsafe() will throw an IOException, which completes the method of declaration when added at line one?

A.public IOException methodName()

B.public void methodName()

C.public void methodName() throw IOException

D.public void methodName() throws IOException

E.public void methodName() throws Exception

7. Give the code fragment:

if(x4){

System.out.println(“Test 1”);}

else if (x9){

System.out.println(“Test 2”);}

else {

System.out.println(“Test 3”);}

Which range of value x would prodUCe of output “Test 2”?

A. x4C. x9D. None

8. Give the following method:

public void example(){

try{

unsafe();

System.out.println(“Test1”);

}catch(SafeException e){System.out.println(“Test 2”);

}finally{System.out.println(“Test 3”);}

System.out.println(“Test 4”);

Which will display if method unsafe () run normally?

A. Test 1B. Test 2C. Test 3D. Test 4

9. Which method you define as the starting point of new thread in a class from which new the thread can be execution?

A. public void start()B. public void run()C. public void int()

D. public static void main(String args[])E. public void runnable()

10.Given the following class definition:

class A{

protected int i;

A(int i){

this.i=i;

}

}

which of the following would be a valid inner class for this class?

Select all valid answers:

A. class B{

}

B.class B extends A{

}

C.class B extends A{

B(){System.out.println(“i=”+i);}

}

D.class B{

class A{}

}

E.class A{}

11. Which modifier should be applied to a method for the lock of object this to be oBTained prior to execution any of the method body?

A. synchronizedB. abstractC. finalD. staticE. public

12. The following code is entire contents of a file called Example.java,causes precisely one error during compilation:

1)class SubClass extends BaseClass{

2) }

3)class BaseClass(){

4) String str;

5) public BaseClass(){

6) System.out.println(“ok”);}

7) public BaseClass(String s){

str=s;}

9)}

10)public class Example{

11) public void method(){

12) SubClass s=new SubClass(“hello”);

13) BaseClass b=new BaseClass(“world”);

14) }

15) }

Which line would be cause the error?

A. 9B. 10C. 11D.12

13. Which statement is correctly declare a variable a which is suitable for refering to an array of 50 string empty object?

A. String [] aB. String a[]C. char a[][]D. String a[50]F. Object a[50]

14. Give the following java source fragment:

//point x

public class Interesting{

//do something

}

Which statement is correctly Java syntax at point x?

A. import java.awt.*;B.package mypackage;C. static int PI=3.14

D. public class MyClass{//do other thing…}E. class MyClass{//do something…}

15. Give this class outline:

class Example{

private int x;

//rest of class body…

}

Assuming that x invoked by the code java Example, which statement can made x be directly accessible in main() method of Example.java?

A. change private int x to public int xB. change private int x to static int x

C. change private int x to protected int xD. change private int x to final int x

16. A class design requires that a member variable should be accessible only by same package, which modifier Word should be used?

A. protectedB. publicC. no modifierD. private

17. Which modifier should be applied to a declaration of a class member variable for the value of variable to remain constant after the creation of the object?

18. Which is corrected argument of main() method of application?

A. String argsB. String ar[]C. Char args[][]D. StringBuffer arg[]

19. “The Employee object is a Person, An Employee has appointment store in a vector, a hire date and a number of dependent”

short answer: use shortest statement declare a class of Employee.

20. Give the following class definition inseparate source files:

public class Example{

public Example(){//do something}

protected Example(int i){//do something}

protected void method(){//do something}

}

public class Hello extends Example{//member method and member vari

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有