ImageVerifierCode 换一换
格式:DOCX , 页数:17 ,大小:24.86KB ,
资源ID:19474158      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/19474158.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(JAVA认证真题35道SCJP考试真题精解Word文件下载.docx)为本站会员(b****6)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

JAVA认证真题35道SCJP考试真题精解Word文件下载.docx

1、 2.voidtest(int3.System.out.println(“Iamanint.”);4. 5.test(Strings)6.astring.”);7.8. 9.publicstaticmain(Stringargs)10.Testt=newTest();11.charch=“y”;12.t.test(ch);13.14.Which of the statements below is true?(Choose one.)A. Line 5 will not compile, because void methods cannot be overridden.B. Line 12

2、will not compile, because there is no version of test() that rakes a char argument.C. The code will compile but will throw an exception at line 12.D. The code will compile and produce the following output: I am an int.E. The code will compile and produce the following output: I am a String.D在第12行,16

3、位长的char型变量ch在编译时会自动转化为一个32位长的int型,并在运行时传给void test(int i)方法。例题4:Which of the following lines of code will compile without error?A.inti=0;if(i)System.out.println(“Hi”);B.booleanb=true;b2=true;if(b=b2)System.out.println(“Sotrue”);C.i=1;j=2;if(i=1|j=2) System.out.println(“OK”);D.(i=1&|B, C选项A错,因为if语句后需

4、要一个boolean类型的表达式。逻辑操作有、&、| 和 &、|,但是“&|”是非法的,所以选项D不正确。例题5:Whichtwodemonstratehasarelationship?(Choosetwo) A.interfacePersonpublicEmployeeextendsPersonB.ShapeRectandleC.ColorableimplementsColorable D.SpeciesAnimalprivateSpeciesspecies;E.ComponentclassContainerComponent privateComponentchildren;D, E 在J

5、ava中代码重用有两种可能的方式,即组合(“has a”关系)和继承(“is a”关系)。“has a”关系是通过定义类的属性的方式实现的;而“is a”关系是通过类继承实现的。本例中选项A、B、C体现了“is a”关系;选项D、E体现了“has a”关系。例题6:Which two statements are true for the class java.util.TreeSet? (Choose two)A. The elements in the collection are ordered.B. The collection is guaranteed to be immutabl

6、e.C. The elements in the collection are guaranteed to be unique.D. The elements in the collection are accessed using a unique key.E. The elements in the collection are guaranteed to be synchronizedA, CTreeSet类实现了Set接口。Set的特点是其中的元素惟一,选项C正确。由于采用了树形存储方式,将元素有序地组织起来,所以选项A也正确。例题7:True or False: Readers ha

7、ve methods that can read and return floats and doubles.A. TureB. FalseB Reader/Writer只处理Unicode字符的输入输出。float和double可以通过stream进行I/O.例题8:What does the following paint() method draw?1. public void paint(Graphics g) 2. g.drawString(“Any question”, 10, 0);3. A. The string “Any question?”, with its top-le

8、ft corner at 10,0B. A little squiggle coming down from the top of the component.drawString(String str, int x, int y)方法是使用当前的颜色和字符,将str的内容显示出来,并且最左的字符的基线从(x,y)开始。在本题中,y=0,所以基线位于最顶端。我们只能看到下行字母的一部分,即字母y、q的下半部分。例题9:What happens when you try to compile and run the following application? Choose all correc

9、t options.1.Zmain(Stringargs)newZ();5. Z()alias1=this;8.alias2synchronized(alias1)tryalias2.wait();System.out.println(“DONEWAITING”);catch(InterruptedExceptione)15.System.out.println(“INTERR UPTED”);16.17.(Exception18.System.out.println(“OTHEREXCEPTION”);19.20.finally21.System.out.println (“FINALLY”

10、);22.23.24.System.out.println(“ALLDONE”);25.26.A. The application compiles but doesnt print anything.B. The application compiles and print “DONE WAITING”C. The application compiles and print “FINALLY”D. The application compiles and print “ALL DONE”E. The application compiles and print “INTERRUPTED”在

11、Java中,每一个对象都有锁。任何时候,该锁都至多由一个线程控制。由于alias1与alias2指向同一对象Z,在执行第11行前,线程拥有对象Z的锁。在执行完第11行以后,该线程释放了对象Z的锁,进入等待池。但此后没有线程调用对象Z的notify()和notifyAll()方法,所以该进程一直处于等待状态,没有输出。例题10:Which statement or statements are true about the code listed below? Choose three.MyTextAreaTextAreaMyTextArea(intnrows,intncols)enableEv

12、ents(AWTEvent.TEXT_ EVENT_MASK);processTextEvent (TextEventte)System.out.println(“Processingtextevent.”);A. The source code must appear in a file called MyTextArea.javaB. Between lines 2 and 3, a call should be made to super(nrows, ncols) so that the new component will have the correct size.C. At li

13、ne 6, the return type of processTextEvent() should be declared boolean, not void.D. Between lines 7 and 8, the following code should appear: return true.E. Between lines 7 and 8, the following code should appear: super.processTextEvent(te).A, B, E由于类是public,所以文件名必须与之对应,选项A正确。如果不在2、3行之间加上super(nrows,

14、ncols)的话,则会调用无参数构建器TextArea(), 使nrows、ncols信息丢失,故选项B正确。在Java2中,所有的事件处理方法都不返回值,选项C、D错误。选项E正确,因为如果不加super.processTextEvent(te),注册的listener将不会被唤醒。11、Which statement about the garbage collection mechanism are true?A. Garbage collection require additional programe code in cases where multiple threads are

15、 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

16、time.E. The garbage collection system never reclaims memory from objects while are still accessible to running user threads.答案:B、EJAVA的垃圾回收机制是通过一个后台系统级线程对内存分配情况进行跟踪实现的,对程序员来说是透明的,程序员没有任何方式使无用内存显示的、立即的被释放。而且它是在程序运行期间发生的。答案B告诉我们程序员可以使一个本地变量失去任何意义,例如给本地变量赋值为“null”;答案E告诉我们在程序运行期间不可能完全释放内存。12、Give the fo

17、llowing method:1)method() 2)Stringa,b;3)a=newString(“helloworld”);4)b=newString(“gameover”);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

18、.A. before line 3B.before line 5C. before line 6D.before line 7E. Before line 9第6行将null赋值给a以后,a以前保存的引用所指向的内存空间就失去了作用,它可能被释放。所以对象a可能最早被垃圾回收是在第7行以前,故选择D选项。13、 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 acc

19、urately 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

20、, 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.请查阅JAVA类库。getID方法的返回值是“event type”。在认证考试中,总会有类似的书本以外的知识,这只能靠多实践来增长知识了。14、Which state

21、ment 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 a

22、s many times as is needed, specifying as many different listeners as your design require.A、D控件可以同时使用多个“addXxxxListener”方法加入多个监听器。并且当多个监听器加入到同一控件中时,事件可以响应多个监听器,响应是没有固定顺序的。15、Give the following code:Example argsl=0;do System.out.println(“Doingitforlis:”+l);while(-l0) System.out.println(“Finish”); Whic

23、h well be output:A. Doing it for l is 3B. Doing it for l is 1C. Doing it for l is 2D. Doing it for l is 0E. Doing it for l is ?C1F. FinishD、F本题主要考察考生对流程控制的掌握情况。这是当型循环,条件为真执行,条件为假则退出。循环体至少执行一次,故会输出D。循环体以外的语句总会被执行,故输出F。16、Give the code fragment:switch(x) case1:System.out.println(“Test1”);break;2:3:2”);default:System.out.println(“end”);which value of x would cause “Test 2” to the output:A. 1B. 2C. 3D. defaultB.C在开关语句中,标号总是不被当做语句的一部分,标号的作用就是做为条件判断而已,一旦匹配成功,就执行其后的语句,一直遭遇break语句为止。(包括default语句在内)17、Give incompleted method:1) if(unsafe()/dosomething elseif(safe()/doother The method un

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1