




已阅读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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 四川省巴中市普通高中2023级“零诊”考试物理试题(含答案)
- 2025届北京市东城区化学九年级第一学期期中经典试题含解析
- 多囊卵巢综合症的护理
- 湖北省武汉青山区七校联考2026届九上化学期中调研试题含解析
- 电力变送器培训
- 2026届湖北省宜昌市当阳市化学九年级第一学期期中教学质量检测试题含解析
- 浙江杭州余杭区2026届英语九上期末综合测试模拟试题含解析
- 2026届山东省烟台龙口市九上化学期中达标测试试题含解析
- 贵州省黔东南州麻江县2026届化学九上期中学业质量监测模拟试题含解析
- 第二部分 第十一章 第55课时 区域发展对交通运输布局的影响(重难课时)2026年高考地理第一轮总复习
- 中国血脂管理指南(基层版+2024年)解读
- 分子诊断技术在感染性疾病中的应用-深度研究
- 《智能AI分析深度解读报告》课件
- 行测5000题电子版2025
- 《规训与惩罚》课件
- 【MOOC】声乐作品赏析与演唱-扬州大学 中国大学慕课MOOC答案
- 2024年版机电产品国际招标标准招标文件
- 糖尿病高血压健康教育
- 铜府字202322号铜鼓县革命文物保护利用专项规划(公布稿)
- 企业员工心理健康与欺凌防范政策
- 平面构成中的形式美法则
评论
0/150
提交评论