版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、。装。订。线。2009 年2010 年第一学期Java 高级编程期末试题A 卷时间共 120 分钟一、 填空题 Fillhe bls in each of the following sements: 24%(每空 1 分,共 24 分)1.2.3.Java applications begin execution at method .Each parameter must specify boReturn type _indicates(n)and a(n) .t a method will perform a task but will not return anyinformation
2、 when it completes its task.4.5.Types in Java are dividedo two categories _types and types.In Java, it issible to have several methods with the same namet each operate ondifferent types or numbers of arguments. This feature is called method .If a class declares constructors, the compiler will not cr
3、eate a(n) ..Keyword specifiest a variable is not modifiable.A(n) declaration contains a comma-separated list of constants.is a form of software reusability in which new classes acquire the members of existing classes and embellish those classes with new capabilities.10. A superclasss members
4、can be acsubclass declarations.sedhe superclass declaration and in11. Subclass constructors can call superclass constructors via the keyword.12. If a class containseast one abstract method, it is a(n) class.Classes from which objects can be instantiated are called classes.involves using a superclass
5、 variable to invoke methods on superclass andsubclass objects, enabling you to programeral.t do not provide implemen15. Methodst are noterface methods andions must bedeclared using keyword _.A(n) is used to walk through a collection and can remove elements from the collection during the iteration.Ja
6、va classes and provide the capabilities of array-like datastructurest can resize themselves dynamically.A(n) object is used to submit a query to a database.Class HttpServlet defines the methodsandto respond to get andtrequests from a cnt.20. HttpServletResponse methodobtains a character-based output
7、 streamtenables text dao be sent to the cnt二、 判断题(每题 2 分,共 20 分)(Se whether each of the following is true or false. Ilse, explain why. 20%)得分阅卷人得分阅卷人题 号一二三四总分得 分阅卷人a.An import declaration is not required when one class in a package uses anotherhe samepackage. b.Variables or methods declared wics mod
8、ifirivate are acsible only to methods ofthe class in which they are declared. c.Primitive-type local variables are initialized by default.( False. Primitive-type instancevariables are initialized by default) d.e.Reference-type instance variables are initialized by default to the value null. Any clas
9、sapplication. t contains public sic void main( String args ) can be used to execute anf.g.An array can store many different types of values. Expresarray.length is used to acs the number of arguments of a variable-lengthargument called array. h.i.Superclass constructors are not inherited by subclasse
10、s. When a subclass redefines a superclass method by using the same signature, the subclass issaid to overloadt superclass method. j.If a superclass declares an abstract method, a subclass must implementt method. 三、问答题(共 24 分)(Answer the following questions 24%)1 What is the difference betn an Abstra
11、ct class anderface?2 What is the return type of a programs main() method?3If an object is garbage collected, can ite reachable again?4. What is a void return type?5. Explain Basic Steps in writing a Java program using JDBC?6. How to call a stored procedure from JDBC?7. How to call orvlet from anothe
12、r servlet?得分阅卷人8. Why use JSP when we can do the same thing with servlets?四、选择题(1-10 每题 2 分 11-14 每题 3 分。共 32 分)(Multiple Choi32%)1. How can you force garbage collection of an object? ()A.B.C.D.E.Garbage collection cannot be forced. Call System.gc().Call System.gc() passing in a referenceto the obje
13、ct to be garbage collected. Call Runtime.gc().Set all referento the object tvalues(null, for exle).2.The class AssertionError has is - a relationship with these classes: ()A RuntimeExceptionB errorCVirtualMachineErrorDThrowable3. Which of the following collection classes from java.util package are T
14、hread safe? ()A VectorB ArrayListCHashMapDHashtable4. Which of the following sements regarding the Java programming languages Garbagecollection?(Check allt apply) ()A. It is done automaticallyB Programmers can call he System.gc() method to immediay invoke Garbage GollectionC It can vary across JVM i
15、mplemenionD It checks for and frees memory no longer neededE It ensurest memory leaks do not occur5. To which of the following sements does encapsulation refer? ()A The ability of an object to hide its data and methodB The ability for an object to behave differently depending on its typeC A way to d
16、efine new class by extending base classesD Ignoring or suppressing details to formulate a generic concept6. Which of the following sements are true about abstract classes? (Check allt apply)()得分阅卷人A Abstract classes cannot be instantiatedB Abstract classes can define constructor(s)C They can declare
17、 concrete as well as abstract methodsD Abstract classes can be extended by abstrawell as concrete subclasses7. Which of the following about the “default” acs control modifier is true? (Check alltapply) ()A It restricts acs withhe same classB It allows a member to be acsed from other classes residing
18、he same packageC It allows acs to a class member from a subclass residing in a different packageD It is more restrictivet the “Protected” keyword8. Which of the following must be the same in Overriding methods?(Check allt apply)()A NameB Argument listC Return typeD Exceptions throw9. Which of the fo
19、llowing are true about the List class?(Check allt apply)()A.A List is an unordered collectionB.No duplicates are permitted in a ListC.A List is an ordered collectionD.Duplicates are permitted in a List10. Which of the following about import sement is true? ()A Using an import sement is the only way
20、to refer to classes in a different packageB Import sements directly impact the runtime performanceC Import sement causes the compiler to load classes even if they are not referencedD They allow you to use class short names in your program11. What will happen when you attempt to compile and run the f
21、ollowing code? ()public class Test sicx = 5;sicx,y;public sic void main(String args) x-; myMethod();System.out.prln(x+y+ +x ); public sic void myMethod() y = x+ + +x; A Compile errorB prs 2C Prs 3D Prs 7E Prs 812. What will happen when you attempt to compile and run the following code?()class MyPare
22、nt x, y;MyParent(x,y)this.x = x;this.y = y;publicaddMe(x,y) return this.x + x + y + this.y; publicaddMe(MyParent myPar) return addMe(myPar.x, myPar.y); class MyChild extends MyParent z;MyChild (x,y,z)super(x,y);this.z = z;publicaddMe(x,y,z)return this.x + x + this.y + y + this.z + z;publicaddMe(MyChild myChi)return addMe(myChi.x, myChi.y, myChi.z); publicaddMe(x,y) return this.x + x + this.y + y; public class MySomeOne public sic void main(String args) MyChild my
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 医保违规案例考核题库(含答案)
- 国开(中央电大)本科《国际经济法》网上形考(任务1至4)试题及答案
- 2026年护理学统计模拟试题带答案
- 2026年机械类安全员c1考试题库及答案
- 2026年监理工程师(建设工程监理基本理论与相关法规)高频考点练习题及答案
- 2026年考爆破员证模拟试题(含答案)
- 2026年教资中职专业指导课科目一综合素质上半年真题及答案
- 2026年来广营社区卫生服务中心招聘模拟考试题(含答案)
- 2026年煤矿招生考试模拟试卷及参考答案
- 2026年农机模拟考试题目及答案
- 《DB65-T 8003-2023 建设工程电子文件与电子档案管理标准》
- 新苏教版科学五年级上册第一单元光与色彩单元小结
- 建筑工程技术标-质量管理体系与措施
- 《电化学储能电站建设项目文件收集与档案管理规范》
- 上海市东昌中学2025-2026学年3月高三英语试题试卷含解析
- 钢板仓工程专项施工方案
- DB32∕T 2914-2025 危险场所电气防爆安全检查规范
- 2025深圳市茅洲河流域洪涝风险图集
- 2024年青岛崂山旅游集团招聘考试真题
- NBT 11127-2023 在用钢丝绳芯输送带报废检测技术规范
- 浙江党费管理办法
评论
0/150
提交评论