主页 |  社区 |  科技 |  开发 |  网络 |  运营 |  手机 |  电脑 |  认证 |  系统 |  ProgNet |  讨论区 |  搜索 |  RSS订阅






温馨提示
  • 2009 年新年期间,本站开放时间暂调整为每周二、周三、周四全天24小时,其它时间段夜间将暂停服务,敬请谅解!
  • 点击上方“当前位置”后面的链接,可以浏览更详细的或者与之相关的内容。
  • 即刻注册 Phontol.com 网站通行证,在本站任何一站点登陆后,都不需要再次重复注册和登陆,即可享有所有站点功能和服务,快去注册你的通行证,体验一站式服务吧!
  • Phontol.com 为大家开通了一个综合讨论区,快去共同分享你我的快乐吧! 在那里,大家可以畅所欲言,还可以粘贴你的个人写真集哦。现在就去»讨论区看看


资讯阅览
 
资讯主题:

Java程序员认证模拟题及详细分析(1)


发布日期:2008/6/4 21:39:11
人气指数:112

选择内容区背景色:灰色(默认色) 墨绿 杏仁黄 秋叶褐 胭脂红 芥末绿 天蓝 雪青 灰 银河白
(字体大小: 中(默认)  | 逐渐变大 逐渐变小
【语言/語言/Language/언어/言語:简体中文 | 繁體中文 | English | 한국어 | 日本語

正常浏览 | 发布资讯 | 评论 | 置顶 | 打印


Google
 

 



一.说明:(真实考试)
1.考试形式:网络计算机
2.考题形式:多选,单选,简答
3.题量:60
4.考试时间:120分钟

二.模拟题

1.Which statement about the garbage collection mechanism are true?
A. Garbage collection require additional programe 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 explicity and immediately frees the memory used by Java objects.
D. The garbage collection mechanism can free the memory used by Java Object at explection 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;
8) System.out.println(a);
9) }
In the absence of compiler optimization, which is the earliest point the object a refered is definitely elibile 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. In the class java.awt.AWTEvent,which is the parent class upon which jdk1.1 awt events are based there is a method called getID which phrase accurately describes the return value of this method?
A. It is a reference to the object directly affected by the cause of the event.
B. It is an indication of the nature of the cause of the event.
C. It is an indication of the position of the mouse when it caused the event.
D. In the case of a mouse click, it is an indication of the text under the mouse at the time of the event.
E. It tells the state of certain keys on the keybord at the time of the event.
F. It is an indication of the time at which the event occurred.

4. 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 addXxxxListener method as many times as is needed, specifying as many different listeners as your design require.

5.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(--l>0)
System.out.println(“Finish”);
}
}
Which well be output:
A. Doing it for l is 3
B. Doing it for l is 1
C. Doing it for l is 2
D. Doing it for l is 0
E. Doing it for l is ?C1
F. Finish

见1-5题答案
答案及详细分析:

   1。www.Phontol.comB、E
JAVA的垃圾回收机制是通过一个后台系统级线程对内存分配情况进行跟踪实现的,对程序员来说是透明的,程序员没有任何方式使无用内存显示的、立即的被释放。www.Phontol.com而且它是在程序运行期间发生的。www.Phontol.com
答案B告诉我们程序员可以使一个本地变量失去任何意义,例如给本地变量赋值为“null”;答案E告诉我们在程序运行期间不可能完全释放内存。www.Phontol.com
2。www.Phontol.comD
第6行将null赋值给a以后,a以前保存的引用所指向的内存空间就失去了作用,它可能被释放。www.Phontol.com所以对象a可能最早被垃圾回收是在第7行以前,故选择D选项。www.Phontol.com
3。www.Phontol.comB
请查阅JAVA类库。www.Phontol.comgetID方法的返回值是“event type”。www.Phontol.com在认证考试中,总会有类似的书本以外的知识,这只能靠多实践来增长知识了。www.Phontol.com
4。www.Phontol.comA、D
控件可以同时使用多个“addXxxxListener”方法加入多个监听器。www.Phontol.com并且当多个监听器加入到同一控件中时,事件可以响应多个监听器,响应是没有固定顺序的。www.Phontol.com
5。www.Phontol.comD、F
本题主要考察考生对流程控制的掌握情况。www.Phontol.com这是当型循环,条件为真执行,条件为假则退出。www.Phontol.com循环体至少执行一次,故会输出D。www.Phontol.com循环体以外的语句总会被执行,故输出F。www.Phontol.com

6. 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. 1
B. 2
C. 3
D. default

7. Give incompleted method:
1)
2) { if(unsafe()){//do something…}
3) else if(safe()){//do the other…}
4) }
The method unsafe() well throe 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

8. Give the code fragment:
if(x>4){
System.out.println(“Test 1”);}
else if (x>9){
System.out.println(“Test 2”);}
else {
System.out.println(“Test 3”);}
Which range of value x would produce of output “Test 2”?
A. x<4
B. x>4
C. x>9
D. None

9. 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 1
B. Test 2
C. Test 3
D. Test 4

10. Which method you define as the starting point of new thread in a class from which new the thread can be excution?
A. public void start()
B. public void run()
C. public void int()
D. public static void main(String args[])
E. public void runnable()

6-10答案:
6。www.Phontol.comB.C
在开关语句中,标号总是不被当做语句的一部分,标号的作用就是做为条件判断而已,一旦匹配成功,就执行其后的语句,一直遭遇break语句为止。www.Phontol.com(包括default语句在内)
7。www.Phontol.comD、F
IOException异常类是Exception的子类。www.Phontol.com根据多态性的定义,IOException对象也可以被认为是Exception类型。www.Phontol.com还要注意在方法声明中抛出异常应用关键字“throws”。www.Phontol.com
8。www.Phontol.comD
只有两种情况:大于4时输出“Test1”,小于等于4时输出“Test3”。www.Phontol.com
9。www.Phontol.comA、C、D
在正常情况下,打印Test1、Test3、Test4;在产生可捕获异常时打印Test2、Test3、Test4;在产生不可捕获异常时,打印Test3,然后终止程序。www.Phontol.com注意finally后面的语句总是被执行。www.Phontol.com
10。www.Phontol.comB
线程的执行是从方法“run( )”开始的,该方法是由系统调用的。www.Phontol.com程序员手工调用方法start(),使线程变为可运行状态。www.Phontol.com

11.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{}

12. Which modifier should be applied to a method for the lock of object this to be obtained prior to excution any of the method body?
A. synchronized
B. abstract
C. final
D. static
E. public

13. 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){
8) str=s;}}
9) public class Example{
10) public void method(){
11) SubClass s=new SubClass(“hello”);
12) BaseClass b=new BaseClass(“world”);
13) }
14) }

Which line would be cause the error?
A. 9 B. 10 C. 11 D.12

14. Which statement is correctly declare a variable a which is suitable for refering to an array of 50 string empty object?
A. String [] a
B. String a[]
C. char a[][]
D. String a[50]
F. Object a[50]

15. Give the following java source fragement:
//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…}

11-15答案:
11。www.Phontol.comA
此题考查内部类及关键字“super”的用法。www.Phontol.com内部类不能与外部类同名。www.Phontol.com另外,当B继承A时,A中的构造函数是带参数的,B中缺省构造函数的函数体为空;而JAVA编译器会为空构造函数体自动添加语句“super();”调用父类构造函数,更进一步是调用父类的参数为空的构造函数。www.Phontol.com而父类中没有参数为空的构造函数。www.Phontol.com
12。www.Phontol.comA
此关键字可以在两个线程同时试图访问某一数据时避免数据毁损。www.Phontol.com
13。www.Phontol.comC
当一个类中未显式定义构造函数时,缺省的构造函数是以类名为函数名,参数为空,函数体为空。www.Phontol.com虽然父类中的某一构造函数有字符串参数s,但是子类继承父类时并不继承构造函数,所以它只能使用缺省构造函数。www.Phontol.com故在第11行出错。www.Phontol.com
14。www.Phontol.comA、B
注意,题中问的是如何正确声明一个一维数组,并非实例化或者初始化数组
15。www.Phontol.comA、E
X处可以是一个输入,包的定义,类的定义。www.Phontol.com由于常量或变量的声明只能在类中或方法中,故不能选择C;由于在一个文件中只能有一个public类,故不能选择D。www.Phontol.com

16. 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 x
B. change private int x to static int x
C. Change private int x to protected int x
D. change private int x to final int x

17. the piece of preliminary analsis work describes a class that will be used frequently in many unrelated parts of a project
“The polygon object is a drawable, A polygon has vertex information stored in a vector, a color, length and width.”
Which Data type would be used?
A. Vector
B. int
C. String
D. Color
E. Date

18. A class design requires that a member variable should be accessible only by same package, which modifer word should be used?
A. protected
B. public
C. no modifer
D. private

19.Which declares for native method in a java class corrected?
A. public native void method(){}
B. public native void method();
C. public native method();
D. public void method(){native;}
E. public void native method();

20. Which modifer 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?

16-20答安:
16。www.Phontol.comB
静态方法除了自己的参数外只能直接访问静态成员。www.Phontol.com访问非静态成员,必须先实例化本类的一个实例,再用实例名点取。www.Phontol.com
17。www.Phontol.comA、B、D
polygon的顶点信息存放在Vector类型的对象内部,color定义为Color,length和width定义为int。www.Phontol.com
注意,这是考试中常见的题型。www.Phontol.com
18。www.Phontol.comC
此题考点是高级访问控制。www.Phontol.com请考生查阅高级访问控制说明表格。www.Phontol.com
19。www.Phontol.comB
native关键字指明是对本地方法的调用,在JAVA中是只能访问但不能写的方法,它的位置在访问权限修饰语的后面及返回值的前面。www.Phontol.com
20。www.Phontol.comfinal
定义常量的方法是在变量定义前加final关键字。www.Phontol.com

21. Which is the main() method return of a application?
A. String
B. byte
C. char
D. void

22. Which is corrected argument of main() method of application?
A. String args
B. String ar[]
C. Char args[][]
D. StringBuffer arg[]

23. “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.

24. Give the following class defination 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 variable}
Which methods are corrected added to the class Hello?
A. public void Example(){}
B. public void method(){}
C. protected void method(){}
D. private void method(){}

25. Float s=new Float(0.9F);
Float t=new Float(0.9F);
Double u=new Double(0.9);
Which expression?s result is true?
A. s==t
B. s.equals(t)
C. s==u
D. t.equals(u)
21-15答案:
21。www.Phontol.comD
main()方法没有返回值,所以必须用void修饰。www.Phontol.commain()方法的返回值不能任意修改。www.Phontol.com
22。www.Phontol.comB
main()方法的参数是字符串数组,参数名可以任意定义。www.Phontol.com
23。www.Phontol.compublic class Employee extends Person
这也是真实考试中常见的一种题型。www.Phontol.com要注意题目叙述中“is a”表示 “extends”的含义。www.Phontol.com
24。www.Phontol.comA、B、C
考察的知识点是方法覆盖,其中要注意的是方法覆盖时,子类方法的访问权限不能小于父类方法的访问权限。www.Phontol.com另外,选项A并不是父类构造函数,它是子类中的新方法。www.Phontol.com
25。www.Phontol.comA、B
考察“==”及方法“equals()”的用法。www.Phontol.com注意以下几点区别:
1) 引用类型比较引用;基本类型比较值。www.Phontol.com
2) equals()方法只能比较引用类型,“==”可比较引用及基本类型。www.Phontol.com
3) 当用equals()方法进行比较时,对类File、String、Date及封装类(Wrapper Class)来说,是比较类型及内容。www.Phontol.com
4) 用“==”进行比较时,符号两边的数据类型必须一致(可相互转换的基本类型除外),否则编译出错。www.Phontol.com
来源:收集整理于互联网




您是不是没有看到自己所需要的信息呢?来,在下面输入您要搜索的关键字,点击搜索试试看。
在右侧文字框输入关键字:


热门栏目导航
.NET | 手机资讯 | 国内资讯 | 国外互联网 | ASP.NET | 国内互联网 | 国外科技 | 国际资讯 | 国内电信 | 国内科技 | 娱乐 | SQL Server | Windows Vista | 国外电信 | 汽车资讯 | 中国足球 | 国际IT业界 | 国外足球 | Photoshop | Excel | NBA | 路由技术 | Word | 手机技巧 | 网络管理 | 站长之经验心得 | 网络安全 | ASP | 网络知识 | 篮球 | ERP开发 | VC/C++ | Html | CSS+DIV | 局域网 | 网络方案 | 国内军事资讯 | 交换技术 | 站长之推广策划 | DreamWeaver | 3DS Max | Windows Server 2003 | 电脑应用 | AJAX 相关 | 网管技术 | 硬件知识 | 国际军事资讯 | Linux | Javascript | PHP | Photoshop | 电脑病毒查杀 | Cisco认证 | VMware | 大陆娱乐资讯 | 智能手机 | 产业新闻 | 港台娱乐资讯 | Flash | 网络专题技术 | 软件应用问答 | Firework | 音乐手机 | 软件测试 | XML | 拍照手机 | 华为网络 | 站长之SEO | 网络应用技巧 | 电脑入门资料 | 站长之休闲 | 家常菜谱 | PPT/PowerPoint | 操作系统 | Maya | 操作系统综合 | C# | Windows XP | 电脑故障综合 | 手机购机指南 | 微软认证 | 技巧知识 | 其它图形软件 | Wps Office | Web服务器 | 站长之网赚 | 全国等级考试 | CSS教程 | Access | 市场动态 | 防范措施 | Exchange Server | 注册表教程 | 主板故障 | 显示器故障 | 欧美娱乐资讯 | 电脑CPU | 经验技巧 | 游戏开发 | 系统进程 | 服务器综合集锦 | Outlook | JavaScript | IBM DB2 | 手机BUG | JAVA技巧 | QQ技巧 | JAVA基础 | 硬盘检测 | 电脑内存 | Authorware | BIOS | 站长之访谈 | ORACLE认证 | 项目管理 | QQ游戏 | Java认证 | 组网技术 | 煲汤食谱 | Linux技术 | 黑客攻防技术 | Illustrator | AutoCAD | Virtual PC | JSP | 健康饮食 | 声卡显卡 | CorelDraw | FTP服务器 | IT 人物

特别声明和提示
  • Phontol.com 和网页作者无关,不对网页的内容负责。
  • 如有任何异议,请参见版权声明/免责声明部分。
  • 双击鼠标左键可以自动滚屏,以方便您的阅读;单击鼠标左键可停止滚屏。

 
图片资讯


最新资讯


热门资讯


其它链接



讨论区 - 最新话题


热门搜索




声明:非本站原创内容和本站转载内容,其版权所有权属于原版权持有人所有。
若本网站侵犯了您的权益,请通知我们,我们会立即纠正。




申请链接 | 友情链接 | 联系我们 | 意见反馈 | 使用条款 | 隐私权声明 | 版权声明 | 站点地图

      Copyright © 2009 Phontol. All Rights Reserved. 京ICP备07004242号