上海国响信息技术有限公司_第1页
上海国响信息技术有限公司_第2页
上海国响信息技术有限公司_第3页
上海国响信息技术有限公司_第4页
上海国响信息技术有限公司_第5页
已阅读5页,还剩3页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

选择题 1: 1. Whatistheresultwhenyoucompileandrunthefollowingcode? 2. 3. publicclassTest 4. 5. 6. 7. publicvoidmethod() 8. 9. 10. 11. for(inti=0;i3;i+) 12. 13. 14. 15. System.out.print(i); 16. 17. 18. 19. System.out.print(i); 20. 21. 22. 23. 24. 25. Choices:What is the result when you compile and run the following code? public class Test public void method()for(int i = 0; i ” and “”. Which statement is true? A.1010 0000 0000 0000 0000 0000 0000 0000 4 give 0000 1010 0000 0000 0000 0000 0000 0000 B.1010 0000 0000 0000 0000 0000 0000 0000 4 give 1111 1010 0000 0000 0000 0000 0000 0000 C.1010 0000 0000 0000 0000 0000 0000 0000 4 give 0000 0000 0000 0000 0000 0000 0000 0000 D.1010 0000 0000 0000 0000 0000 0000 0000 4 give 1111 1010 0000 0000 0000 0000 0000 0000 9: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 10: 1. publicclassOuterClass 2. privatedoubled1=1.0; 3. /insertcodehere 4. 5. Youneedtoinsertaninnerclassdeclarationatline3.Whichtwoinnerclassdeclarationsare 6. 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; 11: 1. publicclassX 2. 3. publicObjectm() 4. 5. Objecto=newFloat(3.14F);/line3 6. 7. Objectoa=newObject1;/line4 8. 9. oa0=o;/line5 10. 11. o=null;/line6 12. 13. returnoa0;/line7 14. 15. 16. 17. 18. WhenistheFloatobject,createdinline3,eligibleforgarbagecollection?public class X public Object m() Object o = new Float(3.14F);/line 3 Object oa = new Object1;/line 4 oa0 = o;/line 5 o=null;/line 6 return oa0;/line 7 When is the Float object, created in line 3,eligible for garbage collection?A.just after line 5. B.just after line 6 C.just after line 7(that is,as the method returns) D.never in this method 12:Which statements about Java code security are not true? A.The bytecode verifier loads all classes needed for the execution of a program. B.Executing code is performed by the runtime interpreter. C.At runtime the bytecodes are loaded, checked and run in an interpreter. D.The class loader adds security by separating the namespaces for the classes of the local file system from those imported from network sources. 13:使用 JDBC 可以做到的是 A.把二进制代码传送到任何关系数据库中 B.把 Java 源代码传送到任何关系数据库中 C.把表单信息传送到任何关系数据库中 D.很容易地把 SQL 语句传送到任何关系数据库中 14: 1. Givethefollowingcode: 2. publicclassExample 3. publicstaticvoidmain(Stringargs) 4. intl=0; 5. do 6. System.out.println(“Doingitforlis:”+l); 7. while(-l0) 8. System.out.println(“Finish”); 9. 10. 11. Whichwellbeoutput:Give the following code:public class Examplepublic static void main(String args )int l=0;doSystem.out.println(“Doing it for l is:”+l);while(-l0)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 15: 1. Whatwillhappenwhenyouattempttocompileandrunthefollowingcode? 2. 3. intOutput=10; 4. 5. booleanb1=false; 6. 7. if(b1=true)&(Output+=10)=20) 8. 9. 10. 11. System.out.println(Weareequal+Output); 12. 13. 14. 15. else16. 17. 18. 19. System.out.println(Notequal!+Output); 20. 21. 22. 23. Choices:What will happen when you attempt to compile and run the following code? int Output = 10;boolean b1 = false; if(b1 = true) & (Output += 10) = 20) System.out.println(We are equal + Output); else System.out.println(Not equal! + Output); Choices:A.Compilation error, attempting to perform binary comparison on logical data type B.Compilation and output of We are equal 10. C.Compilation and output of Not equal! 20. D.Compilation and output of Not equal! 10. 16:设有变量说明语句int a=1,b=0; 则执行以下程序段的输出结果为( )。 switch (a) case 1: switch (b) case 0:printf(*0*);break; case 1:printf(*1*);break; case 2:printf(*2*);break; printf(n); A.*0* B.*0*2* C.*0*1*2* D.有语法错误 简答题 17:String是最基本的数据类型吗? 18:数组aN,存放了1至N-1个数,其中某个数重复一次。写一个函数,找出被重复的数字.时间复杂度必须为o(N)函数原型:int do_dup(int a,int N) 19:用 100 元钱买 100 支笔,其中钢笔 3 元 / 支,圆珠笔 2 元 / 支,铅笔 0.5 元 / 支,问钢笔、圆珠笔和铅笔可以各买多少支 ? 20:如何现实servlet的单线程模式? 21:有一个整数n,写一个函数f(n),返回0到n之间出现的1的个数。比如f(13)=6,现

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论