




已阅读5页,还剩14页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
文思创新软件技术有限公司杭州分公司 java开发工程师(工作地杭州-急聘)笔试题 公司简介 所在省市:-深圳 公司地址:中国杭州市滨江区东信大道66号东方通信城 E 座 A325 室 查看地图 电子邮箱: zhaopin_ 公司性质:计算机软件计算机软件公司 返回上级目录 选择题 1:在下述选项时,没有构成死循环的程序是 A.int i=100 while (1) i=i%100+1; if (i100) break; B.for (;); C.int k=1000; do +k; while(k=10000); D.int s=36; while (s);-s; 2: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 runnable() D.public static void main(String args) 3: Whatwillbetheresultofexecutingthefollowingcode? /Filename;SuperclassX.java packagepackageX; publicclassSuperclassX protectedvoidsuperclassMethodX() intsuperclassVarX; /FilenameSubclassY.java 1.packagepackageX.packageY; 2. 3.publicclassSubclassYextendsSuperclassX 4. 5.SuperclassXobjX=newSubclassY(); 6.SubclassYobjY=newSubclassY(); 7.voidsubclassMethodY() 8. 9.objY.superclassMethodX(); 10.inti; 11.i=objY.superclassVarX; 12. 13. Choices:What will be the result of executing the following code? / Filename; SuperclassX.javapackage packageX; public class SuperclassXprotected void superclassMethodX()int superclassVarX; / Filename SubclassY.java1.package packageX.packageY;2.3.public class SubclassY extends SuperclassX4.5.SuperclassX objX = new SubclassY();6.SubclassY objY = new SubclassY();7.void subclassMethodY()8.9.objY.superclassMethodX();10.int i;11.i = objY.superclassVarX;12.13. Choices:A.Compilation error at line 5 B.Compilation error at line 9 C.Runtime exception at line 11 D.None of these 4: publicclassOuterClass privatedoubled1=1.0; /insertcodehere Youneedtoinsertaninnerclassdeclarationatline3.Whichtwoinnerclassdeclarationsare valid?public class OuterClass private double d1 = 1.0;/insert code hereYou need to insert an inner class declaration at line 3. Which two inner class declarations arevalid?A.class InnerOne public static double methoda() return d1; B.public class InnerOne static double methoda() return d1; C.private class InnerOne double methoda() return d1; D.static class InnerOne protected double methoda() return d1; 5: Givethefollowingjavaclass: publicclassExample publicstaticvoidmain(Stringargs) staticintx=newint15; System.out.println(x5); Whichstatementiscorrected?Give the following java class:public class Examplepublic static void main(String args)static int x = new int15;System.out.println(x5);Which statement is corrected?A.When compile, some error will occur. B.When run, some error will occur. C.Output is zero. D.Output is null. 6: Whatwillhappenwhenyouattempttocompileandrunthefollowingcode? (Assumethatthecodeiscompiledandrunwithassertionsenabled.) publicclassAssertTest publicvoidmethodA(inti) asserti=0:methodB(); System.out.println(i); publicvoidmethodB() System.out.println(Thevaluemustnotbenegative); publicstaticvoidmain(Stringargs) AssertTesttest=newAssertTest(); test.methodA(-10); What will happen when you attempt to compile and run the following code?(Assume that the code is compiled and run with assertions enabled.)public class AssertTestpublic void methodA(int i)assert i = 0 : methodB();System.out.println(i);public void methodB() System.out.println(The value must not be negative);public static void main(String args)AssertTest test = new AssertTest();test.methodA(-10); A.it will print -10 B.it will result in AssertionError showing the message-“the value must not be negative”. C.the code will not compile. D.None of these. 7:Which fragments are not correct in Java source file? A.package testpackage; public class Test/do something. B.import java.io.*; package testpackage; public class Test/ do something. C.import java.io.*; class Person/ do something. public class Test/ do something. D.import java.io.*; import java.awt.*; public class Test/ do something. 8: Givethefollowingjavasourcefragement: /pointx publicclassInteresting /dosomething WhichstatementiscorrectlyJavasyntaxatpointx?Give the following java source fragement:/point xpublic class Interesting/do somethingWhich statement is correctly Java syntax at point x? A.public class MyClass/do other thing B.static int PI=3.14 C.class MyClass/do something D.none 9: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 native method(); 10: Strings=”ExampleString”;Whichoperationisnotlegal?String s=”Example String”;Which operation is not legal?A.int i=s.length(); B.s3=”x”; C.String short_s=s.trim(); D.String t=”root”+s; 11:What is written to the standard output given the following statement:System.out.println(4|7); Select the right answer: A.4 B.5 C.6 D.7 12: Whatwillhappenwhenyouattempttocompileandrunthefollowingcode? classBase inti=99; publicvoidamethod() System.out.println(Base.amethod(); Base() amethod(); publicclassDerivedextendsBase inti=-1; publicstaticvoidmain(Stringargv) Baseb=newDerived(); System.out.println(b.i); b.amethod(); publicvoidamethod() System.out.println(Derived.amethod(); Choices:What will happen when you attempt to compile and run the following code? class Base int i = 99; public void amethod() System.out.println(Base.amethod(); Base() amethod(); public class Derived extends Baseint i = -1; public static void main(String argv) Base b = new Derived(); System.out.println(b.i); b.amethod(); public void amethod() System.out.println(Derived.amethod(); Choices:A.Derived.amethod() -1 Derived.amethod() B.Derived.amethod() 99 C.Compile time error D.Derived.amethod() 13: Whatistheresultwhenyoucompileandrunthefollowingcode? publicclassThrowsDemo staticvoidthrowMethod() System.out.println(InsidethrowMethod.); thrownewIllegalAccessException(demo); publicstaticvoidmain(Stringargs) try throwMethod(); catch(IllegalAccessExceptione) System.out.println(Caught+e); Choices:What is the result when you compile and run the following code? public class ThrowsDemo static void throwMethod() System.out.println(Inside throwMethod.); throw new IllegalAccessException(demo); public static void main(String args) try throwMethod(); catch (IllegalAccessException e) System.out.println(Caught + e); Choices:A.Compilation error B.Runtime error C.Compile successfully, nothing is printed. D.Inside throwMethod. followed by caught:java.lang.IllegalAccessExcption: demo 14:使用 JDBC 可以做到的是 A.把二进制代码传送到任何关系数据库中 B.把 Java 源代码传送到任何关系数据库中 C.把表单信息传送到任何关系数据库中 D.很容易地把 SQL 语句传送到任何关系数据库中 15: Inthefollowingcode,whichistheearlieststatement,wheretheobjectoriginallyheldine,maybegarbagecollected: 1.publicclassTest 2.publicstaticvoidmain(Stringargs) 3.Employeee=newEmployee(Bob,48); 4.e.calculatePay(); 5.System.out.println(e.printDetails(); 6.e=null; 7.e=newEmployee(Denise,36); 8.e.calculatePay(); 9.System.out.println(e.printDetails(); 10. 11. OnlyOne:In the following code, which is the earliest statement, where the object originally held in e, may be garbage collected: 1.public class Test 2. public static void main (String args ) 3. Employee e = new Employee(Bob, 48); 4. e.calculatePay(); 5. System.out.println(e.printDetails(); 6. e = null; 7. e = new Employee(Denise, 36); 8. e.calculatePay(); 9. System.out.println(e.printDetails(); 10. 11.Only One: A.Line 10 B.Line 11 C.Line 7 D.Line 8 16:Which of the following statements are not legal? A.long l = 4990; B.int i = 4L; C.double d = 34.4; D.double t = 0.9F. 17: Whichisthemostappropriatecodesnippetthatcanbeinsertedatline18inthefollowingcode? (Assumethatthecodeiscompiledandrunwithassertionsenabled) 1.importjava.util.*; 2. 3.publicclassAssertTest 4. 5.privateHashMapcctld; 6. 7.publicAssertTest() 8. 9.cctld=newHashMap(); 10.cctld.put(in,India); 11.cctld.put(uk,UnitedKingdom); 12.cctld.put(au,Australia); 13./morecode. 14. 15./othermethods. 16.publicStringgetCountry(StringcountryCode) 17. 18./Whatshouldbeinsertedhere? 19.Stringcountry=(String)cctld.get(countryCode); 20.returncountry; 21. 22.Which is the most appropriate code snippet that can be inserted at line 18 in the following code?(Assume that the code is compiled and run with assertions enabled)1. import java.util.*;2. 3. public class AssertTest4. 5. private HashMap cctld;6. 7. public AssertTest()8. 9. cctld = new HashMap();10. cctld.put(in, India);11. cctld.put(uk, United Kingdom);12. cctld.put(au, Australia);13. / more code. 14. 15. / other methods . 16. public String getCountry(String countryCode)17. 18. / What should be inserted here?19. String country = (String)cctld.get(countryCode);20. return country;21. 22. A.assert countryCode != null; B.assert countryCode != null : Country code can not be null ; C.assert cctld != null : No country code data is available; D.assert cctld : No country code data is available; 18: Consider the class hierarchy shown below: - class FourWheeler implements DrivingUtilities class Car extends FourWheeler class Truck extends FourWheeler class Bus extends FourWheeler class Crane extends FourWheeler - Consider the following code below: 1.DrivingUtilities du; 2.FourWheeler fw; 3.Truck myTruck = new Truck(); 4.du = (DrivingUtilities)myTruck; 5.fw = new Crane(); 6.fw = du; Which of the statements below are true? Choices: A.Line 4 will not compile because an interface cannot refer to an object. B.The code will compile and run. C.The code will not compile without an explicit cast at line 6, because going down the hierarchy without casting is not allowed. D.The code will compile if we put an explicit cast at line 6 but will throw an exception at runtime. 19: Which of the following statements are true? A.The automatic garbage collection of the JVM prevents programs from ever running out of memory B
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025版绿色建筑水电暖安装工程承包合同示范文本
- 2025版商场装修工程环境保护合同
- 2025年新型环保商砼运输服务合同范本
- 2025年水电站电工设施维护承包合同
- 2025年度企业法律风险防范与合规管理咨询服务合同
- 2025年法院审理离婚案件离婚协议书撰写指南及样本
- 2025年度信息安全咨询与技术服务合同
- 2025年新材料研发生产基地厂房转让合同范本
- 2025版私人艺术品买卖合同(含艺术品交易后续跟踪与维护服务)
- 2025租房补贴借款合同专业版范文
- 卡通小学幼儿园暑假生活PPT模板策划案背景图我的暑假生活课件 暑假生活汇报主题班会总结
- 企业财务会计全套教学课件
- F500-1000泥浆泵说明书
- 城市轨道交通工程技术专业介绍
- 一年级上学期家长会数学老师发言稿(共17张PPT)
- 医药电子商务复习题
- 危险品管理台帐
- 《传统节日》优秀课件(共27张ppt)
- 四年级上美术教案车(二)_苏少版
- 宁夏普通高中毕业生登记表学生综合素质评价手册完整版
- 康复医学概论
评论
0/150
提交评论